summaryrefslogtreecommitdiff
path: root/plugins/kaitai/rost/space.c
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-10-09 23:49:08 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-10-09 23:49:08 (GMT)
commit2e144129d6884f4f9ec5d3f599ec2820613ed419 (patch)
tree76e2b122a5a3391dfb948c50048113c1eda9c2d7 /plugins/kaitai/rost/space.c
parent7c6fe94c90d320813d0d78a9dbef707696f31505 (diff)
Load Kaitai definitions from $KSPATH when needed.
Diffstat (limited to 'plugins/kaitai/rost/space.c')
-rw-r--r--plugins/kaitai/rost/space.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/plugins/kaitai/rost/space.c b/plugins/kaitai/rost/space.c
index ed24562..ee922d2 100644
--- a/plugins/kaitai/rost/space.c
+++ b/plugins/kaitai/rost/space.c
@@ -27,7 +27,9 @@
#include <string.h>
+#include "trigger.h"
#include "space-int.h"
+#include "../import.h"
@@ -226,14 +228,26 @@ static bool g_kaitai_namespace_resolve(GKaitaiNamespace *item, const char *targe
{
bool result; /* Bilan à retourner */
GScanRegisteredItemClass *parent; /* Version de classe parente */
+ GKaitaiStruct *kstruct; /* Lecteur de définition */
parent = G_SCAN_REGISTERED_ITEM_CLASS(g_kaitai_namespace_parent_class);
result = parent->resolve(G_SCAN_REGISTERED_ITEM(item), target, ctx, scope, out);
-
if (!result)
- printf("NEED external def!!!!\n");
+ {
+ kstruct = load_kaitai_definition(target, NULL);
+
+ if (kstruct != NULL)
+ {
+ *out = g_kaitai_trigger_new(kstruct);
+ result = true;
+
+ g_object_unref(G_OBJECT(kstruct));
+
+ }
+
+ }
return result;