diff --git a/INSTALL b/INSTALL index 7983166ec..3ecc05196 100644 --- a/INSTALL +++ b/INSTALL @@ -1,6 +1,99 @@ Running / Installing Lumiera Prototype ====================================== -** to be written ** +From: +http://www.pipapo.org/pipawiki/Lumiera/NewbiesTutorials + + +Newbies Tutorials + +This page contains some tutorials for beginners that want to help to the +developers of Lumiera. + +Trying the Lumiera GUI from Joel + +You need to have: + + * libboost + * libtool + * git + * libgavl + * nobug(see below) + +For Ubuntu Hardy also: + + * libglade2-dev + * libgdl-1-dev + * libgtkmm-2.4-dev + * libxv-dev + +also check http://gnuradio.org/trac/wiki/UbuntuInstall#InstallationOptions to +see that all your installations options are met. + +Installing nobug from git + +Create a temp directory where you can have the sourcecode of the libraries you +will use as well as lumieras branches you want to try. Example ~/temp. cd to +that directory and run: + +git clone git://git.pipapo.org/nobug + +This will create a directory called nobug with sourcecode in your current +directory. + +cd nobug +autoreconf -i +mkdir build +cd build +../configure +make +make install + +Getting the Lumiera source code + +In the temp directory + +git clone git://git.lumiera.org/LUMIERA +cd LUMIERA +autoreconf -fi +mkdir build +cd build +../configure +make + +maybe run the testsuite by + +make check + +This will take some time. After it has finished: + +./lumigui + +[NewbiesTut] + +Contibuting + +Nothing is easier, follow the basic instructions at http://www.kernel.org/pub/ +software/scm/git/docs/gittutorial.html, notably the + +$ git config --global user.name "Your Name Comes Here" +$ git config --global user.email you@yourdomain.example.com + +parts. + +Then you are ready to go, you can edit and commit the lumiera code locally in +your cloned repository. Please do small commits which fix/improve only one +single thing and use meaningful commit messages. Check that you didn't broke +anything + + * by running 'make check'. + +Finally you can push your changes to the lumiera server to the 'mob' +repository: + +$ git push git://git.lumiera.org/lumiera/mob master:refs/heads/YOURNAME + +This creates a new branch 'YOURNAME' on the mob repository. Then you notify the +other devs on the mailinglist and they may merge your code into the mainline. diff --git a/SConstruct b/SConstruct index 58b47e4dc..91b9f9066 100644 --- a/SConstruct +++ b/SConstruct @@ -28,6 +28,7 @@ CUSTOPTIONSFILE = 'custom-options' SRCDIR = 'src' BINDIR = 'bin' LIBDIR = '.libs' +PLUGDIR = '.libs' TESTDIR = 'tests' ICONDIR = 'icons' VERSION = '0.1+pre.01' @@ -74,10 +75,11 @@ def setupBasicEnvironment(): , SRCDIR=SRCDIR , BINDIR=BINDIR , LIBDIR=LIBDIR + , PLUGDIR=PLUGDIR , ICONDIR=ICONDIR , CPPPATH=["#"+SRCDIR] # used to find includes, "#" means always absolute to build-root , CPPDEFINES=['-DLUMIERA_VERSION='+VERSION ] # note: it's a list to append further defines - , CCFLAGS='-Wall ' # -fdiagnostics-show-option + , CCFLAGS='-Wall -Wextra ' , CFLAGS='-std=gnu99' ) RegisterIcon_Builder(env,SVGRENDERER) @@ -255,6 +257,9 @@ def configurePlatform(env): if not conf.CheckPkgConfig('glibmm-2.4', '2.16'): problems.append('Unable to configure Lib glib--, exiting.') + if not conf.CheckPkgConfig('gthread-2.0', '2.16'): + problems.append('Need gthread support lib for glib-- based thread handling.') + if not conf.CheckPkgConfig('cairomm-1.0', 0.6): problems.append('Unable to configure Cairo--, exiting.') @@ -317,28 +322,30 @@ def defineBuildTargets(env, artifacts): # + env.PrecompiledHeader('$SRCDIR/pre_a.hpp') # ) - objapp = srcSubtree(env,'$SRCDIR/common') - objback = srcSubtree(env,'$SRCDIR/backend') - objproc = srcSubtree(env,'$SRCDIR/proc') - objlib = srcSubtree(env,'$SRCDIR/lib') - core = ( env.SharedLibrary('$LIBDIR/lumieracommon', objapp) - + env.SharedLibrary('$LIBDIR/lumierabackend', objback) - + env.SharedLibrary('$LIBDIR/lumieraproc', objproc) - + env.SharedLibrary('$LIBDIR/lumiera', objlib) - ) + + lApp = env.SharedLibrary('$LIBDIR/lumieracommon', srcSubtree(env,'$SRCDIR/common')) + lBack = env.SharedLibrary('$LIBDIR/lumierabackend', srcSubtree(env,'$SRCDIR/backend')) + lProc = env.SharedLibrary('$LIBDIR/lumieraproc', srcSubtree(env,'$SRCDIR/proc')) + lLib = env.SharedLibrary('$LIBDIR/lumiera', srcSubtree(env,'$SRCDIR/lib')) + + core = lLib+lApp+lBack+lProc artifacts['lumiera'] = env.Program('$BINDIR/lumiera', ['$SRCDIR/lumiera/main.cpp'], LIBS=core) - artifacts['corelib'] = core - + artifacts['corelib'] = lLib+lApp + artifacts['support'] = lLib + # building Lumiera Plugins + envPlu = env.Clone() + envPlu.Append(CPPDEFINES='LUMIERA_PLUGIN') artifacts['plugins'] = [] # currently none # the Lumiera GTK GUI - envgtk = env.Clone().mergeConf(['gtkmm-2.4','cairomm-1.0','gdl-1.0','librsvg-2.0','xv','xext','sm']) - envgtk.Append(CPPDEFINES='LUMIERA_PLUGIN', LIBS=core) - objgui = srcSubtree(envgtk,'$SRCDIR/gui') + envGtk = env.Clone() + envGtk.mergeConf(['gtkmm-2.4','cairomm-1.0','gdl-1.0','librsvg-2.0','xv','xext','sm']) + envGtk.Append(CPPDEFINES='LUMIERA_PLUGIN', LIBS=core) + objgui = srcSubtree(envGtk,'$SRCDIR/gui') # render and install Icons vector_icon_dir = env.subst('$ICONDIR/svg') @@ -347,17 +354,16 @@ def defineBuildTargets(env, artifacts): + [env.IconCopy(f) for f in scanSubtree(prerendered_icon_dir, ['*.png'])] ) - guimodule = envgtk.LoadableModule('$LIBDIR/gtk_gui', objgui, SHLIBPREFIX='', SHLIBSUFFIX='.lum') + guimodule = envGtk.LoadableModule('$LIBDIR/gtk_gui', objgui, SHLIBPREFIX='', SHLIBSUFFIX='.lum') artifacts['lumigui'] = ( guimodule - + envgtk.Program('$BINDIR/lumigui', objgui ) + + envGtk.Program('$BINDIR/lumigui', objgui ) + env.Install('$BINDIR', env.Glob('$SRCDIR/gui/*.rc')) + artifacts['icons'] ) # call subdir SConscript(s) for independent components - SConscript(dirs=[SRCDIR+'/tool'], exports='env artifacts core') - SConscript(dirs=['admin'], exports='env envgtk artifacts core') - SConscript(dirs=[TESTDIR], exports='env artifacts core') + SConscript(dirs=[SRCDIR+'/tool'], exports='env envGtk artifacts core') + SConscript(dirs=[TESTDIR], exports='env envPlu artifacts core') diff --git a/admin/SConscript b/admin/SConscript deleted file mode 100644 index 2737bab7e..000000000 --- a/admin/SConscript +++ /dev/null @@ -1,17 +0,0 @@ -# -*- python -*- -## -## SConscript - SCons buildscript for helper tools (called by SConstruct) -## - -Import('env','envgtk','artifacts','core') - -vgsuppr = env.Program('#$BINDIR/vgsuppression',['vgsuppression.c']+core) -rsvg = envgtk.Program('#$BINDIR/rsvg-convert','rsvg-convert.c') - -artifacts['tools'] += [ vgsuppr ## for suppressing false valgrind alarms - + rsvg ## for rendering SVG icons (uses librsvg) - ] - -# Rendering the SVG Icons depends on rsvg-convert -env.Depends(artifacts['icons'], rsvg) - diff --git a/admin/render-icon.py b/admin/render-icon.py index 4b0d464ca..0f9cee294 100755 --- a/admin/render-icon.py +++ b/admin/render-icon.py @@ -20,10 +20,9 @@ # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. import sys -import os -import os.path as Path import getopt from xml.dom import minidom +import os import shutil #svgDir = "svg" @@ -33,20 +32,20 @@ rsvgPath = "./rsvg-convert" artworkLayerPrefix = "artwork:" def createDirectory( name ): - if Path.isfile(name): - print "WARNING: moving %s to %s.bak because it's in the way." % (name,name) - bak_name = name + ".bak" - if Path.isfile(bak_name): - os.remove(bak_name) - os.rename(name,bak_name) - if not Path.isdir(name): - os.mkdir(name) + try: + if os.path.isfile(name): + os.remove(name) + if not os.path.exists(name): + os.mkdir(name) + except: + print 'WARNING: createDirectory("%s") failed. Permission problems?' % name + def copyMergeDirectory( src, dst ): listing = os.listdir(src) for file_name in listing: - src_file_path = Path.join(src, file_name) - dst_file_path = Path.join(dst, file_name) + src_file_path = os.path.join(src, file_name) + dst_file_path = os.path.join(dst, file_name) shutil.copyfile(src_file_path, dst_file_path) def getDocumentSize( svg_element ): @@ -165,19 +164,19 @@ def main(argv): print "Missing arguments in_path and out_dir." sys.exit(1) - if Path.isfile(out_dir): + if os.path.isfile(out_dir): print "Unable to use '%s' as output directory, because it\'s a file." % out_dir sys.exit(1) - if not Path.isdir(out_dir): + if not os.path.isdir(out_dir): print "Output directory '%s' not found." % out_dir sys.exit(1) # Create the icons folders - createDirectory(Path.join(out_dir, "48x48")) - createDirectory(Path.join(out_dir, "32x32")) - createDirectory(Path.join(out_dir, "24x24")) - createDirectory(Path.join(out_dir, "22x22")) - createDirectory(Path.join(out_dir, "16x16")) + createDirectory(os.path.join(out_dir, "48x48")) + createDirectory(os.path.join(out_dir, "32x32")) + createDirectory(os.path.join(out_dir, "24x24")) + createDirectory(os.path.join(out_dir, "22x22")) + createDirectory(os.path.join(out_dir, "16x16")) renderSvgIcon(in_path, out_dir) diff --git a/admin/scons/Buildhelper.py b/admin/scons/Buildhelper.py index a8a76a600..159dc4721 100644 --- a/admin/scons/Buildhelper.py +++ b/admin/scons/Buildhelper.py @@ -91,6 +91,38 @@ def globRootdirs(roots): +def findSrcTrees(location, patterns=SRCPATTERNS): + """ find possible source tree roots, starting with the given location. + When delving down from the initial location(s), a source tree is defined + as a directory containing source files and possibly further sub directories. + After having initially expanded the given location with #globRootdirs, each + directory is examined depth first, until encountering a directory containing + source files, which then yields a result. Especially, this can be used to traverse + an organisational directory structure and find out all possible source trees of + to be built into packages, plugins, individual tool executables etc. + @return: the relative path names of all source root dirs found (generator function). + """ + for dir in globRootdirs(location): + if isSrcDir(dir,patterns): + yield dir + else: + for result in findSrcTrees(str(dir)+'/*'): + yield result + + +def isSrcDir(path, patterns=SRCPATTERNS): + """ helper: investigate the given (relative) path + @param patterns: list of wildcards defining what counts as "source file" + @return: True if it's a directory containing any source file + """ + if not os.path.isdir(path): + return False + else: + for p in patterns: + if glob.glob(path+'/'+p): + return True + + def filterNodes(nlist, removeName=None): """ filter out scons build nodes using the given criteria. @@ -115,6 +147,19 @@ def getDirname(dir): +def createPlugins(env, dir): + """ investigate the given source directory to identify all contained source trees. + @return: a list of build nodes defining a plugin for each of these source trees. + """ + return [env.LoadableModule( '#$PLUGDIR/%s' % getDirname(tree) + , srcSubtree(env, tree) + , SHLIBPREFIX='', SHLIBSUFFIX='.lum' + ) + for tree in findSrcTrees(dir) + ] + + + def checkCommandOption(env, optID, val=None, cmdName=None): """ evaluate and verify an option, which may point at a command. besides specifying a path, the option may read True, yes or 1, diff --git a/icons/svg/app-icon.svg b/icons/svg/app-icon.svg new file mode 100644 index 000000000..1df75c265 --- /dev/null +++ b/icons/svg/app-icon.svg @@ -0,0 +1,903 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/icons/svg/tool-arrow.svg b/icons/svg/tool-arrow.svg index 3f0b72102..84807f4fb 100644 --- a/icons/svg/tool-arrow.svg +++ b/icons/svg/tool-arrow.svg @@ -54,44 +54,6 @@ offset="1" id="stop8777" /> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + inkscape:window-x="1280" + inkscape:window-y="24"> + + + + + + + + + + + + + - - - - - - - - - diff --git a/src/gui/gtk-lumiera.cpp b/src/gui/gtk-lumiera.cpp index 4dbc6ec5e..102c424dd 100644 --- a/src/gui/gtk-lumiera.cpp +++ b/src/gui/gtk-lumiera.cpp @@ -29,13 +29,9 @@ using namespace Gtk; using namespace Glib; using namespace gui; + GtkLumiera the_application; -int -main (int argc, char *argv[]) -{ - return the_application.main(argc, argv); -} extern "C" void @@ -51,10 +47,9 @@ start_dummy_gui () namespace gui { -int +void GtkLumiera::main(int argc, char *argv[]) { - NOBUG_INIT; Main kit(argc, argv); @@ -62,9 +57,8 @@ GtkLumiera::main(int argc, char *argv[]) workspace::WorkspaceWindow main_window; - kit.run(main_window); + kit.run(main_window); - return 23; } @@ -215,7 +209,21 @@ Actions::on_menu_help_about() } // namespace workspace +/* ===== Constants ===== */ + +const gchar* GtkLumiera::AppTitle = "Lumiera"; } // namespace gui + +/** + * Run the Lumiera GTK GUI as standalone application without backend. + */ +int +main (int argc, char *argv[]) +{ + NOBUG_INIT; + gui::application().main(argc, argv); + return 0; +} diff --git a/src/gui/gtk-lumiera.hpp b/src/gui/gtk-lumiera.hpp index a55160530..c4efb6259 100644 --- a/src/gui/gtk-lumiera.hpp +++ b/src/gui/gtk-lumiera.hpp @@ -8,12 +8,13 @@ #define GTK_LUMIERA_HPP #include -#include +#include // need to include this after gtkmm.h, because types.h from GTK tries to shaddow the ERROR macro from windows, which kills NoBug's ERROR macro #include #include +#include #include - -#include +#include +#include extern "C" { #include @@ -45,12 +46,6 @@ NOBUG_DECLARE_FLAG(gui); */ namespace gui { -/* ===== Global Constants ===== */ - -/** - * The name of the application - */ -static const gchar* AppTitle = "Lumiera"; @@ -62,9 +57,15 @@ static const gchar* AppTitle = "Lumiera"; class GtkLumiera : private boost::noncopyable { public: - int main(int argc, char *argv[]); + void main(int argc, char *argv[]); +/* ===== Global Constants ===== */ +public: +/** + * The name of the application + */ +static const gchar* AppTitle; }; /** diff --git a/src/gui/lumiera_ui.rc b/src/gui/lumiera_ui.rc index dcce8df48..df1a55437 100644 --- a/src/gui/lumiera_ui.rc +++ b/src/gui/lumiera_ui.rc @@ -7,7 +7,7 @@ style "medium_text" { - font_name = "sans 10" + } style "medium_bold_entry" = "medium_text" @@ -67,7 +67,6 @@ style "default_base" = "medium_text" style "default_buttons_menus" { - font_name = "sans 10" fg[ACTIVE] = { 1.0, 1.0, 1.0 } bg[NORMAL] = { 0.30, 0.30, 0.35 } @@ -152,13 +151,14 @@ style "timeline_ruler" = "default_base" gtkmm__CustomObject_TimelineRuler::playback_period_arrow_stem_size = 3 } -style "timeline_header_container" = "default_base" +style "timeline_header_widget" = "default_base" { - gtkmm__CustomObject_HeaderContainer::heading_margin = 4 + gtkmm__CustomObject_TimelineHeaderWidget::margin = 4 + gtkmm__CustomObject_TimelineHeaderWidget::expand_button_size = 12 } class "gtkmm__CustomObject_TimelineBody" style:highest "timeline_body" class "gtkmm__CustomObject_TimelineRuler" style:highest "timeline_ruler" -class "gtkmm__CustomObject_TimelineHeaderContainer" style:highest "timeline_header_container" +class "gtkmm__CustomObject_TimelineHeaderWidget" style:highest "timeline_header_widget" diff --git a/src/include/nobugcfg.h b/src/include/nobugcfg.h index 5e1a33eb1..26532130a 100644 --- a/src/include/nobugcfg.h +++ b/src/include/nobugcfg.h @@ -49,6 +49,7 @@ NOBUG_DECLARE_FLAG (render); ///< logging channel focusing on the render engine's workings NOBUG_DECLARE_FLAG (config); ///< logging channel covering application and session configuration NOBUG_DECLARE_FLAG (memory); ///< logging channel covering memory management issues + NOBUG_DECLARE_FLAG (sync); ///< especially for tracing synchronisation NOBUG_DECLARE_FLAG (test); @@ -70,6 +71,7 @@ NOBUG_CPP_DEFINE_FLAG_PARENT (operate, lumiera); NOBUG_CPP_DEFINE_FLAG_PARENT_LIMIT (render, lumiera, LOG_WARNING); NOBUG_CPP_DEFINE_FLAG_PARENT_LIMIT (memory, lumiera, LOG_WARNING); + NOBUG_CPP_DEFINE_FLAG_PARENT_LIMIT (sync, memory, LOG_WARNING); NOBUG_CPP_DEFINE_FLAG_PARENT_LIMIT (test, all, LOG_ERR); diff --git a/src/include/symbol.hpp b/src/include/symbol.hpp new file mode 100644 index 000000000..5de94a2cd --- /dev/null +++ b/src/include/symbol.hpp @@ -0,0 +1,57 @@ +/* + SYMBOL.hpp - symbolic constant datatype + + Copyright (C) Lumiera.org + 2008, Hermann Vosseler + + 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. + +*/ + +/** @file symbol.hpp + ** WIP placeholder definition for a planned Symbol datatype. + ** + ** @todo for the (currently just planned as of 11/08) rules based configuration + ** in the Proc-Layer a explicit Symbol datatype will probably very helpful. + ** For now we just a typedef is sufficient. A real Symbol datatype should + ** - be definable by string constant + ** - integrate smoothly with std::string + ** - provide a unique numeric index for each distinct Symbol + ** - automatically maintain a symbol table at runtime to support this + ** - provide some magic (macros) allowing to build distinct types based on symbols. + ** + ** @see configrules.hpp + ** @see query.hpp + */ + + +#ifndef LUMIERA_SYMBOL_H +#define LUMIERA_SYMBOL_H + + +#include + + +namespace lumiera { + + typedef const char * const Symbol; ///< Token or Atom with distinct identity @todo define a real Symbol class, i.e. same literal string==same pointer, + + typedef const std::string Literal; ///< inline string literal @todo improve interaction with Symbol + + + +} // namespace lumiera + +#endif diff --git a/src/common/nobugcfg.cpp b/src/lib/nobugcfg.cpp similarity index 100% rename from src/common/nobugcfg.cpp rename to src/lib/nobugcfg.cpp diff --git a/src/proc/common.hpp b/src/proc/common.hpp index 8c9c7fe78..20112cadb 100644 --- a/src/proc/common.hpp +++ b/src/proc/common.hpp @@ -43,6 +43,7 @@ #include "include/nobugcfg.h" #include "common/dummy-func.hpp" +#include "include/symbol.hpp" /** diff --git a/src/tool/SConscript b/src/tool/SConscript index 41a1593d1..0ca19490d 100644 --- a/src/tool/SConscript +++ b/src/tool/SConscript @@ -3,11 +3,24 @@ ## SConscript - SCons buildscript for tool subdirectory (called by SConstruct) ## -Import('env','artifacts','core') +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') -# build the ubiquitous Hello World application (note: C source) -artifacts['tools'] = [ env.Program('#$BINDIR/hello-world','hello.c') +# build additional test and administrative tools.... +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 ] +# Rendering the SVG Icons depends on rsvg-convert +env.Depends(artifacts['icons'], rsvg) + diff --git a/src/tool/hello.c b/src/tool/hello.c index d75f55f94..befad1f21 100644 --- a/src/tool/hello.c +++ b/src/tool/hello.c @@ -7,6 +7,8 @@ int main(int argc, char* argv[]) { - printf("hello lumiera world"); + (void)argc; + (void)argv; + printf("hello lumiera world\n"); return 0; } diff --git a/admin/rsvg-convert.c b/src/tool/rsvg-convert.c similarity index 100% rename from admin/rsvg-convert.c rename to src/tool/rsvg-convert.c diff --git a/admin/vgsuppression.c b/src/tool/vgsuppression.c similarity index 100% rename from admin/vgsuppression.c rename to src/tool/vgsuppression.c diff --git a/tests/SConscript b/tests/SConscript index 4f208f0ea..e914ca001 100644 --- a/tests/SConscript +++ b/tests/SConscript @@ -8,12 +8,15 @@ from os import path from Buildhelper import srcSubtree from Buildhelper import scanSubtree from Buildhelper import globRootdirs +from Buildhelper import createPlugins -Import('env','artifacts','core') +Import('env','envPlu','artifacts','core') # temp fix to add test.h -- wouldn't it be better to put this header be into src/lib ? env = env.Clone() env.Append(CPPPATH='#/.') # add Rootdir to Includepath, so test/test.h is found +envPlu = envPlu.Clone() +envPlu.Append(CPPPATH='#/.') # temp fix------------- def testExecutable(env,tree, exeName=None, obj=None): @@ -43,41 +46,18 @@ def testCollection(env,dir): return [buildIt(f) for f in scanSubtree(dir,srcpatt)] -def treatPluginTestcase(env): - """ Special case: the test-plugin executable - """ - tree = 'plugin' - env = env.Clone() - env.Append(CPPPATH=tree, CPPDEFINES='LUMIERA_PLUGIN') - prfx = path.join(tree,'example_plugin') - oC = env.SharedObject(prfx, prfx+'.c') - oCPP = env.SharedObject(prfx+'_cpp', prfx+'.cpp') - testplugin = ( env.LoadableModule('#$LIBDIR/examplepluginc', oC, SHLIBPREFIX='') -# + env.SharedLibrary('#$LIBDIR/exampleplugincpp', oCPP, SHLIBPREFIX='') -# doesn't compile yet... - ) - - return testplugin - #-- it depends (at the moment) on a specific isolated test-plugin, - # which is not integrated in the "normal procedure" for building Plugins - # (which is not yet implemented as of 8/07) - # TODO: handle this case automatically -# -# build a Test-Executable out of every subdir... -moduledirs = globRootdirs('*') # but have to treat some subdirs individually. -specials = ['plugin','library','backend','lumiera'] +specials = ['plugin','lib','components'] +moduledirs = globRootdirs('*') -artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in moduledirs if not dir in specials] -# + treatPluginTestcase(env) -# + testCollection(env, 'library') -# + testCollection(env, 'backend') -# + testCollection(env, 'lumiera') +artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in ['lib','components'] ] + + [ testCollection(env, dir) for dir in moduledirs if not dir in specials] + + createPlugins(envPlu, 'plugin') ) @@ -94,9 +74,14 @@ artifacts['testsuite'] = ts = ( [ testExecutable(env, dir) for dir in moduledirs # is explicitly propagated to test.sh # testEnv = env.Clone() -if not env['VALGRIND']: - testEnv.Append(ENV = { 'VALGRINDFLAGS' : 'DISABLE' - , 'LUMIERA_CONFIG_PATH' : './' }) + +valgrind = os.environ.get('VALGRINDFLAGS', '') # unset if not defined +if not valgrind and not env['VALGRIND']: + valgrind = 'DISABLE' + +testEnv.Append(ENV = { 'VALGRINDFLAGS' : valgrind + , 'LUMIERA_CONFIG_PATH' : './' + }) testsuites = env['TESTSUITES'] or os.environ.get('TESTSUITES') if testsuites: diff --git a/tests/plugin/examplepluginc/example_plugin.c b/tests/plugin/examplepluginc/example_plugin.c new file mode 100644 index 000000000..60992745d --- /dev/null +++ b/tests/plugin/examplepluginc/example_plugin.c @@ -0,0 +1,196 @@ +/* + example_plugin - example plugin for testing the interface/plugin system + + Copyright (C) Lumiera.org + 2008, Christian Thaeter + + 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. + +* *****************************************************/ + + +#include + +#include "common/interfacedescriptor.h" +#include "common/config_interface.h" + +#include "tests/common/hello_interface.h" + + +LUMIERA_PLUGIN_INTERFACEHANDLE; + +LumieraInterface +myopen (LumieraInterface self, LumieraInterface interfaces) +{ + LUMIERA_PLUGIN_STORE_INTERFACEHANDLE (interfaces); + + fprintf (stderr, "opened %p global interfaces %p\n", self, interfaces); + return self; +} + +void +myclose (LumieraInterface self) +{ + fprintf (stderr, "closed %p\n", self); +} + +void hallo (void) +{ + printf ("Hallo Welt!\n"); +} + +void tschuess (const char* m) +{ + printf ("Tschuess %s\n", m); +} + +void hello (void) +{ + printf ("Hello World!\n"); +} + +void bye (const char* m) +{ + printf ("Bye %s\n", m); +} + + +void yeahbabe (void) +{ + LUMIERA_INTERFACE_HANDLE (lumieraorg_testhello, 0) german = + LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_german); + + LUMIERA_INTERFACE_HANDLE (lumieraorg_testhello, 0) english = + LUMIERA_INTERFACE_OPEN (lumieraorg_testhello, 0, 0, lumieraorg_hello_english); + + LUMIERA_INTERFACE_HANDLE (lumieraorg_configuration, 0) config = + LUMIERA_INTERFACE_OPEN (lumieraorg_configuration, 0, 0, lumieraorg_configuration); + + const char* path; + if (config->wordlist_get ("config.path", &path)) + printf ("config path is: %s\n", path); + if (config->wordlist_get ("plugin.path", &path)) + printf ("plugin path is: %s\n", path); + + LUMIERA_INTERFACE_CLOSE (config); + + german->hello (); + english->hello (); + english->goodbye ("World!"); + german->goodbye ("Welt!"); + + LUMIERA_INTERFACE_CLOSE (german); + LUMIERA_INTERFACE_CLOSE (english); +} + + + +LUMIERA_INTERFACE_INSTANCE (lumieraorg_interfacedescriptor, 0, + lumieraorg_exampleplugin_descriptor, + NULL, NULL, NULL, + LUMIERA_INTERFACE_INLINE (name, "\003\307\005\305\201\304\175\377\120\105\332\016\136\354\251\022", + const char*, (LumieraInterface iface), + {return "LumieraTest";} + ), + LUMIERA_INTERFACE_INLINE (brief, "\303\047\265\010\242\210\365\340\024\030\350\310\067\171\170\260", + const char*, (LumieraInterface iface), + {return "Lumiera Test suite examples";} + ), + LUMIERA_INTERFACE_INLINE (homepage, "\363\125\352\312\056\255\274\322\351\245\051\350\120\024\115\263", + const char*, (LumieraInterface iface), + {return "http://www.lumiera.org/develompent.html";} + ), + LUMIERA_INTERFACE_INLINE (version, "\114\043\133\175\354\011\232\002\117\240\107\141\234\157\217\176", + const char*, (LumieraInterface iface), + {return "No Version";} + ), + LUMIERA_INTERFACE_INLINE (author, "\313\300\055\156\126\320\144\247\140\023\261\002\270\367\017\267", + const char*, (LumieraInterface iface), + {return "Christian Thaeter";} + ), + LUMIERA_INTERFACE_INLINE (email, "\163\051\312\276\137\317\267\305\237\274\133\012\276\006\255\160", + const char*, (LumieraInterface iface), + {return "ct@pipapo.org";} + ), + LUMIERA_INTERFACE_INLINE (copyright, "\160\246\161\204\123\262\375\351\157\276\333\073\355\036\062\341", + const char*, (LumieraInterface iface), + { + return + "Copyright (C) Lumiera.org\n" + " 2008 Christian Thaeter "; + } + ), + LUMIERA_INTERFACE_INLINE (license, "\007\311\044\214\064\223\201\326\331\111\233\356\055\264\211\201", + const char*, (LumieraInterface iface), + { + return + "This program is free software; you can redistribute it and/or modify\n" + "it under the terms of the GNU General Public License as published by\n" + "the Free Software Foundation; either version 2 of the License, or\n" + "(at your option) any later version.\n" + "\n" + "This program is distributed in the hope that it will be useful,\n" + "but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + "GNU General Public License for more details.\n" + "\n" + "You should have received a copy of the GNU General Public License\n" + "along with this program; if not, write to the Free Software\n" + "Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA"; + } + ), + + LUMIERA_INTERFACE_INLINE (state, "\331\353\126\162\067\376\340\242\232\175\167\105\122\177\306\354", + int, (LumieraInterface iface), + {return LUMIERA_INTERFACE_EXPERIMENTAL;} + ), + + LUMIERA_INTERFACE_INLINE (versioncmp, "\363\145\363\224\325\104\177\057\344\023\367\111\376\221\152\135", + int, (const char* a, const char* b), + {return 0;} + ) + ); + + +LUMIERA_EXPORT( + LUMIERA_INTERFACE_DEFINE (lumieraorg_testhello, 0, + lumieraorg_hello_german, + LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor), + myopen, + myclose, + LUMIERA_INTERFACE_MAP (hello, "\167\012\306\023\031\151\006\362\026\003\125\017\170\022\100\333", + hallo), + LUMIERA_INTERFACE_MAP (goodbye, "\324\267\214\166\340\213\155\053\157\125\064\264\167\235\020\223", + tschuess) + ), + LUMIERA_INTERFACE_DEFINE (lumieraorg_testhello, 0, + lumieraorg_hello_english, + LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor), + myopen, + myclose, + LUMIERA_INTERFACE_MAP (hello, "\326\247\370\247\032\103\223\357\262\007\356\042\051\330\073\116", + hello), + LUMIERA_INTERFACE_MAP (goodbye, "\365\141\371\047\101\230\050\106\071\231\022\235\325\112\354\241", + bye) + ), + LUMIERA_INTERFACE_DEFINE (lumieraorg_testtest, 0, + lumieraorg_test_both, + LUMIERA_INTERFACE_REF (lumieraorg_interfacedescriptor, 0, lumieraorg_exampleplugin_descriptor), + myopen, + myclose, + LUMIERA_INTERFACE_MAP (testit, "\101\060\122\277\370\023\164\257\347\247\164\325\157\266\323\370", + yeahbabe) + ) + ) diff --git a/tests/plugin/test-cpp-plugin/example_plugin.cpp b/tests/plugin/test-cpp-plugin/example_plugin.cpp new file mode 100644 index 000000000..b99d951d3 --- /dev/null +++ b/tests/plugin/test-cpp-plugin/example_plugin.cpp @@ -0,0 +1,129 @@ +/* + example_plugin.cpp - example plugin (C++) for testing the interface/plugin system + + Copyright (C) Lumiera.org + 2008, Christian Thaeter , + Hermann Vosseler + + 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. + +* *****************************************************/ + + +#include +#include + +#include "common/interfacedescriptor.h" +#include "common/config_interface.h" + +extern "C" { +#include "common/interface.h" +#include "common/interfacedescriptor.h" + +#include "tests/common/hello_interface.h" +} + +using boost::format; +using std::cout; +using std::endl; + + + +class example_plugin + { + public: + static LumieraInterface + myopen (LumieraInterface self, LumieraInterface interfaces) + { + static format fmt("opened %x global interfaces %x"); + cout << fmt % self % interfaces << endl; + return self; + } + + static void + myclose (LumieraInterface) + { + std::cout << "closed" << endl; + } + }; + + +class example_plugin_de + : public example_plugin + { + public: + static void + griazi () + { + std::cout << "Hallo Welt!" << endl; + } + + static void + servus (const char* m) + { + std::cout << "Tschuess " << m << endl; + } + }; + + +class example_plugin_en + : public example_plugin + { + public: + static void + hello () + { + std::cout << "Hello World!" << endl; + } + + static void + bye (const char* m) + { + std::cout << "Bye " << m << endl; + } + }; + + + + +extern "C" { /* ================== define two lumieraorg_testhello instance ======================= */ + + + + LUMIERA_EXPORT( /* ===================== PLUGIN EXPORTS ================================== */ + + LUMIERA_INTERFACE_DEFINE (lumieraorg_testhello, 0 + ,lumieraorg_hello_german_cpp + , NULL /* no descriptor given */ + , example_plugin::myopen + , example_plugin::myclose + , LUMIERA_INTERFACE_MAP (hello, "\300\244\125\265\235\312\175\263\335\044\371\047\247\263\015\322", + example_plugin_de::griazi) + , LUMIERA_INTERFACE_MAP (goodbye, "\115\365\126\102\201\104\012\257\153\232\006\210\010\346\076\070", + example_plugin_de::servus) + ), + LUMIERA_INTERFACE_DEFINE (lumieraorg_testhello, 0 + ,lumieraorg_hello_english_cpp + , NULL /* no descriptor given */ + , example_plugin::myopen + , example_plugin::myclose + , LUMIERA_INTERFACE_MAP (hello, "\303\367\107\154\077\063\237\066\034\034\050\136\170\220\260\226", + example_plugin_en::hello) + , LUMIERA_INTERFACE_MAP (goodbye, "\107\207\072\105\101\102\150\201\322\043\104\110\232\023\205\161", + example_plugin_en::bye) + ) + ); + +} // extern "C"