Merge branch 'master' of git.lumiera.org:/git/LUMIERA into gui

This commit is contained in:
Joel Holdsworth 2009-01-17 16:34:19 +00:00
commit bbbda188e2
23 changed files with 105 additions and 40 deletions

View file

@ -64,6 +64,7 @@ include $(top_srcdir)/icons/Makefile.am
include $(top_srcdir)/tests/lib/Makefile.am
include $(top_srcdir)/tests/components/Makefile.am
include $(top_srcdir)/tests/Makefile.am
include $(top_srcdir)/tests/tool/Makefile.am
#EXTRA_DIST += admin debian doc depcomp README.BUILD LICENSE \
# cinelerra-cvs-current.spec

View file

@ -25,6 +25,7 @@ liblumierabackend_la_LIBADD = liblumiera.la
liblumierabackend_la_SOURCES = \
$(liblumierabackend_la_srcdir)/mediaaccessfacade.cpp \
$(liblumierabackend_la_srcdir)/backend.c \
$(liblumierabackend_la_srcdir)/threads.c \
$(liblumierabackend_la_srcdir)/file.c \
$(liblumierabackend_la_srcdir)/filehandle.c \
$(liblumierabackend_la_srcdir)/filedescriptor.c \
@ -39,6 +40,7 @@ liblumierabackend_la_SOURCES = \
noinst_HEADERS += \
$(liblumierabackend_la_srcdir)/backend.h \
$(liblumierabackend_la_srcdir)/threads.h \
$(liblumierabackend_la_srcdir)/file.h \
$(liblumierabackend_la_srcdir)/filehandle.h \
$(liblumierabackend_la_srcdir)/filedescriptor.h \
@ -46,11 +48,4 @@ noinst_HEADERS += \
$(liblumierabackend_la_srcdir)/mmap.h \
$(liblumierabackend_la_srcdir)/mmapings.h \
$(liblumierabackend_la_srcdir)/mmapcache.h
$(liblumierabackend_la_srcdir)/backend.h \
$(liblumierabackend_la_srcdir)/file.h \
$(liblumierabackend_la_srcdir)/filehandle.h \
$(liblumierabackend_la_srcdir)/filedescriptor.h \
$(liblumierabackend_la_srcdir)/filehandlecache.h \
$(liblumierabackend_la_srcdir)/mmap.h \
$(liblumierabackend_la_srcdir)/mmapings.h \
$(liblumierabackend_la_srcdir)/mmapcache.h

View file

@ -141,7 +141,7 @@ lumiera_filedescriptor_acquire (const char* name, int flags, LList filenode)
INFO (filedescriptor, "try creating dir: %s", dir);
if (mkdir (dir, 0777) == -1 && errno != EEXIST)
{
LUMIERA_ERROR_SET (filedescriptor, ERRNO, name);
LUMIERA_ERROR_SET_CRITICAL (filedescriptor, ERRNO, name);
goto error;
}
*slash = '/';
@ -152,14 +152,14 @@ lumiera_filedescriptor_acquire (const char* name, int flags, LList filenode)
fd = creat (name, 0666);
if (fd == -1)
{
LUMIERA_ERROR_SET (filedescriptor, ERRNO, name);
LUMIERA_ERROR_SET_CRITICAL (filedescriptor, ERRNO, name);
goto error;
}
close (fd);
if (stat (name, &fdesc.stat) != 0)
{
/* finally, no luck */
LUMIERA_ERROR_SET (filedescriptor, ERRNO, name);
LUMIERA_ERROR_SET_CRITICAL (filedescriptor, ERRNO, name);
goto error;
}
}

View file

@ -84,7 +84,8 @@ lumiera_filehandle_handle (LumieraFilehandle self)
fd = open (lumiera_filedescriptor_name (self->descriptor), lumiera_filedescriptor_flags (self->descriptor) & LUMIERA_FILE_MASK);
if (fd == -1)
{
LUMIERA_ERROR_SET (filehandle, ERRNO, lumiera_filedescriptor_name (self->descriptor));
FIXME ("Handle EMFILE etc with the resourcecollector");
LUMIERA_ERROR_SET_CRITICAL (filehandle, ERRNO, lumiera_filedescriptor_name (self->descriptor));
}
else
{
@ -92,13 +93,15 @@ lumiera_filehandle_handle (LumieraFilehandle self)
if (fstat (fd, &st) == -1)
{
close (fd);
LUMIERA_ERROR_SET (filehandle, ERRNO, lumiera_filedescriptor_name (self->descriptor));
fd = -1;
LUMIERA_ERROR_SET_CRITICAL (filehandle, ERRNO, lumiera_filedescriptor_name (self->descriptor));
}
else if (!lumiera_filedescriptor_samestat (self->descriptor, &st))
{
close (fd);
fd = -1;
/* Woops this is not the file we expected to use */
LUMIERA_ERROR_SET (filehandle, FILE_CHANGED, lumiera_filedescriptor_name (self->descriptor));
LUMIERA_ERROR_SET_CRITICAL (filehandle, FILE_CHANGED, lumiera_filedescriptor_name (self->descriptor));
}
}
self->fd = fd;

