~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/module/loader.cc

  • Committer: Monty Taylor
  • Date: 2010-10-28 16:52:12 UTC
  • mto: (1890.1.2 build)
  • mto: This revision was merged to the branch mainline in revision 1891.
  • Revision ID: mordred@inaugust.com-20101028165212-z8uk8omdh4lp0992
Finalized the static/load_by_default split, supporting now an array of
available builtins and a list of builtins to load. Whee.

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
/** These exist just to prevent symbols from being optimized out */
60
60
typedef drizzled::module::Manifest drizzled_builtin_list[];
61
61
extern drizzled_builtin_list PANDORA_BUILTIN_SYMBOLS_LIST;
 
62
extern drizzled_builtin_list PANDORA_BUILTIN_LOAD_SYMBOLS_LIST;
62
63
drizzled::module::Manifest *drizzled_builtins[]=
63
64
{
64
65
  PANDORA_BUILTIN_SYMBOLS_LIST, NULL
65
66
};
 
67
drizzled::module::Manifest *drizzled_load_builtins[]=
 
68
{
 
69
  PANDORA_BUILTIN_LOAD_SYMBOLS_LIST, NULL
 
70
};
66
71
 
67
72
namespace drizzled
68
73
{
76
81
static PluginOptions opt_plugin_add;
77
82
static PluginOptions opt_plugin_remove;
78
83
const char *builtin_plugins= PANDORA_BUILTIN_LIST;
 
84
const char *builtin_load_plugins= PANDORA_BUILTIN_LOAD_LIST;
79
85
 
80
86
/* Note that 'int version' must be the first field of every plugin
81
87
   sub-structure (plugin->info).
392
398
 
393
399
  initialized= 1;
394
400
 
 
401
  PluginOptions builtin_load_list;
 
402
  tokenize(builtin_load_plugins, builtin_load_list, ",", true);
 
403
 
395
404
  PluginOptions builtin_list;
396
405
  tokenize(builtin_plugins, builtin_list, ",", true);
397
406
 
399
408
 
400
409
  if (opt_plugin_add.size() > 0)
401
410
  {
402
 
    opt_plugin_load.insert(opt_plugin_load.end(),
403
 
                           opt_plugin_add.begin(),
404
 
                           opt_plugin_add.end());
 
411
    for (PluginOptions::iterator iter= opt_plugin_add.begin();
 
412
         iter != opt_plugin_add.end();
 
413
         ++iter)
 
414
    {
 
415
      if (find(builtin_list.begin(),
 
416
               builtin_list.end(), *iter) != builtin_list.end())
 
417
      {
 
418
        builtin_load_list.push_back(*iter);
 
419
      }
 
420
      else
 
421
      {
 
422
        opt_plugin_load.push_back(*iter);
 
423
      }
 
424
    }
405
425
  }
406
426
 
407
427
  if (opt_plugin_remove.size() > 0)
408
428
  {
409
429
    plugin_prune_list(opt_plugin_load, opt_plugin_remove);
410
 
    plugin_prune_list(builtin_list, opt_plugin_remove);
 
430
    plugin_prune_list(builtin_load_list, opt_plugin_remove);
411
431
  }
412
432
 
413
433
 
414
434
  /*
415
435
    First we register builtin plugins
416
436
  */
417
 
  const set<string> builtin_list_set(builtin_list.begin(), builtin_list.end());
 
437
  const set<string> builtin_list_set(builtin_load_list.begin(),
 
438
                                     builtin_load_list.end());
418
439
  load_failed= plugin_load_list(registry, &tmp_root,
419
440
                                builtin_list_set, long_options, true);
420
441
  if (load_failed)