summaryrefslogtreecommitdiff
path: root/src/bootstrap
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2007-09-29 01:01:55 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2007-09-29 01:01:55 +0000
commit6b1aeb6465f339bfbc7be33b1ecab3f235adbe7f (patch)
tree720ad0f18306af6b11b9b1c0dbd622bf57792af6 /src/bootstrap
parent83bc8f09261fb4d265cc79d39e740b4a0c9648e2 (diff)
downloadlibdom-6b1aeb6465f339bfbc7be33b1ecab3f235adbe7f.tar.gz
libdom-6b1aeb6465f339bfbc7be33b1ecab3f235adbe7f.tar.bz2
Introduce global initialistaion/finalisation for DOM library. This should be used to initialise any parts of the library before they are used. Mostly, this will comprise of static initialisers. Finalisation cleans up afterwards. This API is only exposed to language-specific binding libraries -- they should expose their own global initialisation/finalisation routines which call the core libdom ones.
Introduce new utility code for namespace and qname processing. Port dom_document_create_element_ns() and dom_document_create_attribute_ns() to this new code. Make libdom-libxml's initialiser initialise libdom itself first of all. svn path=/trunk/dom/; revision=3604
Diffstat (limited to 'src/bootstrap')
-rw-r--r--src/bootstrap/Makefile2
-rw-r--r--src/bootstrap/init_fini.c47
2 files changed, 48 insertions, 1 deletions
diff --git a/src/bootstrap/Makefile b/src/bootstrap/Makefile
index 6c904cc..0eed6c7 100644
--- a/src/bootstrap/Makefile
+++ b/src/bootstrap/Makefile
@@ -22,7 +22,7 @@
CFLAGS += -I$(CURDIR)
# Objects
-OBJS = implregistry
+OBJS = implregistry init_fini
.PHONY: clean debug distclean export release setup test
diff --git a/src/bootstrap/init_fini.c b/src/bootstrap/init_fini.c
new file mode 100644
index 0000000..001eaf9
--- /dev/null
+++ b/src/bootstrap/init_fini.c
@@ -0,0 +1,47 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb@netsurf-browser.org>
+ */
+
+#include <dom/bootstrap/implpriv.h>
+
+#include "utils/namespace.h"
+
+/**
+ * Initialise the dom library
+ *
+ * \param alloc Pointer to memory (de)allocation function
+ * \param pw Pointer to client-specific private data
+ * \return DOM_NO_ERR on success.
+ *
+ * This should be invoked by the binding's initialiser and must be
+ * the first DOM library method called.
+ */
+dom_exception dom_initialise(dom_alloc alloc, void *pw)
+{
+ dom_exception err;
+
+ err = _dom_namespace_initialise(alloc, pw);
+
+ return err;
+}
+
+/**
+ * Finalise the dom library
+ *
+ * \return DOM_NO_ERR on success.
+ *
+ * This should be invoked by the binding's finaliser and must be
+ * the last DOM library method called.
+ */
+dom_exception dom_finalise(void)
+{
+ dom_exception err;
+
+ err = _dom_namespace_finalise();
+
+ return err;
+}
+