View file

@ -84,8 +84,9 @@ lumiera_filehandlecache_handle_acquire (LumieraFilehandlecache self, LumieraFile
/* allocate new filehandle if we are below the limit or no cached handles are available (overallocating) */
NOTICE (filehandlecache, "overallocating filehandle");
ret = lumiera_filehandle_new (desc);
TODO ("use resourcecollector here");
if (!ret)
LUMIERA_ERROR_SET (filehandlecache, FILEHANDLECACHE_NOHANDLE, lumiera_filedescriptor_name (desc));
LUMIERA_ERROR_SET_ALERT (filehandlecache, FILEHANDLECACHE_NOHANDLE, lumiera_filedescriptor_name (desc));
else
--self->available;
}

View file

@ -124,6 +124,7 @@ lumiera_mmap_init (LumieraMMap self, LumieraFile file, off_t start, size_t size)
{
TODO ("check if current mmapped size exceeds configured as_size (as_size be smaller than retrieved from getrlimit())");
TODO ("use resourcecllector here");
switch (strategy++)
{
case FIRST_TRY:
@ -173,7 +174,7 @@ lumiera_mmap_init (LumieraMMap self, LumieraFile file, off_t start, size_t size)
break;
case GIVE_UP:
LUMIERA_ERROR_SET (mmap, MMAP_SPACE, lumiera_filedescriptor_name (file->descriptor));
LUMIERA_ERROR_SET_ALERT (mmap, MMAP_SPACE, lumiera_filedescriptor_name (file->descriptor));
goto espace;
}

View file

@ -29,7 +29,7 @@
#include "lib/sync.hpp"
extern "C" {
#include "lib/threads.h"
#include "backend/threads.h"
}
#include <tr1/functional>

View file

@ -23,7 +23,7 @@
//TODO: Lumiera header includes//
#include "lib/threads.h"
#include "threads.h"
//TODO: internal/static forward declarations//

View file

@ -208,7 +208,7 @@ lumiera_config_get (const char* key, const char** value)
*value = item->delim+1;
}
else
LUMIERA_ERROR_SET (configsys, CONFIG_NO_ENTRY, key);
LUMIERA_ERROR_SET_WARNING (configsys, CONFIG_NO_ENTRY, key);
}
}
else

View file

@ -82,7 +82,7 @@ lumiera_config_number_get (const char* key, long long* value)
}
}
else
LUMIERA_ERROR_SET (configsys, CONFIG_NO_ENTRY, key);
LUMIERA_ERROR_SET_WARNING (configsys, CONFIG_NO_ENTRY, key);
}
}
@ -208,7 +208,7 @@ lumiera_config_string_get (const char* key, const char** value)
*value = scan_string (raw_value);
}
else
LUMIERA_ERROR_SET (configsys, CONFIG_NO_ENTRY, key);
LUMIERA_ERROR_SET_WARNING (configsys, CONFIG_NO_ENTRY, key);
}
}
@ -253,7 +253,7 @@ lumiera_config_wordlist_get (const char* key, const char** value)
*value = raw_value;
}
else
LUMIERA_ERROR_SET (configsys, CONFIG_NO_ENTRY, key);
LUMIERA_ERROR_SET_WARNING (configsys, CONFIG_NO_ENTRY, key);
TODO ("remove the ERROR_SET because config_get sets it already? also in all other getters in this file");
}
@ -322,7 +322,7 @@ lumiera_config_word_get (const char* key, const char** value)
*value = scan_word (raw_value);
}
else
LUMIERA_ERROR_SET (configsys, CONFIG_NO_ENTRY, key);
LUMIERA_ERROR_SET_WARNING (configsys, CONFIG_NO_ENTRY, key);
}
}

View file

@ -289,7 +289,7 @@ lumiera_plugin_register (LumieraPlugin plugin)
}
else
{
LUMIERA_ERROR_SET (plugin, PLUGIN_REGISTER, plugin->name);
LUMIERA_ERROR_SET_CRITICAL (plugin, PLUGIN_REGISTER, plugin->name);
}
}
return !!lumiera_error_peek();

View file

