refine the initialization order

* introduce a lumiera_preinit() which does some dirty startup work
 * lumiera_init() and lumiera_shutdown() will do the desired
   DesignProcess/GlobalInitilaization
 * as example, initialize the config interface there
This commit is contained in:
Christian Thaeter 2008-11-07 08:50:18 +01:00
parent d91c4ee326
commit 6169ccaf08
4 changed files with 39 additions and 8 deletions

View file

@ -33,16 +33,12 @@
* Declares the interface for the lumiera configuration system
*/
#ifndef LUMIERA_PLUGIN
void
lumiera_config_interface_init (void);
void
lumiera_config_interface_destroy (void);
#endif
/*
Note that some interfaces return ints rather than underlying opaque pointers, this is then the truth value of the pointer
*/

View file

@ -52,7 +52,7 @@ main (int argc, char** argv)
{
(void) argc;
(void) argv;
lumiera_init ();
lumiera_preinit ();
TODO ("commandline parser");
lumiera_config_init (LUMIERA_CONFIG_PATH);
@ -61,14 +61,15 @@ main (int argc, char** argv)
TODO ("plugindb support instead loading all plugins at once");
lumiera_plugin_discover (lumiera_plugin_load, lumiera_plugin_register);
lumiera_init ();
TRACE (lumiera, "Lumiera is alive");
TODO ("video editing");
TRACE (lumiera, "initiating shutdown sequence");
lumiera_shutdown ();
lumiera_interfaceregistry_destroy ();
lumiera_config_destroy ();
lumiera_shutdown ();
}

View file

@ -45,6 +45,9 @@ NOBUG_DECLARE_FLAG (lumiera);
*/
//TODO: declarations go here//
void
lumiera_preinit (void);
void
lumiera_init (void);

View file

@ -24,6 +24,7 @@
//TODO: Lumiera header includes//
#include "lumiera/lumiera.h"
#include "lumiera/config_interface.h"
//TODO: internal/static forward declarations//
@ -42,25 +43,55 @@ NOBUG_DEFINE_FLAG_PARENT (lumiera, lumiera_all);
//code goes here//
/**
* Early initialization
* Sets up some important basic stuff, this is run as *very* first before anything
* else got initialized. Used for NoBug and other kinds of hooks. There is no matching
* shutdown function for this, consider moving as much as possible to lumiera_init()
*/
void
lumiera_init (void)
lumiera_preinit (void)
{
NOBUG_INIT;
NOBUG_INIT_FLAG (all);
NOBUG_INIT_FLAG (lumiera_all);
NOBUG_INIT_FLAG (lumiera);
TRACE (lumiera, "initializing");
TRACE (lumiera, "booting up");
}
/**
* Standard initialization procedure
* Boots all buildin subsystems up as described in DesignProcess/GlobalInitilaization.
* The configuration and interfaces/plugin subsystems are already started at this point and
* commandline arguments are parsed.
*/
void
lumiera_init (void)
{
TRACE (lumiera, "initializing");
lumiera_config_interface_init ();
}
/**
* Shutdown procedure
* This shuts all subsystem which got initialized in lumiera_init down.
* Shutdowns should be arranged in reverse initialization order.
*/
void
lumiera_shutdown (void)
{
TRACE (lumiera, "shutdown");
lumiera_config_interface_destroy ();
}
/*
// Local Variables:
// mode: C