plugin.c 804 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #include <stdlib.h>
  2. #include <errno.h>
  3. #include <string.h>
  4. #include <assert.h>
  5. #include <faux/faux.h>
  6. #include <faux/str.h>
  7. #include <faux/error.h>
  8. #include <klish/kxml.h>
  9. #include <klish/kscheme.h>
  10. #include <klish/kdb.h>
  11. bool_t kxml_plugin_init(kdb_t *db)
  12. {
  13. db = db; // Happy compiler
  14. return kxml_doc_start();
  15. }
  16. bool_t kxml_plugin_fini(kdb_t *db)
  17. {
  18. db = db; // Happy compiler
  19. return kxml_doc_stop();
  20. }
  21. bool_t kxml_plugin_load_scheme(kdb_t *db, kscheme_t *scheme)
  22. {
  23. faux_ini_t *ini = NULL;
  24. faux_error_t *error = NULL;
  25. const char *xml_path = NULL;
  26. assert(db);
  27. if (!db)
  28. return BOOL_FALSE;
  29. // Get configuration info from kdb object
  30. ini = kdb_ini(db);
  31. if (ini)
  32. xml_path = faux_ini_find(ini, "XMLPath");
  33. error = kdb_error(db);
  34. return kxml_load_scheme(scheme, xml_path, error);
  35. }