@ -53,7 +53,7 @@
#include "gui/guifacade.hpp"
#include "gui/notification-service.hpp"
#include "common/subsys.hpp"
#include "lib/thread-wrapper.hpp"
#include "backend/thread-wrapper.hpp"
#include "lib/singleton.hpp"
extern "C" {

View file

@ -28,7 +28,6 @@ liblumiera_la_SOURCES = \
$(liblumiera_la_srcdir)/rwlock.c \
$(liblumiera_la_srcdir)/condition.c \
$(liblumiera_la_srcdir)/reccondition.c \
$(liblumiera_la_srcdir)/threads.c \
$(liblumiera_la_srcdir)/luid.c \
$(liblumiera_la_srcdir)/safeclib.c \
$(liblumiera_la_srcdir)/psplay.c \
@ -54,7 +53,6 @@ noinst_HEADERS += \
$(liblumiera_la_srcdir)/rwlock.h \
$(liblumiera_la_srcdir)/condition.h \
$(liblumiera_la_srcdir)/reccondition.h \
$(liblumiera_la_srcdir)/threads.h \
$(liblumiera_la_srcdir)/luid.h \
$(liblumiera_la_srcdir)/safeclib.h \
$(liblumiera_la_srcdir)/psplay.h \

View file

@ -64,8 +64,10 @@ lumiera_err LUMIERA_ERROR_##err = "LUMIERA_ERROR_" #err ":" msg
/**
* Helper macro to raise an error for the current thread.
* This macro eases setting an error. It adds NoBug logging support to the low level error handling.
* Used for unexpected errors which can be handled without any problems.
* @param flag NoBug flag describing the subsystem where the error was raised
* @param err name of the error without the 'LUMIERA_ERROR_' prefix (example: NO_MEMORY)
* @param extra optional string (or NULL) which adds some more context to the error, can be a temporary
*/
#define LUMIERA_ERROR_SET(flag, err, extra) \
do { \
@ -74,11 +76,56 @@ lumiera_err LUMIERA_ERROR_##err = "LUMIERA_ERROR_" #err ":" msg
lumiera_error_set(LUMIERA_ERROR_##err, theextra); \
} while (0)
/**
* Helper macro to raise an error for the current thread.
* Same as LUMIERA_ERROR_SET(), but logs at 'LOG_ALERT' level.
* Use this when the application is about to do a emergency shutdown.
* @param flag NoBug flag describing the subsystem where the error was raised
* @param err name of the error without the 'LUMIERA_ERROR_' prefix (example: NO_MEMORY)
* @param extra optional string (or NULL) which adds some more context to the error, can be a temporary
*/
#define LUMIERA_ERROR_SET_ALERT(flag, err, extra) \
do { \
const char* theextra = extra; \
ALERT (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:""); \
lumiera_error_set(LUMIERA_ERROR_##err, theextra); \
} while (0)
/**
* Helper macro to raise an error for the current thread.
* Same as LUMIERA_ERROR_SET(), but logs at 'LOG_CRIT' level.
* Use this when a requested task can not be completed (maybe user intervention is necessary).
* @param flag NoBug flag describing the subsystem where the error was raised
* @param err name of the error without the 'LUMIERA_ERROR_' prefix (example: NO_MEMORY)
* @param extra optional string (or NULL) which adds some more context to the error, can be a temporary
*/
#define LUMIERA_ERROR_SET_CRITICAL(flag, err, extra) \
do { \
const char* theextra = extra; \
CRITICAL (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:"");\
lumiera_error_set(LUMIERA_ERROR_##err, theextra); \
} while (0)
/**
* Helper macro to raise an error for the current thread.
* Same as LUMIERA_ERROR_SET(), but logs at 'LOG_WARNING' level.
* Use this when a not unexected error happens which can be handled.
* @param flag NoBug flag describing the subsystem where the error was raised
* @param err name of the error without the 'LUMIERA_ERROR_' prefix (example: NO_MEMORY)
* @param extra optional string (or NULL) which adds some more context to the error, can be a temporary
*/
#define LUMIERA_ERROR_SET_WARNING(flag, err, extra) \
do { \
const char* theextra = extra; \
WARN (flag, "%s%s%s", strchr(LUMIERA_ERROR_##err, ':')+1, theextra?": ":"", theextra?theextra:""); \
lumiera_error_set(LUMIERA_ERROR_##err, theextra); \
} while (0)
/**
* Set error state for the current thread.
* If the error state of the current thread was cleared, then set it, else preserve the old state.
* @param nerr name of the error with 'LUMIERA_ERROR_' prefix (example: LUMIERA_ERROR_NO_MEMORY)
* @param extra a string (possibly a constructed tmpbuf) which adds some more context to the error occured this will be copied
* @param extra a string (possibly a constructed tmpbuf) which adds some more context to the error, can be a temporary
* @return old state, that is NULL for success, when the state was cleared and a pointer to a pending
* error when the error state was already set
*/

View file

@ -24,12 +24,6 @@ luidgen_LDADD = liblumiera.la $(NOBUGMT_LUMIERA_LIBS) liblumiera
luidgen_SOURCES = $(lumitool_srcdir)/luidgen.c
noinst_PROGRAMS += vgsuppression
vgsuppression_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
vgsuppression_LDADD = liblumiera.la $(NOBUGMT_LUMIERA_LIBS) -ldl liblumieracommon.la liblumieraproc.la -lboost_regex-mt -lboost_program_options-mt -ldl
vgsuppression_SOURCES = $(lumitool_srcdir)/vgsuppression.c
noinst_PROGRAMS += rsvg-convert
rsvg_convert_CPPFLAGS = $(AM_CPPFLAGS) $(LUMIERA_GUI_CFLAGS) -std=gnu99 -Wall -Werror
rsvg_convert_LDADD = -lcairo -lglib-2.0 -lgthread-2.0 -lrsvg-2

View file

@ -7,7 +7,6 @@ Import('env','envGtk','artifacts','core')
support_lib = artifacts['support']
vgsuppr = env.Program('#$BINDIR/vgsuppression','vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms
luidgen = env.Program('#$BINDIR/luidgen', 'luidgen.c', LIBS=support_lib) ## for rendering SVG icons (uses librsvg)
rsvg = envGtk.Program('#$BINDIR/rsvg-convert','rsvg-convert.c')
@ -17,7 +16,6 @@ rsvg = envGtk.Program('#$BINDIR/rsvg-convert','rsvg-convert.c')
artifacts['tools'] = [ env.Program('#$BINDIR/hello-world','hello.c') #### hello world (checks C build)
+ env.Program('#$BINDIR/try', 'try.cpp') #### to try out some feature...
+ luidgen
+ vgsuppr
+ rsvg
]

View file

@ -78,13 +78,12 @@ test_config_LDADD = \
check_LTLIBRARIES += examplepluginc.la
examplepluginc_la_SOURCES = $(tests_srcdir)/plugin/examplepluginc/example_plugin.c
examplepluginc_la_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror -DLUMIERA_PLUGIN -I$(top_srcdir)/src/
examplepluginc_la_LDFLAGS = -module -avoid-version -no-undefined -rpath /dev/null
examplepluginc_la_LDFLAGS = -module -avoid-version -no-undefined -rpath /dev/null -shrext .lum
check_PROGRAMS += test-interfaces
test_interfaces_SOURCES = $(tests_srcdir)/common/test-interfaces.c
test_interfaces_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
test_interfaces_LDADD = liblumiera.la $(LUMIERA_PLUGIN_LIBS) $(NOBUGMT_LUMIERA_LIBS) liblumieracommon.la liblumieraproc.la -ldl -lboost_program_options-mt -lboost_regex-mt
test_interfaces_DEPENDENCIES = examplepluginc.la liblumiera.la
check_PROGRAMS += test-filemmap
test_filemmap_SOURCES = $(tests_srcdir)/backend/test-filemmap.c

View file

@ -63,6 +63,10 @@ artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in ['lib','co
# for creating a Valgrind-Suppression file
vgsuppr = env.Program('#$BINDIR/vgsuppression','tool/vgsuppression.c', LIBS=core) ## for suppressing false valgrind alarms
artifacts['tools'] += [vgsuppr]
Depends(ts,vgsuppr)
#

View file

@ -27,7 +27,7 @@
#include "common/option.hpp"
#include "include/symbol.hpp"
#include "lib/thread-wrapper.hpp"
#include "backend/thread-wrapper.hpp"
#include "lib/error.hpp"
#include "lib/query.hpp"
#include "lib/util.hpp"

View file

@ -24,7 +24,7 @@
#include "lib/test/run.hpp"
#include "include/symbol.hpp"
#include "lib/thread-wrapper.hpp"
#include "backend/thread-wrapper.hpp"
#include "lib/sync.hpp"
#include <tr1/functional>

24
tests/tool/Makefile.am Normal file
View file

@ -0,0 +1,24 @@
# Copyright (C) Lumiera.org
# 2008 Christian Thaeter <ct@pipapo.org>
#
# 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., 675 Mass Ave, Cambridge, MA 02139, USA.
lumitesttool_srcdir = $(top_srcdir)/tests/tool
noinst_PROGRAMS += vgsuppression
vgsuppression_CPPFLAGS = $(AM_CPPFLAGS) -std=gnu99 -Wall -Werror
vgsuppression_LDADD = liblumiera.la $(NOBUGMT_LUMIERA_LIBS) -ldl liblumieracommon.la liblumieraproc.la -lboost_regex-mt -lboost_program_options-mt -ldl
vgsuppression_SOURCES = $(lumitesttool_srcdir)/vgsuppression.c