summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2012-03-03 21:42:30 +0000
committerDavid Robillard <d@drobilla.net>2012-03-03 21:42:30 +0000
commit8be9efb931773da4afc90ddaa1776387a9cea630 (patch)
tree9f56e22aa5de381dea400d24ee0848dd4e801b25
parent3d1d265a9e32c96cf2a959de6a569afd8b79ec81 (diff)
downloadsord-8be9efb931773da4afc90ddaa1776387a9cea630.tar.gz
sord-8be9efb931773da4afc90ddaa1776387a9cea630.tar.bz2
sord-8be9efb931773da4afc90ddaa1776387a9cea630.zip
Add sord_iter_get_node().
git-svn-id: http://svn.drobilla.net/sord/trunk@201 3d64ff67-21c5-427c-a301-fe4f08042e5a
-rw-r--r--ChangeLog1
-rw-r--r--sord/sord.h7
-rw-r--r--src/sord.c6
-rw-r--r--src/sord_test.c10
-rw-r--r--wscript2
5 files changed, 21 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 69dd838..68fb5f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,7 @@ sord (UNRELEASED) unstable; urgency=low
* Fix comparison of typed literals
* Take advantage of interning in sord_node_equals()
* Support compilation as C++ under MSVC++.
+ * Add sord_iter_get_node()
-- David Robillard <d@drobilla.net> (UNRELEASED)
diff --git a/sord/sord.h b/sord/sord.h
index e6f5bd8..7d3412e 100644
--- a/sord/sord.h
+++ b/sord/sord.h
@@ -393,6 +393,13 @@ void
sord_iter_get(const SordIter* iter, SordQuad quad);
/**
+ Return a field of the quad pointed to by @c iter.
+*/
+SORD_API
+const SordNode*
+sord_iter_get_node(const SordIter* iter, SordQuadIndex index);
+
+/**
Return the store pointed to by @c iter.
*/
SORD_API
diff --git a/src/sord.c b/src/sord.c
index 249fb0d..eac5087 100644
--- a/src/sord.c
+++ b/src/sord.c
@@ -421,6 +421,12 @@ sord_iter_get(const SordIter* iter, SordQuad id)
}
}
+const SordNode*
+sord_iter_get_node(const SordIter* iter, SordQuadIndex index)
+{
+ return ((SordNode**)zix_tree_get(iter->cur))[index];
+}
+
bool
sord_iter_next(SordIter* iter)
{
diff --git a/src/sord_test.c b/src/sord_test.c
index 279c147..15d4ad6 100644
--- a/src/sord_test.c
+++ b/src/sord_test.c
@@ -25,7 +25,6 @@ static const int DIGITS = 3;
static const int MAX_NUM = 999;
static const int n_objects_per = 2;
-
typedef struct {
SordQuad query;
int expected_num_results;
@@ -299,9 +298,12 @@ test_read(SordWorld* world, SordModel* sord, SordNode* g,
if (id[0] == last_subject)
continue;
- SordQuad subpat = { id[0], 0, 0 };
- SordIter* subiter = sord_find(sord, subpat);
- int num_sub_results = 0;
+ SordQuad subpat = { id[0], 0, 0 };
+ SordIter* subiter = sord_find(sord, subpat);
+ int num_sub_results = 0;
+ if (sord_iter_get_node(subiter, SORD_SUBJECT) != id[0]) {
+ return test_fail("Fail: Incorrect initial submatch\n");
+ }
for (; !sord_iter_end(subiter); sord_iter_next(subiter)) {
SordQuad subid;
sord_iter_get(subiter, subid);
diff --git a/wscript b/wscript
index 8e6e624..7ee89ba 100644
--- a/wscript
+++ b/wscript
@@ -8,7 +8,7 @@ from waflib.extras import autowaf as autowaf
import waflib.Logs as Logs, waflib.Options as Options
# Version of this package (even if built as a child)
-SORD_VERSION = '0.5.0'
+SORD_VERSION = '0.6.0'
SORD_MAJOR_VERSION = '0'
# Library version (UNIX style major, minor, micro)