1 /* GSequencer - Advanced GTK Sequencer
2 * Copyright (C) 2005-2021 Joël Krähemann
3 *
4 * This file is part of GSequencer.
5 *
6 * GSequencer is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * GSequencer is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GSequencer. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include <ags/plugin/ags_lv2_turtle_parser.h>
21
22 #include <ags/plugin/ags_lv2_manager.h>
23 #include <ags/plugin/ags_lv2ui_manager.h>
24 #include <ags/plugin/ags_lv2_preset_manager.h>
25 #include <ags/plugin/ags_lv2_plugin.h>
26 #include <ags/plugin/ags_lv2ui_plugin.h>
27 #include <ags/plugin/ags_lv2_preset.h>
28 #include <ags/plugin/ags_plugin_port.h>
29
30 #include <string.h>
31
32 #include <ags/i18n.h>
33
34 void ags_lv2_turtle_parser_class_init(AgsLv2TurtleParserClass *lv2_turtle_parser);
35 void ags_lv2_turtle_parser_init (AgsLv2TurtleParser *lv2_turtle_parser);
36 void ags_lv2_turtle_parser_set_property(GObject *gobject,
37 guint prop_id,
38 const GValue *value,
39 GParamSpec *param_spec);
40 void ags_lv2_turtle_parser_get_property(GObject *gobject,
41 guint prop_id,
42 GValue *value,
43 GParamSpec *param_spec);
44 void ags_lv2_turtle_parser_dispose(GObject *gobject);
45 void ags_lv2_turtle_parser_finalize(GObject *gobject);
46
47 void ags_lv2_turtle_parser_parse_names_statement(AgsLv2TurtleParser *lv2_turtle_parser,
48 AgsTurtle *current_turtle,
49 xmlNode *node,
50 AgsTurtle **turtle, guint n_turtle,
51 gboolean see_also);
52 void ags_lv2_turtle_parser_parse_names_triple(AgsLv2TurtleParser *lv2_turtle_parser,
53 AgsTurtle *current_turtle,
54 xmlNode *node,
55 AgsTurtle **turtle, guint n_turtle,
56 gboolean see_also);
57 void ags_lv2_turtle_parser_parse_names_predicate_object_list(AgsLv2TurtleParser *lv2_turtle_parser,
58 AgsTurtle *current_turtle,
59 gchar *subject_iriref,
60 xmlNode *node,
61 AgsTurtle **turtle, guint n_turtle);
62 void ags_lv2_turtle_parser_parse_names_predicate_object_list_see_also(AgsLv2TurtleParser *lv2_turtle_parser,
63 AgsTurtle *current_turtle,
64 gchar *subject_iriref,
65 xmlNode *node,
66 AgsTurtle **turtle, guint n_turtle);
67 void ags_lv2_turtle_parser_parse_names_blank_node_property_list(AgsLv2TurtleParser *lv2_turtle_parser,
68 AgsTurtle *current_turtle,
69 gchar *subject_iriref,
70 xmlNode *node,
71 AgsTurtle **turtle, guint n_turtle);
72
73 void ags_lv2_turtle_parser_parse_statement(AgsLv2TurtleParser *lv2_turtle_parser,
74 AgsTurtle *current_turtle,
75 xmlNode *node,
76 AgsTurtle **turtle, guint n_turtle,
77 gboolean see_also);
78 void ags_lv2_turtle_parser_parse_triple(AgsLv2TurtleParser *lv2_turtle_parser,
79 AgsTurtle *current_turtle,
80 xmlNode *node,
81 AgsTurtle **turtle, guint n_turtle,
82 gboolean see_also);
83 void ags_lv2_turtle_parser_parse_predicate_object_list(AgsLv2TurtleParser *lv2_turtle_parser,
84 AgsTurtle *current_turtle,
85 gchar *subject_iriref,
86 xmlNode *node,
87 AgsTurtle **turtle, guint n_turtle);
88 void ags_lv2_turtle_parser_parse_predicate_object_list_see_also(AgsLv2TurtleParser *lv2_turtle_parser,
89 AgsTurtle *current_turtle,
90 gchar *subject_iriref,
91 xmlNode *node,
92 AgsTurtle **turtle, guint n_turtle);
93 void ags_lv2_turtle_parser_parse_blank_node_property_list(AgsLv2TurtleParser *lv2_turtle_parser,
94 AgsTurtle *current_turtle,
95 gchar *subject_iriref,
96 xmlNode *node,
97 AgsTurtle **turtle, guint n_turtle);
98
99 /**
100 * SECTION:ags_lv2_turtle_parser
101 * @short_description: The lv2 turtle parser class
102 * @title: AgsLv2TurtleParser
103 * @section_id:
104 * @include: ags/plugin/ags_lv2_turtle_parser.h
105 *
106 * The #AgsLv2TurtleParser parses RDF Turtle files.
107 */
108
109 static gpointer ags_lv2_turtle_parser_parent_class = NULL;
110
111 enum{
112 PROP_0,
113 PROP_TURTLE,
114 PROP_PLUGIN,
115 PROP_UI_PLUGIN,
116 PROP_PRESET,
117 };
118
119 GType
ags_lv2_turtle_parser_get_type(void)120 ags_lv2_turtle_parser_get_type (void)
121 {
122 static volatile gsize g_define_type_id__volatile = 0;
123
124 if(g_once_init_enter (&g_define_type_id__volatile)){
125 GType ags_type_lv2_turtle_parser = 0;
126
127 static const GTypeInfo ags_lv2_turtle_parser_info = {
128 sizeof(AgsLv2TurtleParserClass),
129 NULL, /* base_init */
130 NULL, /* base_finalize */
131 (GClassInitFunc) ags_lv2_turtle_parser_class_init,
132 NULL, /* class_finalize */
133 NULL, /* class_data */
134 sizeof(AgsLv2TurtleParser),
135 0, /* n_preallocs */
136 (GInstanceInitFunc) ags_lv2_turtle_parser_init,
137 };
138
139 ags_type_lv2_turtle_parser = g_type_register_static(G_TYPE_OBJECT,
140 "AgsLv2TurtleParser",
141 &ags_lv2_turtle_parser_info,
142 0);
143
144 g_once_init_leave(&g_define_type_id__volatile, ags_type_lv2_turtle_parser);
145 }
146
147 return g_define_type_id__volatile;
148 }
149
150 void
ags_lv2_turtle_parser_class_init(AgsLv2TurtleParserClass * lv2_turtle_parser)151 ags_lv2_turtle_parser_class_init(AgsLv2TurtleParserClass *lv2_turtle_parser)
152 {
153 GObjectClass *gobject;
154
155 GParamSpec *param_spec;
156
157 ags_lv2_turtle_parser_parent_class = g_type_class_peek_parent(lv2_turtle_parser);
158
159 /* GObjectClass */
160 gobject = (GObjectClass *) lv2_turtle_parser;
161
162 gobject->set_property = ags_lv2_turtle_parser_set_property;
163 gobject->get_property = ags_lv2_turtle_parser_get_property;
164
165 gobject->dispose = ags_lv2_turtle_parser_dispose;
166 gobject->finalize = ags_lv2_turtle_parser_finalize;
167
168 /* properties */
169 /**
170 * AgsLv2TurtleParser:turtle: (type GList(AgsTurtle)) (transfer full)
171 *
172 * The assigned #GList-struct containing #AgsTurtle.
173 *
174 * Since: 3.0.0
175 */
176 param_spec = g_param_spec_pointer("turtle",
177 i18n_pspec("related turtles"),
178 i18n_pspec("The related turtles"),
179 G_PARAM_READABLE | G_PARAM_WRITABLE);
180 g_object_class_install_property(gobject,
181 PROP_TURTLE,
182 param_spec);
183
184 /**
185 * AgsLv2TurtleParser:plugin: (type GList(AgsLv2Plugin)) (transfer full)
186 *
187 * The assigned #GList-struct containing #AgsLv2Plugin.
188 *
189 * Since: 3.0.0
190 */
191 param_spec = g_param_spec_pointer("plugin",
192 i18n_pspec("lv2 plugins"),
193 i18n_pspec("The parsed lv2 plugins"),
194 G_PARAM_READABLE | G_PARAM_WRITABLE);
195 g_object_class_install_property(gobject,
196 PROP_PLUGIN,
197 param_spec);
198
199 /**
200 * AgsLv2TurtleParser:ui-pluin: (type GList(AgsLv2uiPlugin)) (transfer full)
201 *
202 * The assigned #GList-struct containing #AgsLv2uiPlugin.
203 *
204 * Since: 3.0.0
205 */
206 param_spec = g_param_spec_pointer("ui-plugin",
207 i18n_pspec("lv2 UI plugins"),
208 i18n_pspec("The parsed lv2 UI plugins"),
209 G_PARAM_READABLE | G_PARAM_WRITABLE);
210 g_object_class_install_property(gobject,
211 PROP_UI_PLUGIN,
212 param_spec);
213
214 /**
215 * AgsLv2TurtleParser:preset: (type GList(AgsLv2Preset)) (transfer full)
216 *
217 * The assigned #GList-struct containing #AgsLv2Preset.
218 *
219 * Since: 3.0.0
220 */
221 param_spec = g_param_spec_pointer("preset",
222 i18n_pspec("lv2 presets"),
223 i18n_pspec("The parsed lv2 presets"),
224 G_PARAM_READABLE | G_PARAM_WRITABLE);
225 g_object_class_install_property(gobject,
226 PROP_PRESET,
227 param_spec);
228 }
229
230 void
ags_lv2_turtle_parser_init(AgsLv2TurtleParser * lv2_turtle_parser)231 ags_lv2_turtle_parser_init(AgsLv2TurtleParser *lv2_turtle_parser)
232 {
233 lv2_turtle_parser->flags = 0;
234
235 /* add base plugin mutex */
236 g_rec_mutex_init(&(lv2_turtle_parser->obj_mutex));
237
238 /* */
239 lv2_turtle_parser->turtle = NULL;
240
241 lv2_turtle_parser->plugin = NULL;
242 lv2_turtle_parser->ui_plugin = NULL;
243 lv2_turtle_parser->preset = NULL;
244 }
245
246 void
ags_lv2_turtle_parser_set_property(GObject * gobject,guint prop_id,const GValue * value,GParamSpec * param_spec)247 ags_lv2_turtle_parser_set_property(GObject *gobject,
248 guint prop_id,
249 const GValue *value,
250 GParamSpec *param_spec)
251 {
252 AgsLv2TurtleParser *lv2_turtle_parser;
253
254 GRecMutex *lv2_turtle_parser_mutex;
255
256 lv2_turtle_parser = AGS_LV2_TURTLE_PARSER(gobject);
257
258 /* get lv2 turtle parser mutex */
259 lv2_turtle_parser_mutex = AGS_LV2_TURTLE_PARSER_GET_OBJ_MUTEX(lv2_turtle_parser);
260
261 switch(prop_id){
262 case PROP_TURTLE:
263 {
264 AgsTurtle *turtle;
265
266 turtle = (AgsTurtle *) g_value_get_pointer(value);
267
268 g_rec_mutex_lock(lv2_turtle_parser_mutex);
269
270 if(!AGS_IS_TURTLE(turtle) ||
271 g_list_find(lv2_turtle_parser->turtle, turtle) != NULL){
272 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
273
274 return;
275 }
276
277 g_object_ref(turtle);
278 lv2_turtle_parser->turtle = g_list_prepend(lv2_turtle_parser->turtle,
279 turtle);
280
281 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
282 }
283 break;
284 case PROP_PLUGIN:
285 {
286 AgsLv2Plugin *lv2_plugin;
287
288 lv2_plugin = (AgsLv2Plugin *) g_value_get_pointer(value);
289
290 g_rec_mutex_lock(lv2_turtle_parser_mutex);
291
292 if(!AGS_IS_LV2_PLUGIN(lv2_plugin) ||
293 g_list_find(lv2_turtle_parser->plugin, lv2_plugin) != NULL){
294 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
295
296 return;
297 }
298
299 g_object_ref(lv2_plugin);
300 lv2_turtle_parser->plugin = g_list_prepend(lv2_turtle_parser->plugin,
301 lv2_plugin);
302
303 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
304 }
305 break;
306 case PROP_UI_PLUGIN:
307 {
308 AgsLv2uiPlugin *lv2ui_plugin;
309
310 lv2ui_plugin = (AgsLv2uiPlugin *) g_value_get_pointer(value);
311
312 g_rec_mutex_lock(lv2_turtle_parser_mutex);
313
314 if(!AGS_IS_LV2UI_PLUGIN(lv2ui_plugin) ||
315 g_list_find(lv2_turtle_parser->ui_plugin, lv2ui_plugin) != NULL){
316 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
317
318 return;
319 }
320
321 g_object_ref(lv2ui_plugin);
322 lv2_turtle_parser->ui_plugin = g_list_prepend(lv2_turtle_parser->ui_plugin,
323 lv2ui_plugin);
324
325 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
326 }
327 break;
328 case PROP_PRESET:
329 {
330 AgsLv2Preset *lv2_preset;
331
332 lv2_preset = (AgsLv2Preset *) g_value_get_pointer(value);
333
334 g_rec_mutex_lock(lv2_turtle_parser_mutex);
335
336 if(!AGS_IS_LV2_PRESET(lv2_preset) ||
337 g_list_find(lv2_turtle_parser->preset, lv2_preset) != NULL){
338 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
339
340 return;
341 }
342
343 g_object_ref(lv2_preset);
344 lv2_turtle_parser->preset = g_list_prepend(lv2_turtle_parser->preset,
345 lv2_preset);
346
347 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
348 }
349 break;
350 default:
351 G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, param_spec);
352 break;
353 }
354 }
355
356 void
ags_lv2_turtle_parser_get_property(GObject * gobject,guint prop_id,GValue * value,GParamSpec * param_spec)357 ags_lv2_turtle_parser_get_property(GObject *gobject,
358 guint prop_id,
359 GValue *value,
360 GParamSpec *param_spec)
361 {
362 AgsLv2TurtleParser *lv2_turtle_parser;
363
364 GRecMutex *lv2_turtle_parser_mutex;
365
366 lv2_turtle_parser = AGS_LV2_TURTLE_PARSER(gobject);
367
368 /* get lv2 turtle parser mutex */
369 lv2_turtle_parser_mutex = AGS_LV2_TURTLE_PARSER_GET_OBJ_MUTEX(lv2_turtle_parser);
370
371 switch(prop_id){
372 case PROP_TURTLE:
373 {
374 g_rec_mutex_lock(lv2_turtle_parser_mutex);
375
376 g_value_set_pointer(value, g_list_copy_deep(lv2_turtle_parser->turtle,
377 (GCopyFunc) g_object_ref,
378 NULL));
379
380 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
381 }
382 break;
383 case PROP_PLUGIN:
384 {
385 g_rec_mutex_lock(lv2_turtle_parser_mutex);
386
387 g_value_set_pointer(value, g_list_copy_deep(lv2_turtle_parser->plugin,
388 (GCopyFunc) g_object_ref,
389 NULL));
390
391 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
392 }
393 break;
394 case PROP_UI_PLUGIN:
395 {
396 g_rec_mutex_lock(lv2_turtle_parser_mutex);
397
398 g_value_set_pointer(value, g_list_copy_deep(lv2_turtle_parser->ui_plugin,
399 (GCopyFunc) g_object_ref,
400 NULL));
401
402 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
403 }
404 break;
405 case PROP_PRESET:
406 {
407 g_rec_mutex_lock(lv2_turtle_parser_mutex);
408
409 g_value_set_pointer(value, g_list_copy_deep(lv2_turtle_parser->preset,
410 (GCopyFunc) g_object_ref,
411 NULL));
412
413 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
414 }
415 break;
416 default:
417 G_OBJECT_WARN_INVALID_PROPERTY_ID(gobject, prop_id, param_spec);
418 break;
419 }
420 }
421
422 void
ags_lv2_turtle_parser_dispose(GObject * gobject)423 ags_lv2_turtle_parser_dispose(GObject *gobject)
424 {
425 AgsLv2TurtleParser *lv2_turtle_parser;
426
427 lv2_turtle_parser = AGS_LV2_TURTLE_PARSER(gobject);
428
429 if(lv2_turtle_parser->turtle != NULL){
430 g_list_free_full(lv2_turtle_parser->turtle,
431 g_object_unref);
432
433 lv2_turtle_parser->turtle = NULL;
434 }
435
436 if(lv2_turtle_parser->plugin != NULL){
437 g_list_free_full(lv2_turtle_parser->plugin,
438 g_object_unref);
439
440 lv2_turtle_parser->plugin = NULL;
441 }
442
443 if(lv2_turtle_parser->ui_plugin != NULL){
444 g_list_free_full(lv2_turtle_parser->ui_plugin,
445 g_object_unref);
446
447 lv2_turtle_parser->ui_plugin = NULL;
448 }
449
450 if(lv2_turtle_parser->preset != NULL){
451 g_list_free_full(lv2_turtle_parser->preset,
452 g_object_unref);
453
454 lv2_turtle_parser->preset = NULL;
455 }
456
457 /* call parent */
458 G_OBJECT_CLASS(ags_lv2_turtle_parser_parent_class)->dispose(gobject);
459 }
460
461 void
ags_lv2_turtle_parser_finalize(GObject * gobject)462 ags_lv2_turtle_parser_finalize(GObject *gobject)
463 {
464 AgsLv2TurtleParser *lv2_turtle_parser;
465
466 lv2_turtle_parser = AGS_LV2_TURTLE_PARSER(gobject);
467
468 if(lv2_turtle_parser->turtle != NULL){
469 g_list_free_full(lv2_turtle_parser->turtle,
470 g_object_unref);
471 }
472
473 if(lv2_turtle_parser->plugin != NULL){
474 g_list_free_full(lv2_turtle_parser->plugin,
475 g_object_unref);
476 }
477
478 if(lv2_turtle_parser->ui_plugin != NULL){
479 g_list_free_full(lv2_turtle_parser->ui_plugin,
480 g_object_unref);
481 }
482
483 if(lv2_turtle_parser->preset != NULL){
484 g_list_free_full(lv2_turtle_parser->preset,
485 g_object_unref);
486 }
487
488 /* call parent */
489 G_OBJECT_CLASS(ags_lv2_turtle_parser_parent_class)->finalize(gobject);
490 }
491
492 void
ags_lv2_turtle_parser_parse_names_statement(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,xmlNode * node,AgsTurtle ** turtle,guint n_turtle,gboolean see_also)493 ags_lv2_turtle_parser_parse_names_statement(AgsLv2TurtleParser *lv2_turtle_parser,
494 AgsTurtle *current_turtle,
495 xmlNode *node,
496 AgsTurtle **turtle, guint n_turtle,
497 gboolean see_also)
498 {
499 xmlNode *child;
500
501 if(node == NULL){
502 return;
503 }
504
505 child = node->children;
506
507 while(child != NULL){
508 if(child->type == XML_ELEMENT_NODE){
509 if(!g_ascii_strncasecmp(child->name,
510 "rdf-triple",
511 11)){
512 ags_lv2_turtle_parser_parse_names_triple(lv2_turtle_parser,
513 current_turtle,
514 child,
515 turtle, n_turtle,
516 see_also);
517 }
518 }
519
520 child = child->next;
521 }
522 }
523
524 void
ags_lv2_turtle_parser_parse_names_triple(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,xmlNode * node,AgsTurtle ** turtle,guint n_turtle,gboolean see_also)525 ags_lv2_turtle_parser_parse_names_triple(AgsLv2TurtleParser *lv2_turtle_parser,
526 AgsTurtle *current_turtle,
527 xmlNode *node,
528 AgsTurtle **turtle, guint n_turtle,
529 gboolean see_also)
530 {
531 xmlNode *child;
532
533 gchar *subject_iriref;
534
535 if(node == NULL){
536 return;
537 }
538
539 child = node->children;
540
541 subject_iriref = NULL;
542
543 while(child != NULL){
544 if(child->type == XML_ELEMENT_NODE){
545 if(!g_ascii_strncasecmp(child->name,
546 "rdf-subject",
547 12)){
548 GList *xpath_result;
549
550 gchar *xpath;
551
552 xpath = "./rdf-iri/rdf-iriref";
553
554 xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
555 xpath,
556 (xmlNode *) child);
557
558 if(xpath_result != NULL){
559 gchar *str;
560
561 str = xmlNodeGetContent((xmlNode *) xpath_result->data);
562
563 if(strlen(str) > 2){
564 subject_iriref = g_strndup(str + 1,
565 strlen(str) - 2);
566 }
567
568 if(str != NULL){
569 xmlFree(str);
570 }
571 }else{
572 AgsTurtle **turtle_iter;
573
574 gchar *pname;
575
576 xpath = "./rdf-iri/rdf-prefixed-name/rdf-pname-ln";
577
578 xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
579 xpath,
580 (xmlNode *) child);
581
582 if(xpath_result != NULL){
583 pname = xmlNodeGetContent((xmlNode *) xpath_result->data);
584
585 for(turtle_iter = turtle; turtle_iter[0] != NULL; turtle_iter++){
586 GList *start_list, *list;
587
588 gchar *str;
589 gchar *prefix, *suffix;
590
591 prefix = NULL;
592 suffix = strchr(pname, ':');
593
594 if(suffix != NULL){
595 suffix += 1;
596
597 prefix = g_strndup(pname,
598 suffix - pname);
599
600 if(suffix != '\0'){
601 suffix = g_strdup(suffix);
602 }else{
603 suffix = NULL;
604 }
605 }
606
607 list =
608 start_list = g_hash_table_get_keys(turtle_iter[0]->prefix_id);
609
610 str = NULL;
611
612 while(list != NULL){
613 gchar *value;
614
615 value = g_hash_table_lookup(turtle_iter[0]->prefix_id,
616 list->data);
617
618 if(!g_ascii_strcasecmp(prefix,
619 value)){
620 str = list->data;
621
622 break;
623 }
624
625 list = list->next;
626 }
627
628 g_list_free(start_list);
629
630 if(str != NULL &&
631 suffix != NULL){
632 subject_iriref = g_strdup_printf("%s%s",
633 str,
634 suffix);
635 }else if(str != NULL){
636 subject_iriref = g_strdup(str);
637 }
638
639 g_free(prefix);
640 g_free(suffix);
641
642 if(turtle_iter[0] == current_turtle){
643 break;
644 }
645 }
646
647 if(pname != NULL){
648 xmlFree(pname);
649 }
650 }
651 }
652
653 g_list_free(xpath_result);
654 }else if(!g_ascii_strncasecmp(child->name,
655 "rdf-predicate-object-list",
656 27)){
657 if(!see_also){
658 ags_lv2_turtle_parser_parse_names_predicate_object_list(lv2_turtle_parser,
659 current_turtle,
660 subject_iriref,
661 child,
662 turtle, n_turtle);
663 }else{
664 ags_lv2_turtle_parser_parse_names_predicate_object_list_see_also(lv2_turtle_parser,
665 current_turtle,
666 subject_iriref,
667 child,
668 turtle, n_turtle);
669 }
670 }else if(!g_ascii_strncasecmp(child->name,
671 "rdf-blank-node-property-list",
672 29)){
673 ags_lv2_turtle_parser_parse_names_blank_node_property_list(lv2_turtle_parser,
674 current_turtle,
675 subject_iriref,
676 child,
677 turtle, n_turtle);
678 }
679 }
680
681 child = child->next;
682 }
683 }
684
685 void
ags_lv2_turtle_parser_parse_names_predicate_object_list(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,gchar * subject_iriref,xmlNode * node,AgsTurtle ** turtle,guint n_turtle)686 ags_lv2_turtle_parser_parse_names_predicate_object_list(AgsLv2TurtleParser *lv2_turtle_parser,
687 AgsTurtle *current_turtle,
688 gchar *subject_iriref,
689 xmlNode *node,
690 AgsTurtle **turtle, guint n_turtle)
691 {
692 AgsLv2Manager *lv2_manager;
693 AgsLv2Plugin *lv2_plugin;
694
695 AgsTurtle **turtle_iter;
696
697 xmlNode *child;
698
699 GList *start_xpath_result, *xpath_result;
700
701 gchar *prefix_id_doap;
702 gchar *prefix_id_rdfs;
703 gchar *prefix_id_lv2_core;
704 gchar *xpath;
705
706 gboolean is_plugin;
707 gboolean is_instrument;
708
709 GRecMutex *lv2_manager_mutex;
710
711 if(node == NULL){
712 return;
713 }
714
715 prefix_id_doap = NULL;
716
717 prefix_id_rdfs = NULL;
718
719 prefix_id_lv2_core = NULL;
720
721 for(turtle_iter = turtle; turtle_iter[0] != NULL; turtle_iter++){
722 gchar *str;
723
724 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
725 "http://usefulinc.com/ns/doap#")) != NULL){
726 prefix_id_doap = str;
727 }
728
729 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
730 "http://www.w3.org/2000/01/rdf-schema#")) != NULL){
731 prefix_id_rdfs = str;
732 }
733
734 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
735 "http://lv2plug.in/ns/lv2core#")) != NULL){
736 prefix_id_lv2_core = str;
737 }
738
739 if(turtle_iter[0] == current_turtle){
740 break;
741 }
742 }
743
744 lv2_manager = ags_lv2_manager_get_instance();
745
746 /* get lv2 manager mutex */
747 lv2_manager_mutex = AGS_LV2_MANAGER_GET_OBJ_MUTEX(lv2_manager);
748
749 lv2_plugin = NULL;
750 is_plugin = FALSE;
751
752 is_instrument = FALSE;
753
754 /* parse verbs */
755 xpath = "./rdf-verb[@verb = 'a']";
756
757 xpath_result =
758 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
759 xpath,
760 (xmlNode *) node);
761
762 while(xpath_result != NULL){
763 xmlNode *current;
764
765 GList *current_start_xpath_result;
766
767 gchar *current_xpath;
768
769 current = (xmlNode *) xpath_result->data;
770
771 do{
772 current = current->next;
773 }while(current != NULL && current->type != XML_ELEMENT_NODE);
774
775 /* check plugin */
776 current_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#plugin>']";
777
778 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
779 current_xpath,
780 (xmlNode *) current);
781
782 if(current_start_xpath_result != NULL){
783 is_plugin = TRUE;
784
785 break;
786 }else if(prefix_id_lv2_core != NULL){
787 gchar *prefix_id;
788
789 prefix_id = prefix_id_lv2_core;
790
791 current_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
792 prefix_id,
793 "plugin");
794
795 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
796 current_xpath,
797 (xmlNode *) current);
798
799 if(current_start_xpath_result != NULL){
800 is_plugin = TRUE;
801 }
802
803 g_free(current_xpath);
804 }
805
806 g_list_free(current_start_xpath_result);
807
808 /* check instrument */
809 current_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#instrumentplugin>']";
810
811 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
812 current_xpath,
813 (xmlNode *) current);
814
815 if(current_start_xpath_result != NULL){
816 is_instrument = TRUE;
817 }else if(prefix_id_lv2_core != NULL){
818 gchar *prefix_id;
819
820 prefix_id = prefix_id_lv2_core;
821
822 current_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
823 prefix_id,
824 "instrumentplugin");
825
826 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
827 current_xpath,
828 (xmlNode *) current);
829
830 if(current_start_xpath_result != NULL){
831 is_instrument = TRUE;
832 }
833
834 g_free(current_xpath);
835 }
836
837 if(current_start_xpath_result != NULL){
838 g_list_free(current_start_xpath_result);
839 }
840
841 /* iterate */
842 xpath_result = xpath_result->next;
843 }
844
845 g_list_free(start_xpath_result);
846
847 /* plugin create instance */
848 if(is_plugin){
849 GList *list;
850
851 g_rec_mutex_lock(lv2_manager_mutex);
852
853 list = ags_lv2_plugin_find_uri(lv2_manager->lv2_plugin,
854 subject_iriref);
855
856 g_rec_mutex_unlock(lv2_manager_mutex);
857
858 if(list != NULL){
859 lv2_plugin = list->data;
860 }
861
862 if(lv2_plugin == NULL){
863 AgsUUID *current_uuid;
864
865 xmlNode *node_binary;
866
867 gchar *path;
868 gchar *so_filename;
869 gchar *filename;
870
871 current_uuid = ags_uuid_alloc();
872 ags_uuid_generate(current_uuid);
873
874 /* so filename */
875 node_binary = NULL;
876
877 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#binary>']";
878
879 xpath_result =
880 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
881 xpath,
882 (xmlNode *) node);
883
884 if(xpath_result != NULL){
885 node_binary = ((xmlNode *) xpath_result->data)->parent->parent->parent->next;
886 }else if(prefix_id_lv2_core != NULL){
887 gchar *prefix_id;
888
889 prefix_id = prefix_id_lv2_core;
890
891 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
892 prefix_id,
893 "binary");
894
895 xpath_result =
896 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
897 xpath,
898 (xmlNode *) node);
899
900 g_free(xpath);
901
902 if(xpath_result != NULL){
903 node_binary = ((xmlNode *) xpath_result->data)->parent->parent->parent->parent->next;
904 }
905 }
906
907 g_list_free(start_xpath_result);
908
909 path = NULL;
910
911 if(turtle != NULL &&
912 turtle[0] != NULL){
913 path = g_path_get_dirname(turtle[0]->filename);
914 }
915
916 so_filename = NULL;
917
918 if(node_binary != NULL){
919 xmlNode *current;
920
921 GList *current_start_xpath_result, *current_xpath_result;
922
923 gchar *current_xpath;
924
925 current_xpath = "./rdf-object/rdf-iri/rdf-iriref";
926
927 current_xpath_result =
928 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
929 current_xpath,
930 (xmlNode *) node_binary);
931
932 if(current_start_xpath_result != NULL){
933 gchar *str;
934
935 str = xmlNodeGetContent(current_start_xpath_result->data);
936
937 if(str != NULL){
938 if(strlen(str) > 2){
939 so_filename = g_strndup(str + 1,
940 strlen(str) - 2);
941 }
942
943 xmlFree(str);
944 }
945 }
946
947 g_list_free(current_start_xpath_result);
948 }
949
950 filename = NULL;
951
952 if(path != NULL &&
953 so_filename != NULL){
954 filename = g_strdup_printf("%s%c%s",
955 path,
956 G_DIR_SEPARATOR,
957 so_filename);
958 }
959
960 #if AGS_DEBUG
961 g_message("new lv2 plugin - %s", subject_iriref);
962 #endif
963
964 lv2_plugin = g_object_new(AGS_TYPE_LV2_PLUGIN,
965 "uuid", current_uuid,
966 "filename", filename,
967 "uri", subject_iriref,
968 NULL);
969
970 g_object_set(lv2_plugin,
971 "manifest", turtle[0],
972 "turtle", turtle[n_turtle - 1],
973 NULL);
974
975 g_rec_mutex_lock(lv2_manager_mutex);
976
977 lv2_manager->lv2_plugin = g_list_prepend(lv2_manager->lv2_plugin,
978 lv2_plugin);
979
980 g_rec_mutex_unlock(lv2_manager_mutex);
981
982 g_object_set(lv2_turtle_parser,
983 "plugin", lv2_plugin,
984 NULL);
985
986 g_free(filename);
987 }
988
989 if(lv2_plugin == NULL){
990 g_warning("no plugin");
991 }
992 }
993
994 if(is_instrument){
995 ags_base_plugin_set_flags(lv2_plugin,
996 AGS_BASE_PLUGIN_IS_INSTRUMENT);
997
998 ags_lv2_plugin_set_flags(lv2_plugin,
999 AGS_LV2_PLUGIN_IS_SYNTHESIZER);
1000 }
1001
1002 /* plugin - read metadata */
1003 if(is_plugin){
1004 xmlNode *current;
1005
1006 GList *current_start_xpath_result, *current_xpath_result;
1007
1008 gchar *current_xpath;
1009
1010 /* effect */
1011 current = NULL;
1012
1013 current_xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://usefulinc.com/ns/doap#name>']";
1014
1015 current_xpath_result =
1016 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1017 current_xpath,
1018 (xmlNode *) node);
1019
1020 if(current_start_xpath_result != NULL){
1021 current = ((xmlNode *) current_start_xpath_result->data)->parent->parent->parent->next;
1022 }else if(prefix_id_doap != NULL){
1023 gchar *prefix_id;
1024
1025 prefix_id = prefix_id_doap;
1026
1027 current_xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
1028 prefix_id,
1029 "name");
1030
1031 current_xpath_result =
1032 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1033 current_xpath,
1034 (xmlNode *) node);
1035
1036 g_free(current_xpath);
1037
1038 if(current_start_xpath_result != NULL){
1039 current = ((xmlNode *) current_start_xpath_result->data)->parent->parent->parent->parent->next;
1040 }
1041 }
1042
1043 g_list_free(current_start_xpath_result);
1044
1045 if(current != NULL){
1046 GList *start_label_xpath_result, *label_xpath_result;
1047
1048 gchar *label_xpath;
1049
1050 label_xpath = "./rdf-object/rdf-literal/rdf-string";
1051
1052 label_xpath_result =
1053 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1054 label_xpath,
1055 (xmlNode *) current);
1056
1057 if(start_label_xpath_result != NULL){
1058 gchar *str;
1059
1060 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
1061
1062 if(str != NULL){
1063 if(strlen(str) > 2){
1064 gchar *tmp;
1065
1066 tmp = NULL;
1067
1068 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
1069 tmp = g_strndup(str + 3,
1070 (gsize) (strlen(str) - 6));
1071 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
1072 tmp = g_strndup(str + 3,
1073 (gsize) (strlen(str) - 6));
1074 }else if(str[0] = '"'){
1075 tmp = g_strndup(str + 1,
1076 (gsize) (strlen(str) - 2));
1077 }else if(str[0] == '\''){
1078 tmp = g_strndup(str + 1,
1079 (gsize) (strlen(str) - 2));
1080 }
1081
1082 #if AGS_DEBUG
1083 g_message(" `-- effect %s %s %s", AGS_BASE_PLUGIN(lv2_plugin)->filename, subject_iriref, tmp);
1084 #endif
1085
1086 g_object_set(lv2_plugin,
1087 "effect", tmp,
1088 NULL);
1089
1090 g_free(tmp);
1091 }
1092
1093 xmlFree(str);
1094 }
1095 }
1096
1097 g_list_free(start_label_xpath_result);
1098 }
1099 }
1100 }
1101
1102 void
ags_lv2_turtle_parser_parse_names_predicate_object_list_see_also(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,gchar * subject_iriref,xmlNode * node,AgsTurtle ** turtle,guint n_turtle)1103 ags_lv2_turtle_parser_parse_names_predicate_object_list_see_also(AgsLv2TurtleParser *lv2_turtle_parser,
1104 AgsTurtle *current_turtle,
1105 gchar *subject_iriref,
1106 xmlNode *node,
1107 AgsTurtle **turtle, guint n_turtle)
1108 {
1109 AgsTurtle **turtle_iter;
1110
1111 xmlNode *current;
1112
1113 GList *start_xpath_result, *xpath_result;
1114
1115 gchar *prefix_id_rdfs;
1116 gchar *xpath;
1117
1118 prefix_id_rdfs = NULL;
1119
1120 for(turtle_iter = turtle; turtle_iter[0] != NULL; turtle_iter++){
1121 gchar *str;
1122
1123 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1124 "http://www.w3.org/2000/01/rdf-schema#")) != NULL){
1125 prefix_id_rdfs = str;
1126 }
1127
1128 if(turtle_iter[0] == current_turtle){
1129 break;
1130 }
1131 }
1132
1133 /* label */
1134 current = NULL;
1135
1136 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://www.w3.org/2000/01/rdf-schema#seealso>']";
1137
1138 xpath_result =
1139 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1140 xpath,
1141 (xmlNode *) node);
1142
1143 if(start_xpath_result != NULL){
1144 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
1145 }else if(prefix_id_rdfs != NULL){
1146 gchar *prefix_id;
1147
1148 prefix_id = prefix_id_rdfs;
1149
1150 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
1151 prefix_id,
1152 "seealso");
1153
1154 xpath_result =
1155 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1156 xpath,
1157 (xmlNode *) node);
1158
1159 g_free(xpath);
1160
1161 if(start_xpath_result != NULL){
1162 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
1163 }
1164 }
1165
1166 g_list_free(start_xpath_result);
1167
1168 if(current != NULL){
1169 GList *start_iriref_xpath_result, *iriref_xpath_result;
1170
1171 gchar *iriref_xpath;
1172
1173 iriref_xpath = "./rdf-object/rdf-iri/rdf-iriref";
1174
1175 iriref_xpath_result =
1176 start_iriref_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1177 iriref_xpath,
1178 (xmlNode *) current);
1179
1180 if(start_iriref_xpath_result != NULL){
1181 gchar *str;
1182
1183 str = xmlNodeGetContent((xmlNode *) start_iriref_xpath_result->data);
1184
1185 if(str != NULL){
1186 if(g_str_has_suffix(str,
1187 ".ttl>")){
1188 AgsTurtle **next_turtle;
1189 AgsTurtle *next;
1190
1191 gchar *path;
1192 gchar *filename;
1193
1194 int ttl_length;
1195 guint next_n_turtle;
1196 gboolean skip;
1197
1198 path = NULL;
1199
1200 if(turtle != NULL &&
1201 turtle[0] != NULL){
1202 path = g_path_get_dirname(turtle[0]->filename);
1203 }
1204
1205 ttl_length = strlen(str) - 2;
1206 filename = g_strdup_printf("%s%c%.*s",
1207 path,
1208 G_DIR_SEPARATOR,
1209 ttl_length, &(str[1]));
1210
1211 skip = TRUE;
1212 next = ags_turtle_manager_find(ags_turtle_manager_get_instance(),
1213 filename);
1214
1215 if(next == NULL){
1216 g_message("new turtle - %s", filename);
1217
1218 next = ags_turtle_new(filename);
1219 g_object_set(lv2_turtle_parser,
1220 "turtle", next,
1221 NULL);
1222
1223 ags_turtle_load(next,
1224 NULL);
1225
1226 ags_turtle_manager_add(ags_turtle_manager_get_instance(),
1227 (GObject *) next);
1228
1229 skip = FALSE;
1230
1231 g_object_unref(next);
1232 }
1233
1234 if(next != NULL &&
1235 !skip){
1236 next_n_turtle = n_turtle + 1;
1237
1238 next_turtle = (AgsTurtle **) malloc((next_n_turtle + 1) * sizeof(AgsTurtle *));
1239
1240 memcpy(next_turtle, turtle, n_turtle * sizeof(AgsTurtle *));
1241
1242 next_turtle[n_turtle] = next;
1243 next_turtle[n_turtle + 1] = NULL;
1244
1245 ags_lv2_turtle_parser_parse_names(lv2_turtle_parser,
1246 next_turtle, next_n_turtle);
1247
1248 free(next_turtle);
1249 }
1250
1251 g_free(path);
1252 g_free(filename);
1253 }
1254
1255 xmlFree(str);
1256 }
1257 }
1258
1259 g_list_free(start_iriref_xpath_result);
1260 }
1261 }
1262
1263 void
ags_lv2_turtle_parser_parse_names_blank_node_property_list(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,gchar * subject_iriref,xmlNode * node,AgsTurtle ** turtle,guint n_turtle)1264 ags_lv2_turtle_parser_parse_names_blank_node_property_list(AgsLv2TurtleParser *lv2_turtle_parser,
1265 AgsTurtle *current_turtle,
1266 gchar *subject_iriref,
1267 xmlNode *node,
1268 AgsTurtle **turtle, guint n_turtle)
1269 {
1270 }
1271
1272 /**
1273 * ags_lv2_turtle_parser_parse_names:
1274 * @lv2_turtle_parser: the #AgsLv2TurtleParser
1275 * @turtle: the %NULL terminated array of #AgsTurtle
1276 * @n_turtle: the turtle count
1277 *
1278 * Parse names only from manifest and referred turtles.
1279 *
1280 * Since: 3.0.0
1281 */
1282 void
ags_lv2_turtle_parser_parse_names(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle ** turtle,guint n_turtle)1283 ags_lv2_turtle_parser_parse_names(AgsLv2TurtleParser *lv2_turtle_parser,
1284 AgsTurtle **turtle, guint n_turtle)
1285 {
1286 AgsTurtle *manifest;
1287 AgsTurtle *current_turtle;
1288
1289 xmlNode *root_node;
1290 xmlNode *node;
1291
1292 GList *list;
1293 GList *start_plugin, *plugin;
1294
1295 GRecMutex *lv2_turtle_parser_mutex;
1296
1297 if(!AGS_IS_LV2_TURTLE_PARSER(lv2_turtle_parser)){
1298 return;
1299 }
1300
1301 /* get lv2 turtle parser mutex */
1302 lv2_turtle_parser_mutex = AGS_LV2_TURTLE_PARSER_GET_OBJ_MUTEX(lv2_turtle_parser);
1303
1304 /* get manifest */
1305 manifest = NULL;
1306
1307 g_rec_mutex_lock(lv2_turtle_parser_mutex);
1308
1309 list = g_list_last(lv2_turtle_parser->turtle);
1310
1311 if(list != NULL){
1312 manifest = list->data;
1313 }
1314
1315 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
1316
1317 if(turtle == NULL){
1318 if(manifest == NULL){
1319 return;
1320 }else{
1321 guint turtle_count;
1322
1323 turtle_count = 1;
1324
1325 turtle = (AgsTurtle **) malloc(2 * sizeof(AgsTurtle *));
1326 turtle[0] = manifest;
1327 turtle[1] = NULL;
1328
1329 n_turtle = turtle_count;
1330 }
1331 }
1332
1333 if(n_turtle == 0){
1334 g_warning("missing argument");
1335
1336 return;
1337 }
1338
1339 current_turtle = turtle[n_turtle - 1];
1340
1341 /* get root node */
1342 root_node = xmlDocGetRootElement(current_turtle->doc);
1343
1344 /* start parse */
1345 node = NULL;
1346
1347 if(root_node != NULL){
1348 node = root_node->children;
1349 }
1350
1351 while(node != NULL){
1352 if(node->type == XML_ELEMENT_NODE){
1353 if(!g_ascii_strncasecmp(node->name,
1354 "rdf-statement",
1355 14)){
1356 ags_lv2_turtle_parser_parse_names_statement(lv2_turtle_parser,
1357 current_turtle,
1358 node,
1359 turtle, n_turtle,
1360 FALSE);
1361 }
1362 }
1363
1364 node = node->next;
1365 }
1366
1367 /* parse see also */
1368 if(root_node != NULL){
1369 node = root_node->children;
1370 }
1371
1372 while(node != NULL){
1373 if(node->type == XML_ELEMENT_NODE){
1374 if(!g_ascii_strncasecmp(node->name,
1375 "rdf-statement",
1376 14)){
1377 ags_lv2_turtle_parser_parse_names_statement(lv2_turtle_parser,
1378 current_turtle,
1379 node,
1380 turtle, n_turtle,
1381 TRUE);
1382 }
1383 }
1384
1385 node = node->next;
1386 }
1387 }
1388
1389 void
ags_lv2_turtle_parser_parse_statement(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,xmlNode * node,AgsTurtle ** turtle,guint n_turtle,gboolean see_also)1390 ags_lv2_turtle_parser_parse_statement(AgsLv2TurtleParser *lv2_turtle_parser,
1391 AgsTurtle *current_turtle,
1392 xmlNode *node,
1393 AgsTurtle **turtle, guint n_turtle,
1394 gboolean see_also)
1395 {
1396 xmlNode *child;
1397
1398 if(node == NULL){
1399 return;
1400 }
1401
1402 child = node->children;
1403
1404 while(child != NULL){
1405 if(child->type == XML_ELEMENT_NODE){
1406 if(!g_ascii_strncasecmp(child->name,
1407 "rdf-triple",
1408 11)){
1409 ags_lv2_turtle_parser_parse_triple(lv2_turtle_parser,
1410 current_turtle,
1411 child,
1412 turtle, n_turtle,
1413 see_also);
1414 }
1415 }
1416
1417 child = child->next;
1418 }
1419 }
1420
1421 void
ags_lv2_turtle_parser_parse_triple(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,xmlNode * node,AgsTurtle ** turtle,guint n_turtle,gboolean see_also)1422 ags_lv2_turtle_parser_parse_triple(AgsLv2TurtleParser *lv2_turtle_parser,
1423 AgsTurtle *current_turtle,
1424 xmlNode *node,
1425 AgsTurtle **turtle, guint n_turtle,
1426 gboolean see_also)
1427 {
1428 xmlNode *child;
1429
1430 gchar *subject_iriref;
1431
1432 if(node == NULL){
1433 return;
1434 }
1435
1436 child = node->children;
1437
1438 subject_iriref = NULL;
1439
1440 while(child != NULL){
1441 if(child->type == XML_ELEMENT_NODE){
1442 if(!g_ascii_strncasecmp(child->name,
1443 "rdf-subject",
1444 12)){
1445 GList *xpath_result;
1446
1447 gchar *xpath;
1448
1449 xpath = "./rdf-iri/rdf-iriref";
1450
1451 xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1452 xpath,
1453 (xmlNode *) child);
1454
1455 if(xpath_result != NULL){
1456 gchar *str;
1457
1458 str = xmlNodeGetContent((xmlNode *) xpath_result->data);
1459
1460 if(strlen(str) > 2){
1461 subject_iriref = g_strndup(str + 1,
1462 strlen(str) - 2);
1463 }
1464
1465 if(str != NULL){
1466 xmlFree(str);
1467 }
1468 }else{
1469 AgsTurtle **turtle_iter;
1470
1471 gchar *pname;
1472
1473 xpath = "./rdf-iri/rdf-prefixed-name/rdf-pname-ln";
1474
1475 xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1476 xpath,
1477 (xmlNode *) child);
1478
1479 if(xpath_result != NULL){
1480 pname = xmlNodeGetContent((xmlNode *) xpath_result->data);
1481
1482 for(turtle_iter = turtle; turtle_iter[0] != NULL; turtle_iter++){
1483 GList *start_list, *list;
1484
1485 gchar *str;
1486 gchar *prefix, *suffix;
1487
1488 prefix = NULL;
1489 suffix = strchr(pname, ':');
1490
1491 if(suffix != NULL){
1492 prefix = g_strndup(pname,
1493 suffix - pname + 1);
1494 suffix = g_strdup(suffix + 1);
1495 }
1496
1497 list =
1498 start_list = g_hash_table_get_keys(turtle_iter[0]->prefix_id);
1499
1500 str = NULL;
1501
1502 while(list != NULL){
1503 gchar *value;
1504
1505 value = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1506 list->data);
1507
1508 if(!g_ascii_strcasecmp(prefix,
1509 value)){
1510 str = list->data;
1511
1512 break;
1513 }
1514
1515 list = list->next;
1516 }
1517
1518 g_list_free(start_list);
1519
1520 if(str != NULL &&
1521 suffix != NULL){
1522 subject_iriref = g_strdup_printf("%s%s",
1523 str,
1524 suffix);
1525 }
1526
1527 g_free(prefix);
1528 g_free(suffix);
1529
1530 if(turtle_iter[0] == current_turtle){
1531 break;
1532 }
1533 }
1534
1535 if(pname != NULL){
1536 g_free(pname);
1537 }
1538 }
1539 }
1540
1541 g_list_free(xpath_result);
1542 }else if(!g_ascii_strncasecmp(child->name,
1543 "rdf-predicate-object-list",
1544 27)){
1545 if(!see_also){
1546 ags_lv2_turtle_parser_parse_predicate_object_list(lv2_turtle_parser,
1547 current_turtle,
1548 subject_iriref,
1549 child,
1550 turtle, n_turtle);
1551 }else{
1552 ags_lv2_turtle_parser_parse_predicate_object_list_see_also(lv2_turtle_parser,
1553 current_turtle,
1554 subject_iriref,
1555 child,
1556 turtle, n_turtle);
1557 }
1558 }else if(!g_ascii_strncasecmp(child->name,
1559 "rdf-blank-node-property-list",
1560 29)){
1561 ags_lv2_turtle_parser_parse_blank_node_property_list(lv2_turtle_parser,
1562 current_turtle,
1563 subject_iriref,
1564 child,
1565 turtle, n_turtle);
1566 }
1567 }
1568
1569 child = child->next;
1570 }
1571 }
1572
1573 void
ags_lv2_turtle_parser_parse_predicate_object_list(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,gchar * subject_iriref,xmlNode * node,AgsTurtle ** turtle,guint n_turtle)1574 ags_lv2_turtle_parser_parse_predicate_object_list(AgsLv2TurtleParser *lv2_turtle_parser,
1575 AgsTurtle *current_turtle,
1576 gchar *subject_iriref,
1577 xmlNode *node,
1578 AgsTurtle **turtle, guint n_turtle)
1579 {
1580 AgsLv2Manager *lv2_manager;
1581 AgsLv2uiManager *lv2ui_manager;
1582 AgsLv2PresetManager *lv2_preset_manager;
1583 AgsLv2Plugin *lv2_plugin;
1584 AgsLv2uiPlugin *lv2ui_plugin;
1585 AgsLv2Preset *lv2_preset;
1586
1587 AgsTurtle **turtle_iter;
1588
1589 xmlNode *child;
1590
1591 GList *start_xpath_result, *xpath_result;
1592
1593 gchar *prefix_id_doap;
1594 gchar *prefix_id_foaf;
1595 gchar *prefix_id_rdfs;
1596 gchar *prefix_id_rdf;
1597 gchar *prefix_id_lv2_core;
1598 gchar *prefix_id_lv2ui;
1599 gchar *prefix_id_lv2p;
1600 gchar *prefix_id_lv2_worker;
1601 gchar *prefix_id_lv2_atom;
1602 gchar *prefix_id_lv2_midi;
1603 gchar *prefix_id_lv2_port_info;
1604 gchar *xpath;
1605
1606 gboolean is_plugin, is_ui_plugin;
1607 gboolean is_instrument;
1608 gboolean is_preset;
1609
1610 GRecMutex *lv2_manager_mutex;
1611 GRecMutex *lv2ui_manager_mutex;
1612
1613 if(node == NULL){
1614 return;
1615 }
1616
1617 prefix_id_doap = NULL;
1618 prefix_id_foaf = NULL;
1619
1620 prefix_id_rdfs = NULL;
1621 prefix_id_rdf = NULL;
1622
1623 prefix_id_lv2_core = NULL;
1624 prefix_id_lv2ui = NULL;
1625 prefix_id_lv2p = NULL;
1626 prefix_id_lv2_worker = NULL;
1627 prefix_id_lv2_atom = NULL;
1628 prefix_id_lv2_midi = NULL;
1629 prefix_id_lv2_port_info = NULL;
1630
1631 for(turtle_iter = turtle; turtle_iter[0] != NULL; turtle_iter++){
1632 gchar *str;
1633
1634 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1635 "http://usefulinc.com/ns/doap#")) != NULL){
1636 prefix_id_doap = str;
1637 }
1638
1639 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1640 "http://xmlns.com/foaf/0.1/#")) != NULL){
1641 prefix_id_foaf = str;
1642 }
1643
1644 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1645 "http://www.w3.org/2000/01/rdf-schema#")) != NULL){
1646 prefix_id_rdfs = str;
1647 }
1648
1649 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1650 "http://www.w3.org/1999/02/22-rdf-syntax-ns#")) != NULL){
1651 prefix_id_rdf = str;
1652 }
1653
1654 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1655 "http://lv2plug.in/ns/lv2core#")) != NULL){
1656 prefix_id_lv2_core = str;
1657 }
1658
1659 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1660 "http://lv2plug.in/ns/extensions/ui#")) != NULL){
1661 prefix_id_lv2ui = str;
1662 }
1663
1664 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1665 "http://lv2plug.in/ns/ext/presets#")) != NULL){
1666 prefix_id_lv2p = str;
1667 }
1668
1669 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1670 "http://lv2plug.in/ns/ext/worker#")) != NULL){
1671 prefix_id_lv2_worker = str;
1672 }
1673
1674 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1675 "http://lv2plug.in/ns/ext/atom#")) != NULL){
1676 prefix_id_lv2_atom = str;
1677 }
1678
1679 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1680 "http://lv2plug.in/ns/ext/midi#")) != NULL){
1681 prefix_id_lv2_midi = str;
1682 }
1683
1684 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
1685 "http://lv2plug.in/ns/dev/extportinfo#")) != NULL){
1686 prefix_id_lv2_port_info = str;
1687 }
1688
1689 if(turtle_iter[0] == current_turtle){
1690 break;
1691 }
1692 }
1693
1694 lv2_manager = ags_lv2_manager_get_instance();
1695 lv2ui_manager = ags_lv2ui_manager_get_instance();
1696 lv2_preset_manager = ags_lv2_preset_manager_get_instance();
1697
1698 /* get lv2 manager mutex */
1699 lv2_manager_mutex = AGS_LV2_MANAGER_GET_OBJ_MUTEX(lv2_manager);
1700 lv2ui_manager_mutex = AGS_LV2_MANAGER_GET_OBJ_MUTEX(lv2ui_manager);
1701
1702 lv2_plugin = NULL;
1703 lv2ui_plugin = NULL;
1704 lv2_preset = NULL;
1705
1706 child = node->children;
1707
1708 is_plugin = FALSE;
1709 is_ui_plugin = FALSE;
1710
1711 is_instrument = FALSE;
1712
1713 is_preset = FALSE;
1714
1715 /* parse verbs */
1716 xpath = "./rdf-verb[@verb = 'a']";
1717
1718 xpath_result =
1719 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1720 xpath,
1721 (xmlNode *) node);
1722
1723 while(xpath_result != NULL){
1724 xmlNode *current;
1725
1726 GList *current_start_xpath_result;
1727
1728 gchar *current_xpath;
1729
1730 current = (xmlNode *) xpath_result->data;
1731
1732 do{
1733 current = current->next;
1734 }while(current != NULL && current->type != XML_ELEMENT_NODE);
1735
1736 /* check plugin */
1737 current_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#plugin>']";
1738
1739 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1740 current_xpath,
1741 (xmlNode *) current);
1742
1743 if(current_start_xpath_result != NULL){
1744 is_plugin = TRUE;
1745 }else if(prefix_id_lv2_core != NULL){
1746 gchar *prefix_id;
1747
1748 prefix_id = prefix_id_lv2_core;
1749
1750 current_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
1751 prefix_id,
1752 "plugin");
1753
1754 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1755 current_xpath,
1756 (xmlNode *) current);
1757
1758 if(current_start_xpath_result != NULL){
1759 is_plugin = TRUE;
1760 }
1761
1762 g_free(current_xpath);
1763 }
1764
1765 if(current_start_xpath_result != NULL){
1766 g_list_free(current_start_xpath_result);
1767 }
1768
1769 /* check instrument */
1770 current_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#instrumentplugin>']";
1771
1772 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1773 current_xpath,
1774 (xmlNode *) current);
1775
1776 if(current_start_xpath_result != NULL){
1777 is_instrument = TRUE;
1778 }else if(prefix_id_lv2_core != NULL){
1779 gchar *prefix_id;
1780
1781 prefix_id = prefix_id_lv2_core;
1782
1783 current_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
1784 prefix_id,
1785 "instrumentplugin");
1786
1787 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1788 current_xpath,
1789 (xmlNode *) current);
1790
1791 if(current_start_xpath_result != NULL){
1792 is_instrument = TRUE;
1793 }
1794
1795 g_free(current_xpath);
1796 }
1797
1798 if(current_start_xpath_result != NULL){
1799 g_list_free(current_start_xpath_result);
1800 }
1801
1802 /* check UI plugin */
1803 current_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/extensions/ui#gtkui>']";
1804
1805 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1806 current_xpath,
1807 (xmlNode *) current);
1808
1809 if(current_start_xpath_result != NULL){
1810 is_ui_plugin = TRUE;
1811 }else if(prefix_id_lv2ui != NULL){
1812 gchar *prefix_id;
1813
1814 prefix_id = prefix_id_lv2ui;
1815
1816 current_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
1817 prefix_id,
1818 "gtkui");
1819
1820 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1821 current_xpath,
1822 (xmlNode *) current);
1823
1824 if(current_start_xpath_result != NULL){
1825 is_ui_plugin = TRUE;
1826 }
1827
1828 g_free(current_xpath);
1829 }
1830
1831 if(current_start_xpath_result != NULL){
1832 g_list_free(current_start_xpath_result);
1833 }
1834
1835 /* check preset */
1836 current_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/ext/presets#preset>']";
1837
1838 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1839 current_xpath,
1840 (xmlNode *) current);
1841
1842 if(current_start_xpath_result != NULL){
1843 is_preset = TRUE;
1844 }else if(prefix_id_lv2p != NULL){
1845 gchar *prefix_id;
1846
1847 prefix_id = prefix_id_lv2p;
1848
1849 current_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
1850 prefix_id,
1851 "preset");
1852
1853 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1854 current_xpath,
1855 (xmlNode *) current);
1856
1857 if(current_start_xpath_result != NULL){
1858 is_preset = TRUE;
1859 }
1860
1861 g_free(current_xpath);
1862 }
1863
1864 if(current_start_xpath_result != NULL){
1865 g_list_free(current_start_xpath_result);
1866 }
1867
1868 /* iterate */
1869 xpath_result = xpath_result->next;
1870 }
1871
1872 g_list_free(start_xpath_result);
1873
1874 /* plugin create instance */
1875 if(is_plugin){
1876 GList *list;
1877
1878 g_rec_mutex_lock(lv2_manager_mutex);
1879
1880 list = ags_lv2_plugin_find_uri(lv2_manager->lv2_plugin,
1881 subject_iriref);
1882
1883 g_rec_mutex_unlock(lv2_manager_mutex);
1884
1885 if(list != NULL){
1886 lv2_plugin = list->data;
1887 g_object_set(lv2_turtle_parser,
1888 "plugin", lv2_plugin,
1889 NULL);
1890
1891 #if AGS_DEBUG
1892 g_message("found lv2 plugin - %s", subject_iriref);
1893 #endif
1894 }
1895
1896 if(lv2_plugin == NULL){
1897 AgsUUID *current_uuid;
1898
1899 xmlNode *node_binary;
1900
1901 gchar *path;
1902 gchar *so_filename;
1903 gchar *filename;
1904
1905 current_uuid = ags_uuid_alloc();
1906 ags_uuid_generate(current_uuid);
1907
1908 /* so filename */
1909 node_binary = NULL;
1910
1911 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#binary>']";
1912
1913 xpath_result =
1914 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1915 xpath,
1916 (xmlNode *) node);
1917
1918 if(xpath_result != NULL){
1919 node_binary = ((xmlNode *) xpath_result->data)->parent->parent->parent->next;
1920 }else if(prefix_id_lv2_core != NULL){
1921 gchar *prefix_id;
1922
1923 prefix_id = prefix_id_lv2_core;
1924
1925 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
1926 prefix_id,
1927 "binary");
1928
1929 xpath_result =
1930 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1931 xpath,
1932 (xmlNode *) node);
1933
1934 g_free(xpath);
1935
1936 if(xpath_result != NULL){
1937 node_binary = ((xmlNode *) xpath_result->data)->parent->parent->parent->parent->next;
1938 }
1939 }
1940
1941 g_list_free(start_xpath_result);
1942
1943 path = g_path_get_dirname(turtle[0]->filename);
1944 so_filename = NULL;
1945
1946 if(node_binary != NULL){
1947 xmlNode *current;
1948
1949 GList *current_start_xpath_result, *current_xpath_result;
1950
1951 gchar *current_xpath;
1952
1953 current_xpath = "./rdf-object/rdf-iri/rdf-iriref";
1954
1955 current_xpath_result =
1956 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
1957 current_xpath,
1958 (xmlNode *) node_binary);
1959
1960 if(current_start_xpath_result != NULL){
1961 gchar *str;
1962
1963 str = xmlNodeGetContent(current_start_xpath_result->data);
1964
1965 if(str != NULL){
1966 if(strlen(str) > 2){
1967 so_filename = g_strndup(str + 1,
1968 strlen(str) - 2);
1969 }
1970
1971 xmlFree(str);
1972 }
1973 }
1974
1975 g_list_free(current_start_xpath_result);
1976 }
1977
1978 filename = NULL;
1979
1980 if(path != NULL &&
1981 so_filename != NULL){
1982 filename = g_strdup_printf("%s%c%s",
1983 path,
1984 G_DIR_SEPARATOR,
1985 so_filename);
1986 }
1987
1988 #if AGS_DEBUG
1989 g_message("new lv2 plugin - %s", subject_iriref);
1990 #endif
1991
1992 lv2_plugin = g_object_new(AGS_TYPE_LV2_PLUGIN,
1993 "uuid", current_uuid,
1994 "filename", filename,
1995 "uri", subject_iriref,
1996 NULL);
1997
1998 if(ags_lv2_manager_global_get_preserve_turtle()){
1999 g_object_set(lv2_plugin,
2000 "manifest", turtle[0],
2001 "turtle", turtle[n_turtle - 1],
2002 NULL);
2003 }
2004
2005 g_rec_mutex_lock(lv2_manager_mutex);
2006
2007 lv2_manager->lv2_plugin = g_list_prepend(lv2_manager->lv2_plugin,
2008 lv2_plugin);
2009
2010 g_rec_mutex_unlock(lv2_manager_mutex);
2011
2012 g_object_set(lv2_turtle_parser,
2013 "plugin", lv2_plugin,
2014 NULL);
2015
2016 g_free(filename);
2017 }
2018
2019 if(lv2_plugin == NULL){
2020 g_warning("no plugin");
2021 }
2022 }
2023
2024 if(is_instrument){
2025 ags_base_plugin_set_flags(lv2_plugin,
2026 AGS_BASE_PLUGIN_IS_INSTRUMENT);
2027
2028 ags_lv2_plugin_set_flags(lv2_plugin,
2029 AGS_LV2_PLUGIN_IS_SYNTHESIZER);
2030 }
2031
2032 if(is_ui_plugin){
2033 GList *list;
2034
2035 g_rec_mutex_lock(lv2ui_manager_mutex);
2036
2037 list = ags_lv2ui_plugin_find_gui_uri(lv2ui_manager->lv2ui_plugin,
2038 subject_iriref);
2039
2040 g_rec_mutex_unlock(lv2ui_manager_mutex);
2041
2042 if(list != NULL){
2043 lv2ui_plugin = list->data;
2044 g_object_set(lv2_turtle_parser,
2045 "ui-plugin", lv2ui_plugin,
2046 NULL);
2047 }
2048
2049 if(lv2ui_plugin == NULL){
2050 AgsUUID *current_uuid;
2051
2052 xmlNode *node_binary;
2053
2054 gchar *path;
2055 gchar *so_filename;
2056 gchar *filename;
2057
2058 current_uuid = ags_uuid_alloc();
2059 ags_uuid_generate(current_uuid);
2060
2061 /* so filename */
2062 node_binary = NULL;
2063
2064 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/extensions/ui#binary>']";
2065
2066 xpath_result =
2067 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2068 xpath,
2069 (xmlNode *) node);
2070
2071 if(xpath_result != NULL){
2072 node_binary = ((xmlNode *) xpath_result->data)->parent->parent->parent->next;
2073 }else if(prefix_id_lv2ui != NULL){
2074 gchar *prefix_id;
2075
2076 prefix_id = prefix_id_lv2ui;
2077
2078 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2079 prefix_id,
2080 "binary");
2081
2082 xpath_result =
2083 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2084 xpath,
2085 (xmlNode *) node);
2086
2087 g_free(xpath);
2088
2089 if(xpath_result != NULL){
2090 node_binary = ((xmlNode *) xpath_result->data)->parent->parent->parent->parent->next;
2091 }
2092 }
2093
2094 g_list_free(start_xpath_result);
2095
2096 path = g_path_get_dirname(turtle[0]->filename);
2097 so_filename = NULL;
2098
2099 if(node_binary != NULL){
2100 xmlNode *current;
2101
2102 GList *current_start_xpath_result, *current_xpath_result;
2103
2104 gchar *current_xpath;
2105
2106 current_xpath = "./rdf-object/rdf-iri/rdf-iriref";
2107
2108 current_xpath_result =
2109 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2110 current_xpath,
2111 (xmlNode *) node_binary);
2112
2113 if(current_start_xpath_result != NULL){
2114 gchar *str;
2115
2116 str = xmlNodeGetContent(current_start_xpath_result->data);
2117
2118 if(str != NULL){
2119 if(strlen(str) > 2){
2120 so_filename = g_strndup(str + 1,
2121 strlen(str) - 2);
2122 }
2123
2124 xmlFree(str);
2125 }
2126 }
2127
2128 g_list_free(current_start_xpath_result);
2129 }
2130
2131 filename = g_strdup_printf("%s%c%s",
2132 path,
2133 G_DIR_SEPARATOR,
2134 so_filename);
2135
2136 #if AGS_DEBUG
2137 g_message("new lv2ui plugin - %s", subject_iriref);
2138 #endif
2139
2140 lv2ui_plugin = g_object_new(AGS_TYPE_LV2UI_PLUGIN,
2141 "uuid", current_uuid,
2142 "ui-filename", filename,
2143 "gui-uri", subject_iriref,
2144 NULL);
2145
2146 g_rec_mutex_lock(lv2ui_manager_mutex);
2147
2148 lv2ui_manager->lv2ui_plugin = g_list_prepend(lv2ui_manager->lv2ui_plugin,
2149 lv2ui_plugin);
2150
2151 g_rec_mutex_unlock(lv2ui_manager_mutex);
2152
2153 if(ags_lv2_manager_global_get_preserve_turtle()){
2154 g_object_set(lv2ui_plugin,
2155 "manifest", turtle[0],
2156 "gui-turtle", turtle[n_turtle - 1],
2157 NULL);
2158 }
2159
2160 g_object_set(lv2_turtle_parser,
2161 "ui-plugin", lv2ui_plugin,
2162 NULL);
2163
2164 g_free(filename);
2165 }
2166 }
2167
2168 if(is_preset){
2169 GList *list;
2170
2171 list = ags_lv2_preset_find_preset_uri(lv2_preset_manager->lv2_preset,
2172 subject_iriref);
2173
2174 if(list != NULL){
2175 lv2_preset = AGS_LV2_PRESET(list->data);
2176 g_object_set(lv2_turtle_parser,
2177 "preset", lv2_preset,
2178 NULL);
2179 }
2180
2181 if(lv2_preset == NULL){
2182 #if AGS_DEBUG
2183 g_message("new lv2 preset - %s", subject_iriref);
2184 #endif
2185
2186 lv2_preset = g_object_new(AGS_TYPE_LV2_PRESET,
2187 "uri", subject_iriref,
2188 NULL);
2189 lv2_preset_manager->lv2_preset = g_list_prepend(lv2_preset_manager->lv2_preset,
2190 lv2_preset);
2191
2192
2193 if(ags_lv2_manager_global_get_preserve_turtle()){
2194 g_object_set(lv2_preset,
2195 "manifest", turtle[0],
2196 "turtle", turtle[n_turtle - 1],
2197 NULL);
2198 }
2199
2200 g_object_set(lv2_turtle_parser,
2201 "preset", lv2_preset,
2202 NULL);
2203 }
2204
2205 if(lv2_preset == NULL){
2206 g_critical("preset not found %s", subject_iriref);
2207 }
2208 }
2209
2210 /* plugin - read metadata */
2211 if(is_plugin){
2212 xmlNode *current;
2213
2214 GList *current_start_xpath_result, *current_xpath_result;
2215
2216 gchar *current_xpath;
2217
2218 /* effect */
2219 current = NULL;
2220
2221 current_xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://usefulinc.com/ns/doap#name>']";
2222
2223 current_xpath_result =
2224 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2225 current_xpath,
2226 (xmlNode *) node);
2227
2228 if(current_start_xpath_result != NULL){
2229 current = ((xmlNode *) current_start_xpath_result->data)->parent->parent->parent->next;
2230 }else if(prefix_id_doap != NULL){
2231 gchar *prefix_id;
2232
2233 prefix_id = prefix_id_doap;
2234
2235 current_xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2236 prefix_id,
2237 "name");
2238
2239 current_xpath_result =
2240 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2241 current_xpath,
2242 (xmlNode *) node);
2243
2244 g_free(current_xpath);
2245
2246 if(current_start_xpath_result != NULL){
2247 current = ((xmlNode *) current_start_xpath_result->data)->parent->parent->parent->parent->next;
2248 }
2249 }
2250
2251 g_list_free(current_start_xpath_result);
2252
2253 if(current != NULL){
2254 GList *start_label_xpath_result, *label_xpath_result;
2255
2256 gchar *label_xpath;
2257
2258 label_xpath = "./rdf-object/rdf-literal/rdf-string";
2259
2260 label_xpath_result =
2261 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2262 label_xpath,
2263 (xmlNode *) current);
2264
2265 if(start_label_xpath_result != NULL){
2266 gchar *str;
2267
2268 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
2269
2270 if(str != NULL){
2271 if(strlen(str) > 2){
2272 gchar *tmp;
2273
2274 tmp = NULL;
2275
2276 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
2277 tmp = g_strndup(str + 3,
2278 (gsize) (strlen(str) - 6));
2279 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
2280 tmp = g_strndup(str + 3,
2281 (gsize) (strlen(str) - 6));
2282 }else if(str[0] = '"'){
2283 tmp = g_strndup(str + 1,
2284 (gsize) (strlen(str) - 2));
2285 }else if(str[0] == '\''){
2286 tmp = g_strndup(str + 1,
2287 (gsize) (strlen(str) - 2));
2288 }
2289
2290 #if AGS_DEBUG
2291 g_message(" `-- effect %s", str);
2292 #endif
2293
2294 g_object_set(lv2_plugin,
2295 "effect", tmp,
2296 NULL);
2297
2298 g_free(tmp);
2299 }
2300
2301 xmlFree(str);
2302 }
2303 }
2304
2305 g_list_free(start_label_xpath_result);
2306 }
2307
2308 /* ui */
2309 current = NULL;
2310
2311 current_xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/extensions/ui#ui>']";
2312
2313 current_xpath_result =
2314 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2315 current_xpath,
2316 (xmlNode *) node);
2317
2318 if(current_start_xpath_result != NULL){
2319 current = ((xmlNode *) current_start_xpath_result->data)->parent->parent->parent->next;
2320 }else if(prefix_id_doap != NULL){
2321 gchar *prefix_id;
2322
2323 prefix_id = prefix_id_lv2ui;
2324
2325 current_xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2326 prefix_id,
2327 "ui");
2328
2329 current_xpath_result =
2330 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2331 current_xpath,
2332 (xmlNode *) node);
2333
2334 g_free(current_xpath);
2335
2336 if(current_start_xpath_result != NULL){
2337 current = ((xmlNode *) current_start_xpath_result->data)->parent->parent->parent->parent->next;
2338 }
2339 }
2340
2341 g_list_free(current_start_xpath_result);
2342
2343 if(current != NULL){
2344 GList *start_label_xpath_result, *label_xpath_result;
2345
2346 gchar *label_xpath;
2347
2348 label_xpath = "./rdf-object/rdf-iri/rdf-iriref";
2349
2350 label_xpath_result =
2351 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2352 label_xpath,
2353 (xmlNode *) current);
2354
2355 if(start_label_xpath_result != NULL){
2356 gchar *str;
2357
2358 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
2359
2360 if(str != NULL){
2361 if(strlen(str) > 2){
2362 gchar *tmp;
2363
2364 #if AGS_DEBUG
2365 g_message(" `-- ui %s", str);
2366 #endif
2367
2368 tmp = g_strndup(str + 1,
2369 strlen(str) - 2);
2370
2371 g_object_set(lv2_plugin,
2372 "ui-uri", tmp,
2373 NULL);
2374
2375 g_free(tmp);
2376 }
2377
2378 xmlFree(str);
2379 }
2380 }
2381
2382 g_list_free(start_label_xpath_result);
2383 }
2384
2385 /* worker */
2386 current = NULL;
2387
2388 current_xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#requiredfeature>']";
2389
2390 current_xpath_result =
2391 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2392 current_xpath,
2393 (xmlNode *) node);
2394
2395 if(current_start_xpath_result != NULL){
2396 current = ((xmlNode *) current_start_xpath_result->data)->parent->parent->parent->next;
2397 }else if(prefix_id_doap != NULL){
2398 gchar *prefix_id;
2399
2400 prefix_id = prefix_id_lv2_core;
2401
2402 current_xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2403 prefix_id,
2404 "requiredfeature");
2405
2406 current_xpath_result =
2407 current_start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2408 current_xpath,
2409 (xmlNode *) node);
2410
2411 g_free(current_xpath);
2412
2413 if(current_start_xpath_result != NULL){
2414 current = ((xmlNode *) current_start_xpath_result->data)->parent->parent->parent->parent->next;
2415 }
2416 }
2417
2418 g_list_free(current_start_xpath_result);
2419
2420 if(current != NULL){
2421 GList *start_worker_xpath_result, *worker_xpath_result;
2422
2423 gchar *worker_xpath;
2424
2425 worker_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = 'http://lv2plug.in/ns/ext/worker#schedule']";
2426
2427 worker_xpath_result =
2428 start_worker_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2429 worker_xpath,
2430 (xmlNode *) current);
2431
2432 if(start_worker_xpath_result != NULL){
2433 ags_lv2_plugin_set_flags(lv2_plugin,
2434 AGS_LV2_PLUGIN_NEEDS_WORKER);
2435 }else if(prefix_id_lv2_worker != NULL){
2436 gchar *prefix_id;
2437
2438 prefix_id = prefix_id_lv2_worker;
2439
2440 xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2441 prefix_id,
2442 "schedule");
2443
2444 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2445 xpath,
2446 (xmlNode *) current);
2447
2448 if(start_xpath_result != NULL){
2449 ags_lv2_plugin_set_flags(lv2_plugin,
2450 AGS_LV2_PLUGIN_NEEDS_WORKER);
2451
2452 }
2453
2454 g_list_free(start_xpath_result);
2455
2456 g_free(xpath);
2457 }
2458
2459 g_list_free(start_worker_xpath_result);
2460 }
2461
2462 /* name */
2463 current = NULL;
2464
2465 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://xmlns.com/foaf/0.1/#name>']";
2466
2467 xpath_result =
2468 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2469 xpath,
2470 (xmlNode *) node);
2471
2472 if(start_xpath_result != NULL){
2473 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
2474 }else if(prefix_id_foaf != NULL){
2475 gchar *prefix_id;
2476
2477 prefix_id = prefix_id_foaf;
2478
2479 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2480 prefix_id,
2481 "name");
2482
2483 xpath_result =
2484 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2485 xpath,
2486 (xmlNode *) node);
2487
2488 g_free(xpath);
2489
2490 if(start_xpath_result != NULL){
2491 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
2492 }
2493 }
2494
2495 g_list_free(start_xpath_result);
2496
2497 if(current != NULL){
2498 GList *start_label_xpath_result, *label_xpath_result;
2499
2500 gchar *label_xpath;
2501
2502 label_xpath = "./rdf-object/rdf-literal/rdf-string";
2503
2504 label_xpath_result =
2505 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2506 label_xpath,
2507 (xmlNode *) current);
2508
2509 if(start_label_xpath_result != NULL){
2510 gchar *str;
2511
2512 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
2513
2514 if(str != NULL){
2515 gchar *tmp;
2516
2517 tmp = NULL;
2518
2519 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
2520 tmp = g_strndup(str + 3,
2521 (gsize) (strlen(str) - 6));
2522 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
2523 tmp = g_strndup(str + 3,
2524 (gsize) (strlen(str) - 6));
2525 }else if(str[0] = '"'){
2526 tmp = g_strndup(str + 1,
2527 (gsize) (strlen(str) - 2));
2528 }else if(str[0] == '\''){
2529 tmp = g_strndup(str + 1,
2530 (gsize) (strlen(str) - 2));
2531 }
2532
2533 g_object_set(lv2_plugin,
2534 "foaf-name", tmp,
2535 NULL);
2536
2537 g_free(tmp);
2538
2539 xmlFree(str);
2540 }
2541 }
2542
2543 g_list_free(start_label_xpath_result);
2544 }
2545
2546 /* homepage */
2547 current = NULL;
2548
2549 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://xmlns.com/foaf/0.1/#homepage>']";
2550
2551 xpath_result =
2552 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2553 xpath,
2554 (xmlNode *) node);
2555
2556 if(start_xpath_result != NULL){
2557 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
2558 }else if(prefix_id_foaf != NULL){
2559 gchar *prefix_id;
2560
2561 prefix_id = prefix_id_foaf;
2562
2563 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2564 prefix_id,
2565 "homepage");
2566
2567 xpath_result =
2568 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2569 xpath,
2570 (xmlNode *) node);
2571
2572 g_free(xpath);
2573
2574 if(start_xpath_result != NULL){
2575 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
2576 }
2577 }
2578
2579 g_list_free(start_xpath_result);
2580
2581 if(current != NULL){
2582 GList *start_label_xpath_result, *label_xpath_result;
2583
2584 gchar *label_xpath;
2585
2586 label_xpath = "./rdf-object/rdf-iri/rdf-iriref";
2587
2588 label_xpath_result =
2589 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2590 label_xpath,
2591 (xmlNode *) current);
2592
2593 if(start_label_xpath_result != NULL){
2594 gchar *str;
2595
2596 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
2597
2598 if(str != NULL){
2599 g_object_set(lv2_plugin,
2600 "foaf-homepage", str,
2601 NULL);
2602
2603 xmlFree(str);
2604 }
2605 }
2606
2607 g_list_free(start_label_xpath_result);
2608 }
2609
2610 /* mbox */
2611 current = NULL;
2612
2613 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://xmlns.com/foaf/0.1/#mbox>']";
2614
2615 xpath_result =
2616 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2617 xpath,
2618 (xmlNode *) node);
2619
2620 if(start_xpath_result != NULL){
2621 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
2622 }else if(prefix_id_foaf != NULL){
2623 gchar *prefix_id;
2624
2625 prefix_id = prefix_id_foaf;
2626
2627 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2628 prefix_id,
2629 "mbox");
2630
2631 xpath_result =
2632 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2633 xpath,
2634 (xmlNode *) node);
2635
2636 g_free(xpath);
2637
2638 if(start_xpath_result != NULL){
2639 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
2640 }
2641 }
2642
2643 g_list_free(start_xpath_result);
2644
2645 if(current != NULL){
2646 GList *start_label_xpath_result, *label_xpath_result;
2647
2648 gchar *label_xpath;
2649
2650 label_xpath = "./rdf-object/rdf-iri/rdf-iriref";
2651
2652 label_xpath_result =
2653 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2654 label_xpath,
2655 (xmlNode *) current);
2656
2657 if(start_label_xpath_result != NULL){
2658 gchar *str;
2659
2660 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
2661
2662 if(str != NULL){
2663 g_object_set(lv2_plugin,
2664 "foaf-mbox", str,
2665 NULL);
2666
2667 xmlFree(str);
2668 }
2669 }
2670
2671 g_list_free(start_label_xpath_result);
2672 }
2673 }
2674
2675 /* plugin - read ports */
2676 if(is_plugin){
2677 xmlNode *current;
2678
2679 gboolean is_pname;
2680
2681 current = NULL;
2682
2683 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#port>']";
2684
2685 xpath_result =
2686 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2687 xpath,
2688 (xmlNode *) node);
2689
2690 is_pname = FALSE;
2691
2692 if(start_xpath_result != NULL){
2693 is_pname = FALSE;
2694 }else if(prefix_id_lv2_core != NULL){
2695 gchar *prefix_id;
2696
2697 prefix_id = prefix_id_lv2_core;
2698
2699 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2700 prefix_id,
2701 "port");
2702
2703 xpath_result =
2704 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2705 xpath,
2706 (xmlNode *) node);
2707
2708 g_free(xpath);
2709
2710 if(start_xpath_result != NULL){
2711 is_pname = TRUE;
2712 }
2713 }
2714
2715 if(xpath_result != NULL){
2716 if(!is_pname){
2717 current = ((xmlNode *) xpath_result->data)->parent->parent->parent->next;
2718 }else{
2719 current = ((xmlNode *) xpath_result->data)->parent->parent->parent->parent->next;
2720 }
2721
2722 while(current != NULL){
2723 if(!g_ascii_strncasecmp(current->name,
2724 "rdf-object-list",
2725 16)){
2726 xmlNode *current_child;
2727
2728 GList *current_child_start_xpath_result, *current_child_xpath_result;
2729
2730 gchar *current_child_xpath;
2731
2732 current_child = NULL;
2733
2734 if(current != NULL){
2735 current_child = current->children;
2736 }
2737
2738 while(current_child != NULL){
2739 if(current_child->type == XML_ELEMENT_NODE){
2740 if(!g_ascii_strncasecmp(current_child->name,
2741 "rdf-object",
2742 12)){
2743 AgsPluginPort *plugin_port;
2744
2745 xmlNode *current_predicate;
2746
2747 GList *start_port_predicate_xpath_result, *port_predicate_xpath_result;
2748 GList *start_property_xpath_result, *property_xpath_result;
2749
2750 gchar *port_predicate_xpath;
2751 gchar *property_xpath;
2752
2753 guint port_index;
2754 gboolean is_audio_port, is_control_port;
2755 gboolean is_atom_port, is_event_port;
2756 gboolean is_output_port, is_input_port;
2757 guint scale_point_count;
2758 gboolean scale_point_has_pname;
2759
2760 is_audio_port = FALSE;
2761 is_control_port = FALSE;
2762
2763 is_atom_port = FALSE;
2764 is_event_port = FALSE;
2765
2766 is_output_port = FALSE;
2767 is_input_port = FALSE;
2768
2769 /* port index */
2770 plugin_port = NULL;
2771 port_index = 0;
2772
2773 current_predicate = NULL;
2774
2775 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#index>']";
2776
2777 port_predicate_xpath_result =
2778 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2779 port_predicate_xpath,
2780 (xmlNode *) current_child);
2781
2782 if(start_port_predicate_xpath_result != NULL){
2783 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
2784 }else if(prefix_id_lv2_core != NULL){
2785 gchar *prefix_id;
2786
2787 prefix_id = prefix_id_lv2_core;
2788
2789 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2790 prefix_id,
2791 "index");
2792
2793 port_predicate_xpath_result =
2794 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2795 port_predicate_xpath,
2796 (xmlNode *) current_child);
2797
2798 g_free(port_predicate_xpath);
2799
2800 if(start_port_predicate_xpath_result != NULL){
2801 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
2802 }
2803 }
2804
2805 g_list_free(start_port_predicate_xpath_result);
2806
2807 if(current_predicate != NULL){
2808 GList *start_value_xpath_result, *value_xpath_result;
2809
2810 gchar *value_xpath;
2811
2812 value_xpath = "./rdf-object/rdf-literal/rdf-numeric";
2813
2814 value_xpath_result =
2815 start_value_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2816 value_xpath,
2817 (xmlNode *) current_predicate);
2818
2819 if(start_value_xpath_result != NULL){
2820 gchar *str;
2821
2822 str = xmlNodeGetContent((xmlNode *) start_value_xpath_result->data);
2823
2824 if(str != NULL){
2825 GList *start_list, *list;
2826
2827 port_index = g_ascii_strtoull(str,
2828 NULL,
2829 10);
2830 xmlFree(str);
2831
2832 g_object_get(lv2_plugin,
2833 "plugin-port", &start_list,
2834 NULL);
2835
2836 list = ags_plugin_port_find_port_index(start_list,
2837 port_index);
2838
2839 if(list != NULL){
2840 #if AGS_DEBUG
2841 g_message("found LV2 plugin port");
2842 #endif
2843
2844 plugin_port = list->data;
2845 g_object_ref(plugin_port);
2846
2847 g_list_free_full(start_list,
2848 g_object_unref);
2849 }
2850 }
2851 }
2852
2853 g_list_free(start_value_xpath_result);
2854 }
2855
2856 if(plugin_port == NULL){
2857 #if AGS_DEBUG
2858 g_message("new LV2 plugin port");
2859 #endif
2860
2861 /* add plugin port */
2862 plugin_port = ags_plugin_port_new();
2863 g_object_set(plugin_port,
2864 "port-index", port_index,
2865 NULL);
2866
2867 g_object_set(lv2_plugin,
2868 "plugin-port", plugin_port,
2869 NULL);
2870
2871 /* init range value */
2872 g_value_init(plugin_port->upper_value,
2873 G_TYPE_FLOAT);
2874 g_value_init(plugin_port->lower_value,
2875 G_TYPE_FLOAT);
2876 g_value_init(plugin_port->default_value,
2877 G_TYPE_FLOAT);
2878
2879 /* init range */
2880 g_value_set_float(plugin_port->upper_value,
2881 0.0);
2882 g_value_set_float(plugin_port->lower_value,
2883 0.0);
2884 g_value_set_float(plugin_port->default_value,
2885 0.0);
2886 }
2887
2888 /* port type */
2889 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb[@verb = 'a']";
2890
2891 port_predicate_xpath_result =
2892 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2893 port_predicate_xpath,
2894 (xmlNode *) current_child);
2895
2896 while(port_predicate_xpath_result != NULL){
2897 xmlNode *node_port_type;
2898
2899 GList *start_port_type_xpath_result, *port_type_xpath_result;
2900
2901 gchar *port_type_xpath;
2902
2903 node_port_type = ((xmlNode *) port_predicate_xpath_result->data)->next;
2904
2905 /* check audio port */
2906 port_type_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#audioport>']";
2907
2908 port_type_xpath_result =
2909 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2910 port_type_xpath,
2911 (xmlNode *) node_port_type);
2912
2913 if(start_port_type_xpath_result != NULL){
2914 is_audio_port = TRUE;
2915 }else if(prefix_id_lv2_core != NULL){
2916 gchar *prefix_id;
2917
2918 prefix_id = prefix_id_lv2_core;
2919
2920 port_type_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2921 prefix_id,
2922 "audioport");
2923
2924 port_type_xpath_result =
2925 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2926 port_type_xpath,
2927 (xmlNode *) node_port_type);
2928
2929 g_free(port_type_xpath);
2930
2931 if(start_port_type_xpath_result != NULL){
2932 is_audio_port = TRUE;
2933 }
2934 }
2935
2936 g_list_free(start_port_type_xpath_result);
2937
2938 /* check control port */
2939 port_type_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#controlport>']";
2940
2941 port_type_xpath_result =
2942 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2943 port_type_xpath,
2944 (xmlNode *) node_port_type);
2945
2946 if(start_port_type_xpath_result != NULL){
2947 is_control_port = TRUE;
2948 }else if(prefix_id_lv2_core != NULL){
2949 gchar *prefix_id;
2950
2951 prefix_id = prefix_id_lv2_core;
2952
2953 port_type_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2954 prefix_id,
2955 "controlport");
2956
2957 port_type_xpath_result =
2958 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2959 port_type_xpath,
2960 (xmlNode *) node_port_type);
2961
2962 g_free(port_type_xpath);
2963
2964 if(start_port_type_xpath_result != NULL){
2965 is_control_port = TRUE;
2966 }
2967 }
2968
2969 g_list_free(start_port_type_xpath_result);
2970
2971 /* check atom port */
2972 port_type_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/ext/atom#atomport>']";
2973
2974 port_type_xpath_result =
2975 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2976 port_type_xpath,
2977 (xmlNode *) node_port_type);
2978
2979 if(start_port_type_xpath_result != NULL){
2980 is_atom_port = TRUE;
2981 }else if(prefix_id_lv2_atom != NULL){
2982 gchar *prefix_id;
2983
2984 prefix_id = prefix_id_lv2_atom;
2985
2986 port_type_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
2987 prefix_id,
2988 "atomport");
2989
2990 port_type_xpath_result =
2991 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
2992 port_type_xpath,
2993 (xmlNode *) node_port_type);
2994
2995 g_free(port_type_xpath);
2996
2997 if(start_port_type_xpath_result != NULL){
2998 is_atom_port = TRUE;
2999 }
3000 }
3001
3002 g_list_free(start_port_type_xpath_result);
3003
3004 /* check event port */
3005 port_type_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#eventport>']";
3006
3007 port_type_xpath_result =
3008 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3009 port_type_xpath,
3010 (xmlNode *) node_port_type);
3011
3012 if(start_port_type_xpath_result != NULL){
3013 is_event_port = TRUE;
3014 }else if(prefix_id_lv2_core != NULL){
3015 gchar *prefix_id;
3016
3017 prefix_id = prefix_id_lv2_core;
3018
3019 port_type_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3020 prefix_id,
3021 "eventport");
3022
3023 port_type_xpath_result =
3024 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3025 port_type_xpath,
3026 (xmlNode *) node_port_type);
3027
3028 g_free(port_type_xpath);
3029
3030 if(start_port_type_xpath_result != NULL){
3031 is_event_port = TRUE;
3032 }
3033 }
3034
3035 g_list_free(start_port_type_xpath_result);
3036
3037 /* check output port */
3038 port_type_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#outputport>']";
3039
3040 port_type_xpath_result =
3041 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3042 port_type_xpath,
3043 (xmlNode *) node_port_type);
3044
3045 if(start_port_type_xpath_result != NULL){
3046 is_output_port = TRUE;
3047 }else if(prefix_id_lv2_core != NULL){
3048 gchar *prefix_id;
3049
3050 prefix_id = prefix_id_lv2_core;
3051
3052 port_type_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3053 prefix_id,
3054 "outputport");
3055
3056 port_type_xpath_result =
3057 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3058 port_type_xpath,
3059 (xmlNode *) node_port_type);
3060
3061 g_free(port_type_xpath);
3062
3063 if(start_port_type_xpath_result != NULL){
3064 is_output_port = TRUE;
3065 }
3066 }
3067
3068 g_list_free(start_port_type_xpath_result);
3069
3070 /* check input port */
3071 port_type_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#inputport>']";
3072
3073 port_type_xpath_result =
3074 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3075 port_type_xpath,
3076 (xmlNode *) node_port_type);
3077
3078 if(start_port_type_xpath_result != NULL){
3079 is_input_port = TRUE;
3080 }else if(prefix_id_lv2_core != NULL){
3081 gchar *prefix_id;
3082
3083 prefix_id = prefix_id_lv2_core;
3084
3085 port_type_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3086 prefix_id,
3087 "inputport");
3088
3089 port_type_xpath_result =
3090 start_port_type_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3091 port_type_xpath,
3092 (xmlNode *) node_port_type);
3093
3094 g_free(port_type_xpath);
3095
3096 if(start_port_type_xpath_result != NULL){
3097 is_input_port = TRUE;
3098 }
3099 }
3100
3101 g_list_free(start_port_type_xpath_result);
3102
3103 /* iterate */
3104 port_predicate_xpath_result = port_predicate_xpath_result->next;
3105 }
3106
3107 g_list_free(start_port_predicate_xpath_result);
3108
3109 /* set flags */
3110 if(is_audio_port){
3111 ags_plugin_port_set_flags(plugin_port,
3112 AGS_PLUGIN_PORT_AUDIO);
3113 }
3114
3115 if(is_atom_port){
3116 ags_plugin_port_set_flags(plugin_port,
3117 AGS_PLUGIN_PORT_ATOM);
3118 }
3119
3120 if(is_event_port){
3121 ags_plugin_port_set_flags(plugin_port,
3122 AGS_PLUGIN_PORT_EVENT);
3123 }
3124
3125 if(is_control_port){
3126 ags_plugin_port_set_flags(plugin_port,
3127 AGS_PLUGIN_PORT_CONTROL);
3128 }
3129
3130 if(is_output_port){
3131 ags_plugin_port_set_flags(plugin_port,
3132 AGS_PLUGIN_PORT_OUTPUT);
3133 }
3134
3135 if(is_input_port){
3136 ags_plugin_port_set_flags(plugin_port,
3137 AGS_PLUGIN_PORT_INPUT);
3138 }
3139
3140 /* port name */
3141 current_predicate = NULL;
3142
3143 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#name>']";
3144
3145 port_predicate_xpath_result =
3146 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3147 port_predicate_xpath,
3148 (xmlNode *) current_child);
3149
3150 if(start_port_predicate_xpath_result != NULL){
3151 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
3152 }else if(prefix_id_lv2_core != NULL){
3153 gchar *prefix_id;
3154
3155 prefix_id = prefix_id_lv2_core;
3156
3157 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3158 prefix_id,
3159 "name");
3160
3161 port_predicate_xpath_result =
3162 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3163 port_predicate_xpath,
3164 (xmlNode *) current_child);
3165
3166 g_free(port_predicate_xpath);
3167
3168 if(start_port_predicate_xpath_result != NULL){
3169 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3170 }
3171 }
3172
3173 g_list_free(start_port_predicate_xpath_result);
3174
3175 if(current_predicate != NULL){
3176 GList *start_value_xpath_result, *value_xpath_result;
3177
3178 gchar *value_xpath;
3179
3180 value_xpath = "./rdf-object/rdf-literal/rdf-string";
3181
3182 value_xpath_result =
3183 start_value_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3184 value_xpath,
3185 (xmlNode *) current_predicate);
3186
3187 if(start_value_xpath_result != NULL){
3188 gchar *str;
3189
3190 str = xmlNodeGetContent((xmlNode *) start_value_xpath_result->data);
3191
3192 if(str != NULL){
3193 if(strlen(str) > 2){
3194 gchar *tmp;
3195
3196 tmp = NULL;
3197
3198 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
3199 tmp = g_strndup(str + 3,
3200 (gsize) (strlen(str) - 6));
3201 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
3202 tmp = g_strndup(str + 3,
3203 (gsize) (strlen(str) - 6));
3204 }else if(str[0] = '"'){
3205 tmp = g_strndup(str + 1,
3206 (gsize) (strlen(str) - 2));
3207 }else if(str[0] == '\''){
3208 tmp = g_strndup(str + 1,
3209 (gsize) (strlen(str) - 2));
3210 }
3211
3212 g_object_set(plugin_port,
3213 "port-name", tmp,
3214 NULL);
3215
3216 g_free(tmp);
3217 }
3218
3219 xmlFree(str);
3220 }
3221 }
3222
3223 g_list_free(start_value_xpath_result);
3224 }
3225
3226 /* port symbol */
3227 current_predicate = NULL;
3228
3229 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#symbol>']";
3230
3231 port_predicate_xpath_result =
3232 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3233 port_predicate_xpath,
3234 (xmlNode *) current_child);
3235
3236 if(start_port_predicate_xpath_result != NULL){
3237 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
3238 }else if(prefix_id_lv2_core != NULL){
3239 gchar *prefix_id;
3240
3241 prefix_id = prefix_id_lv2_core;
3242
3243 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3244 prefix_id,
3245 "symbol");
3246
3247 port_predicate_xpath_result =
3248 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3249 port_predicate_xpath,
3250 (xmlNode *) current_child);
3251
3252 g_free(port_predicate_xpath);
3253
3254 if(start_port_predicate_xpath_result != NULL){
3255 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3256 }
3257 }
3258
3259 g_list_free(start_port_predicate_xpath_result);
3260
3261 if(current_predicate != NULL){
3262 GList *start_value_xpath_result, *value_xpath_result;
3263
3264 gchar *value_xpath;
3265
3266 value_xpath = "./rdf-object/rdf-literal/rdf-string";
3267
3268 value_xpath_result =
3269 start_value_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3270 value_xpath,
3271 (xmlNode *) current_predicate);
3272
3273 if(start_value_xpath_result != NULL){
3274 gchar *str;
3275
3276 str = xmlNodeGetContent((xmlNode *) start_value_xpath_result->data);
3277
3278 if(str != NULL){
3279 if(strlen(str) > 2){
3280 gchar *tmp;
3281
3282 tmp = NULL;
3283
3284 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
3285 tmp = g_strndup(str + 3,
3286 (gsize) (strlen(str) - 6));
3287 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
3288 tmp = g_strndup(str + 3,
3289 (gsize) (strlen(str) - 6));
3290 }else if(str[0] = '"'){
3291 tmp = g_strndup(str + 1,
3292 (gsize) (strlen(str) - 2));
3293 }else if(str[0] == '\''){
3294 tmp = g_strndup(str + 1,
3295 (gsize) (strlen(str) - 2));
3296 }
3297
3298 g_object_set(plugin_port,
3299 "port-symbol", tmp,
3300 NULL);
3301
3302 g_free(tmp);
3303 }
3304
3305 xmlFree(str);
3306 }
3307 }
3308
3309 g_list_free(start_value_xpath_result);
3310 }
3311
3312 /* port property */
3313 current_predicate = NULL;
3314
3315 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#portproperty>']";
3316
3317 port_predicate_xpath_result =
3318 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3319 port_predicate_xpath,
3320 (xmlNode *) current_child);
3321
3322 if(start_port_predicate_xpath_result != NULL){
3323 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
3324 }else if(prefix_id_lv2_core != NULL){
3325 gchar *prefix_id;
3326
3327 prefix_id = prefix_id_lv2_core;
3328
3329 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3330 prefix_id,
3331 "portproperty");
3332
3333 port_predicate_xpath_result =
3334 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3335 port_predicate_xpath,
3336 (xmlNode *) current_child);
3337
3338 g_free(port_predicate_xpath);
3339
3340 if(start_port_predicate_xpath_result != NULL){
3341 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3342 }
3343 }
3344
3345 g_list_free(start_port_predicate_xpath_result);
3346
3347 if(current_predicate != NULL){
3348 /* toggled */
3349 property_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#toggled>']";
3350
3351 property_xpath_result =
3352 start_property_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3353 property_xpath,
3354 (xmlNode *) current_predicate);
3355
3356 if(start_property_xpath_result != NULL){
3357 ags_plugin_port_set_flags(plugin_port,
3358 AGS_PLUGIN_PORT_TOGGLED);
3359 }else if(prefix_id_lv2_core != NULL){
3360 gchar *prefix_id;
3361
3362 prefix_id = prefix_id_lv2_core;
3363
3364 property_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3365 prefix_id,
3366 "toggled");
3367
3368 property_xpath_result =
3369 start_property_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3370 property_xpath,
3371 (xmlNode *) current_predicate);
3372
3373 g_free(property_xpath);
3374
3375 if(start_property_xpath_result != NULL){
3376 ags_plugin_port_set_flags(plugin_port,
3377 AGS_PLUGIN_PORT_TOGGLED);
3378 }
3379 }
3380
3381 g_list_free(start_property_xpath_result);
3382
3383 /* enumeration */
3384 property_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#enumeration>']";
3385
3386 property_xpath_result =
3387 start_property_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3388 property_xpath,
3389 (xmlNode *) current_predicate);
3390
3391 if(start_property_xpath_result != NULL){
3392 ags_plugin_port_set_flags(plugin_port,
3393 AGS_PLUGIN_PORT_ENUMERATION);
3394 }else if(prefix_id_lv2_core != NULL){
3395 gchar *prefix_id;
3396
3397 prefix_id = prefix_id_lv2_core;
3398
3399 property_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3400 prefix_id,
3401 "enumeration");
3402
3403 property_xpath_result =
3404 start_property_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3405 property_xpath,
3406 (xmlNode *) current_predicate);
3407
3408 g_free(property_xpath);
3409
3410 if(start_property_xpath_result != NULL){
3411 ags_plugin_port_set_flags(plugin_port,
3412 AGS_PLUGIN_PORT_ENUMERATION);
3413 }
3414 }
3415
3416 g_list_free(start_property_xpath_result);
3417
3418 /* logarithmic */
3419 property_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/dev/extportinfo#logarithmic>']";
3420
3421 property_xpath_result =
3422 start_property_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3423 property_xpath,
3424 (xmlNode *) current_predicate);
3425
3426 if(start_property_xpath_result != NULL){
3427 ags_plugin_port_set_flags(plugin_port,
3428 AGS_PLUGIN_PORT_LOGARITHMIC);
3429 }else if(prefix_id_lv2_port_info != NULL){
3430 gchar *prefix_id;
3431
3432 prefix_id = prefix_id_lv2_port_info;
3433
3434 property_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3435 prefix_id,
3436 "logarithmic");
3437
3438 property_xpath_result =
3439 start_property_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3440 property_xpath,
3441 (xmlNode *) current_predicate);
3442
3443 g_free(property_xpath);
3444
3445 if(start_property_xpath_result != NULL){
3446 ags_plugin_port_set_flags(plugin_port,
3447 AGS_PLUGIN_PORT_LOGARITHMIC);
3448 }
3449 }
3450
3451 g_list_free(start_property_xpath_result);
3452
3453 /* integer */
3454 property_xpath = "./rdf-object/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#integer>']";
3455
3456 property_xpath_result =
3457 start_property_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3458 property_xpath,
3459 (xmlNode *) current_predicate);
3460
3461 if(start_property_xpath_result != NULL){
3462 ags_plugin_port_set_flags(plugin_port,
3463 AGS_PLUGIN_PORT_INTEGER);
3464 }else if(prefix_id_lv2_core != NULL){
3465 gchar *prefix_id;
3466
3467 prefix_id = prefix_id_lv2_core;
3468
3469 property_xpath = g_strdup_printf("./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3470 prefix_id,
3471 "integer");
3472
3473 property_xpath_result =
3474 start_property_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3475 property_xpath,
3476 (xmlNode *) current_predicate);
3477
3478 g_free(property_xpath);
3479
3480 if(start_property_xpath_result != NULL){
3481 ags_plugin_port_set_flags(plugin_port,
3482 AGS_PLUGIN_PORT_INTEGER);
3483 }
3484 }
3485
3486 g_list_free(start_property_xpath_result);
3487 }
3488
3489 /* default */
3490 current_predicate = NULL;
3491
3492 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#default>']";
3493
3494 port_predicate_xpath_result =
3495 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3496 port_predicate_xpath,
3497 (xmlNode *) current_child);
3498
3499 if(start_port_predicate_xpath_result != NULL){
3500 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
3501 }else if(prefix_id_lv2_core != NULL){
3502 gchar *prefix_id;
3503
3504 prefix_id = prefix_id_lv2_core;
3505
3506 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3507 prefix_id,
3508 "default");
3509
3510 port_predicate_xpath_result =
3511 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3512 port_predicate_xpath,
3513 (xmlNode *) current_child);
3514
3515 g_free(port_predicate_xpath);
3516
3517 if(start_port_predicate_xpath_result != NULL){
3518 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3519 }
3520 }
3521
3522 g_list_free(start_port_predicate_xpath_result);
3523
3524 if(current_predicate != NULL){
3525 GList *start_value_xpath_result, *value_xpath_result;
3526
3527 gchar *value_xpath;
3528
3529 value_xpath = "./rdf-object/rdf-literal/rdf-numeric";
3530
3531 value_xpath_result =
3532 start_value_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3533 value_xpath,
3534 (xmlNode *) current_predicate);
3535
3536 if(start_value_xpath_result != NULL){
3537 gchar *str;
3538
3539 str = xmlNodeGetContent((xmlNode *) start_value_xpath_result->data);
3540
3541 if(str != NULL){
3542 gfloat default_value;
3543
3544 default_value = g_ascii_strtod(str,
3545 NULL);
3546 g_value_set_float(plugin_port->default_value,
3547 default_value);
3548
3549 xmlFree(str);
3550 }
3551 }
3552
3553 g_list_free(start_value_xpath_result);
3554 }
3555
3556 /* minimum */
3557 current_predicate = NULL;
3558
3559 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#minimum>']";
3560
3561 port_predicate_xpath_result =
3562 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3563 port_predicate_xpath,
3564 (xmlNode *) current_child);
3565
3566 if(start_port_predicate_xpath_result != NULL){
3567 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
3568 }else if(prefix_id_lv2_core != NULL){
3569 gchar *prefix_id;
3570
3571 prefix_id = prefix_id_lv2_core;
3572
3573 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3574 prefix_id,
3575 "minimum");
3576
3577 port_predicate_xpath_result =
3578 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3579 port_predicate_xpath,
3580 (xmlNode *) current_child);
3581
3582 g_free(port_predicate_xpath);
3583
3584 if(start_port_predicate_xpath_result != NULL){
3585 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3586 }
3587 }
3588
3589 g_list_free(start_port_predicate_xpath_result);
3590
3591 if(current_predicate != NULL){
3592 GList *start_value_xpath_result, *value_xpath_result;
3593
3594 gchar *value_xpath;
3595
3596 value_xpath = "./rdf-object/rdf-literal/rdf-numeric";
3597
3598 value_xpath_result =
3599 start_value_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3600 value_xpath,
3601 (xmlNode *) current_predicate);
3602
3603 if(start_value_xpath_result != NULL){
3604 gchar *str;
3605
3606 str = xmlNodeGetContent((xmlNode *) start_value_xpath_result->data);
3607
3608 if(str != NULL){
3609 gfloat minimum_value;
3610
3611 minimum_value = g_ascii_strtod(str,
3612 NULL);
3613 g_value_set_float(plugin_port->lower_value,
3614 minimum_value);
3615
3616 xmlFree(str);
3617 }
3618 }
3619
3620 g_list_free(start_value_xpath_result);
3621 }
3622
3623 /* maximum */
3624 current_predicate = NULL;
3625
3626 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#maximum>']";
3627
3628 port_predicate_xpath_result =
3629 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3630 port_predicate_xpath,
3631 (xmlNode *) current_child);
3632
3633 if(start_port_predicate_xpath_result != NULL){
3634 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
3635 }else if(prefix_id_lv2_core != NULL){
3636 gchar *prefix_id;
3637
3638 prefix_id = prefix_id_lv2_core;
3639
3640 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3641 prefix_id,
3642 "maximum");
3643
3644 port_predicate_xpath_result =
3645 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3646 port_predicate_xpath,
3647 (xmlNode *) current_child);
3648
3649 g_free(port_predicate_xpath);
3650
3651 if(start_port_predicate_xpath_result != NULL){
3652 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3653 }
3654 }
3655
3656 g_list_free(start_port_predicate_xpath_result);
3657
3658 if(current_predicate != NULL){
3659 GList *start_value_xpath_result, *value_xpath_result;
3660
3661 gchar *value_xpath;
3662
3663 value_xpath = "./rdf-object/rdf-literal/rdf-numeric";
3664
3665 value_xpath_result =
3666 start_value_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3667 value_xpath,
3668 (xmlNode *) current_predicate);
3669
3670 if(start_value_xpath_result != NULL){
3671 gchar *str;
3672
3673 str = xmlNodeGetContent((xmlNode *) start_value_xpath_result->data);
3674
3675 if(str != NULL){
3676 gfloat maximum_value;
3677
3678 maximum_value = g_ascii_strtod(str,
3679 NULL);
3680 g_value_set_float(plugin_port->upper_value,
3681 maximum_value);
3682
3683 xmlFree(str);
3684 }
3685 }
3686
3687 g_list_free(start_value_xpath_result);
3688 }
3689
3690 /* scale point */
3691 scale_point_has_pname = FALSE;
3692
3693 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#scalepoint>']";
3694
3695 port_predicate_xpath_result =
3696 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3697 port_predicate_xpath,
3698 (xmlNode *) current_child);
3699
3700 if(start_port_predicate_xpath_result != NULL){
3701 //empty
3702 }else if(prefix_id_lv2_core != NULL){
3703 gchar *prefix_id;
3704
3705 prefix_id = prefix_id_lv2_core;
3706
3707 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3708 prefix_id,
3709 "scalepoint");
3710
3711 port_predicate_xpath_result =
3712 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3713 port_predicate_xpath,
3714 (xmlNode *) current_child);
3715
3716 g_free(port_predicate_xpath);
3717
3718 if(start_port_predicate_xpath_result != NULL){
3719 scale_point_has_pname = TRUE;
3720 }
3721 }
3722
3723 for(scale_point_count = 0; port_predicate_xpath_result != NULL; scale_point_count++){
3724 xmlNode *scale_point_predicate;
3725
3726 GList *start_current_predicate_xpath_result, *current_predicate_xpath_result;
3727 GList *start_label_xpath_result, *label_xpath_result;
3728 GList *start_value_xpath_result, *value_xpath_result;
3729
3730 gchar *current_predicate_xpath;
3731 gchar *label_xpath;
3732 gchar *value_xpath;
3733
3734 plugin_port->scale_steps = scale_point_count + 1;
3735
3736 if(plugin_port->scale_point == NULL){
3737 plugin_port->scale_point = (gchar **) malloc(2 * sizeof(gchar *));
3738
3739 plugin_port->scale_point[0] = NULL;
3740 plugin_port->scale_point[1] = NULL;
3741
3742 plugin_port->scale_value = (gdouble *) malloc(1 * sizeof(gdouble));
3743
3744 plugin_port->scale_value[0] = 0.0;
3745 }else{
3746 plugin_port->scale_point = (gchar **) realloc(plugin_port->scale_point,
3747 (scale_point_count + 2) * sizeof(gchar *));
3748
3749 plugin_port->scale_point[scale_point_count] = NULL;
3750 plugin_port->scale_point[scale_point_count + 1] = NULL;
3751
3752 plugin_port->scale_value = (gdouble *) realloc(plugin_port->scale_value,
3753 (scale_point_count + 1) * sizeof(gdouble));
3754
3755 plugin_port->scale_value[scale_point_count] = 0.0;
3756 }
3757
3758 current_predicate = NULL;
3759
3760 if(!scale_point_has_pname){
3761 current_predicate = ((xmlNode *) port_predicate_xpath_result->data)->parent->parent->parent->next;
3762 }else{
3763 current_predicate = ((xmlNode *) port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3764 }
3765
3766 /* label */
3767 scale_point_predicate = NULL;
3768
3769 current_predicate_xpath = "./rdf-object/rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://www.w3.org/2000/01/rdf-schema#label>']";
3770
3771 current_predicate_xpath_result =
3772 start_current_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3773 current_predicate_xpath,
3774 (xmlNode *) current_predicate);
3775
3776 if(start_current_predicate_xpath_result != NULL){
3777 scale_point_predicate = ((xmlNode *) start_current_predicate_xpath_result->data)->parent->parent->parent->next;
3778 }else if(prefix_id_rdfs != NULL){
3779 gchar *prefix_id;
3780
3781 prefix_id = prefix_id_rdfs;
3782
3783 current_predicate_xpath = g_strdup_printf("./rdf-object/rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3784 prefix_id,
3785 "label");
3786
3787 current_predicate_xpath_result =
3788 start_current_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3789 current_predicate_xpath,
3790 (xmlNode *) current_predicate);
3791
3792 g_free(current_predicate_xpath);
3793
3794 if(start_current_predicate_xpath_result != NULL){
3795 scale_point_predicate = ((xmlNode *) start_current_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3796 }
3797 }
3798
3799 g_list_free(start_current_predicate_xpath_result);
3800
3801 if(scale_point_predicate != NULL){
3802 GList *start_label_xpath_result, *label_xpath_result;
3803
3804 gchar *label_xpath;
3805
3806 label_xpath = "./rdf-object/rdf-literal/rdf-string";
3807
3808 label_xpath_result =
3809 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3810 label_xpath,
3811 (xmlNode *) scale_point_predicate);
3812
3813 if(start_label_xpath_result != NULL){
3814 gchar *str;
3815
3816 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
3817
3818 if(str != NULL){
3819 gchar *tmp;
3820
3821 tmp = NULL;
3822
3823 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
3824 tmp = g_strndup(str + 3,
3825 (gsize) (strlen(str) - 6));
3826 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
3827 tmp = g_strndup(str + 3,
3828 (gsize) (strlen(str) - 6));
3829 }else if(str[0] = '"'){
3830 tmp = g_strndup(str + 1,
3831 (gsize) (strlen(str) - 2));
3832 }else if(str[0] == '\''){
3833 tmp = g_strndup(str + 1,
3834 (gsize) (strlen(str) - 2));
3835 }
3836
3837 plugin_port->scale_point[scale_point_count] = tmp;
3838
3839 xmlFree(str);
3840 }
3841 }
3842
3843 g_list_free(start_label_xpath_result);
3844 }
3845
3846 /* value */
3847 scale_point_predicate = NULL;
3848
3849 current_predicate_xpath = "./rdf-object/rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://www.w3.org/1999/02/22-rdf-syntax-ns#value>']";
3850
3851 current_predicate_xpath_result =
3852 start_current_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3853 current_predicate_xpath,
3854 (xmlNode *) current_predicate);
3855
3856 if(start_current_predicate_xpath_result != NULL){
3857 scale_point_predicate = ((xmlNode *) start_current_predicate_xpath_result->data)->parent->parent->parent->next;
3858 }else if(prefix_id_rdf != NULL){
3859 gchar *prefix_id;
3860
3861 prefix_id = prefix_id_rdf;
3862
3863 current_predicate_xpath = g_strdup_printf("./rdf-object/rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3864 prefix_id,
3865 "value");
3866
3867 current_predicate_xpath_result =
3868 start_current_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3869 current_predicate_xpath,
3870 (xmlNode *) current_predicate);
3871
3872 g_free(current_predicate_xpath);
3873
3874 if(start_current_predicate_xpath_result != NULL){
3875 scale_point_predicate = ((xmlNode *) start_current_predicate_xpath_result->data)->parent->parent->parent->parent->next;
3876 }
3877 }
3878
3879 g_list_free(start_current_predicate_xpath_result);
3880
3881 if(scale_point_predicate != NULL){
3882 GList *start_label_xpath_result, *label_xpath_result;
3883
3884 gchar *label_xpath;
3885
3886 label_xpath = "./rdf-object/rdf-literal/rdf-string";
3887
3888 label_xpath_result =
3889 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3890 label_xpath,
3891 (xmlNode *) scale_point_predicate);
3892
3893 if(start_label_xpath_result != NULL){
3894 gchar *str;
3895
3896 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
3897
3898 if(str != NULL){
3899 plugin_port->scale_value[scale_point_count] = g_ascii_strtod(str,
3900 NULL);
3901
3902 xmlFree(str);
3903 }
3904 }
3905
3906 g_list_free(start_label_xpath_result);
3907 }
3908
3909 /* iterate */
3910 port_predicate_xpath_result = port_predicate_xpath_result->next;
3911 }
3912
3913 g_list_free(start_port_predicate_xpath_result);
3914
3915 g_object_unref(plugin_port);
3916 }
3917 }
3918
3919 current_child = current_child->next;
3920 }
3921 }
3922
3923 current = current->next;
3924 }
3925
3926 // xpath_result = xpath_result->next;
3927 }
3928
3929 g_list_free(start_xpath_result);
3930 }
3931
3932 if(is_ui_plugin){
3933 //TODO:JK: implement me
3934 }
3935
3936 if(is_preset){
3937 xmlNode *current;
3938
3939 /* label */
3940 current = NULL;
3941
3942 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://www.w3.org/2000/01/rdf-schema#label>']";
3943
3944 xpath_result =
3945 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3946 xpath,
3947 (xmlNode *) node);
3948
3949 if(start_xpath_result != NULL){
3950 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
3951 }else if(prefix_id_rdfs != NULL){
3952 gchar *prefix_id;
3953
3954 prefix_id = prefix_id_rdfs;
3955
3956 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
3957 prefix_id,
3958 "label");
3959
3960 xpath_result =
3961 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3962 xpath,
3963 (xmlNode *) node);
3964
3965 g_free(xpath);
3966
3967 if(start_xpath_result != NULL){
3968 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
3969 }
3970 }
3971
3972 g_list_free(start_xpath_result);
3973
3974 if(current != NULL){
3975 GList *start_label_xpath_result, *label_xpath_result;
3976
3977 gchar *label_xpath;
3978
3979 label_xpath = "./rdf-object/rdf-literal/rdf-string";
3980
3981 label_xpath_result =
3982 start_label_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
3983 label_xpath,
3984 (xmlNode *) current);
3985
3986 if(start_label_xpath_result != NULL){
3987 gchar *str;
3988
3989 str = xmlNodeGetContent((xmlNode *) start_label_xpath_result->data);
3990
3991 if(str != NULL){
3992 if(strlen(str) > 2){
3993 gchar *tmp;
3994
3995 tmp = NULL;
3996
3997 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
3998 tmp = g_strndup(str + 3,
3999 (gsize) (strlen(str) - 6));
4000 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
4001 tmp = g_strndup(str + 3,
4002 (gsize) (strlen(str) - 6));
4003 }else if(str[0] = '"'){
4004 tmp = g_strndup(str + 1,
4005 (gsize) (strlen(str) - 2));
4006 }else if(str[0] == '\''){
4007 tmp = g_strndup(str + 1,
4008 (gsize) (strlen(str) - 2));
4009 }
4010
4011 g_object_set(lv2_preset,
4012 "preset-label", tmp,
4013 NULL);
4014
4015 g_free(tmp);
4016 }
4017
4018 xmlFree(str);
4019 }
4020 }
4021
4022 g_list_free(start_label_xpath_result);
4023 }
4024
4025 /* bank */
4026 current = NULL;
4027
4028 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/ext/presets#bank>']";
4029
4030 xpath_result =
4031 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4032 xpath,
4033 (xmlNode *) node);
4034
4035 if(start_xpath_result != NULL){
4036 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
4037 }else if(prefix_id_lv2p != NULL){
4038 gchar *prefix_id;
4039
4040 prefix_id = prefix_id_lv2p;
4041
4042 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
4043 prefix_id,
4044 "bank");
4045
4046 xpath_result =
4047 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4048 xpath,
4049 (xmlNode *) node);
4050
4051 g_free(xpath);
4052
4053 if(start_xpath_result != NULL){
4054 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
4055 }
4056 }
4057
4058 g_list_free(start_xpath_result);
4059
4060 if(current != NULL){
4061 GList *start_bank_xpath_result, *bank_xpath_result;
4062
4063 gchar *bank_xpath;
4064
4065 bank_xpath = "./rdf-object/rdf-literal/rdf-string";
4066
4067 bank_xpath_result =
4068 start_bank_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4069 bank_xpath,
4070 (xmlNode *) current);
4071
4072 if(start_bank_xpath_result != NULL){
4073 gchar *str;
4074
4075 str = xmlNodeGetContent((xmlNode *) start_bank_xpath_result->data);
4076
4077 if(str != NULL){
4078 gchar *tmp;
4079
4080 tmp = NULL;
4081
4082 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
4083 tmp = g_strndup(str + 3,
4084 (gsize) (strlen(str) - 6));
4085 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
4086 tmp = g_strndup(str + 3,
4087 (gsize) (strlen(str) - 6));
4088 }else if(str[0] = '"'){
4089 tmp = g_strndup(str + 1,
4090 (gsize) (strlen(str) - 2));
4091 }else if(str[0] == '\''){
4092 tmp = g_strndup(str + 1,
4093 (gsize) (strlen(str) - 2));
4094 }
4095
4096 g_object_set(lv2_preset,
4097 "bank", tmp,
4098 NULL);
4099
4100 g_free(tmp);
4101
4102 xmlFree(str);
4103 }
4104 }
4105
4106 g_list_free(start_bank_xpath_result);
4107 }
4108
4109 /* applies to */
4110 current = NULL;
4111
4112 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#appliesto>']";
4113
4114 xpath_result =
4115 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4116 xpath,
4117 (xmlNode *) node);
4118
4119 if(start_xpath_result != NULL){
4120 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
4121 }else if(prefix_id_lv2_core != NULL){
4122 gchar *prefix_id;
4123
4124 prefix_id = prefix_id_lv2_core;
4125
4126 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
4127 prefix_id,
4128 "appliesto");
4129
4130 xpath_result =
4131 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4132 xpath,
4133 (xmlNode *) node);
4134
4135 g_free(xpath);
4136
4137 if(start_xpath_result != NULL){
4138 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
4139 }
4140 }
4141
4142 g_list_free(start_xpath_result);
4143
4144 if(current != NULL){
4145 GList *start_applies_to_xpath_result, *applies_to_xpath_result;
4146
4147 gchar *applies_to_xpath;
4148
4149 applies_to_xpath = "./rdf-object/rdf-iri/rdf-iriref";
4150
4151 applies_to_xpath_result =
4152 start_applies_to_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4153 applies_to_xpath,
4154 (xmlNode *) current);
4155
4156 if(start_applies_to_xpath_result != NULL){
4157 gchar *str;
4158
4159 str = xmlNodeGetContent((xmlNode *) start_applies_to_xpath_result->data);
4160
4161 if(str != NULL){
4162 if(strlen(str) > 2){
4163 gchar *tmp;
4164
4165 tmp = g_strndup(str + 1,
4166 strlen(str) - 2);
4167
4168 g_object_set(lv2_preset,
4169 "applies-to", tmp,
4170 NULL);
4171
4172 g_free(tmp);
4173 }
4174
4175 xmlFree(str);
4176 }
4177 }else{
4178 applies_to_xpath = "./rdf-object/rdf-iri/rdf-prefixed-name/rdf-pname-ln";
4179
4180 applies_to_xpath_result =
4181 start_applies_to_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4182 applies_to_xpath,
4183 (xmlNode *) current);
4184
4185 if(start_applies_to_xpath_result != NULL){
4186 AgsTurtle **turtle_iter;
4187
4188 gchar *applies_to_pname;
4189 gchar *applies_to_iriref;
4190
4191 applies_to_pname = xmlNodeGetContent(start_applies_to_xpath_result->data);
4192 applies_to_iriref = NULL;
4193
4194 for(turtle_iter = turtle; turtle_iter[0] != NULL; turtle_iter++){
4195 GList *start_list, *list;
4196
4197 gchar *str;
4198 gchar *prefix, *suffix;
4199
4200 prefix = NULL;
4201 suffix = strchr(applies_to_pname, ':');
4202
4203 if(suffix != NULL){
4204 prefix = g_strndup(applies_to_pname,
4205 suffix - applies_to_pname + 1);
4206 suffix = g_strdup(suffix + 1);
4207 }
4208
4209 list =
4210 start_list = g_hash_table_get_keys(turtle_iter[0]->prefix_id);
4211
4212 str = NULL;
4213
4214 while(list != NULL){
4215 gchar *value;
4216
4217 value = g_hash_table_lookup(turtle_iter[0]->prefix_id,
4218 list->data);
4219
4220 if(!g_ascii_strcasecmp(prefix,
4221 value)){
4222 str = list->data;
4223
4224 break;
4225 }
4226
4227 list = list->next;
4228 }
4229
4230 g_list_free(start_list);
4231
4232 if(str != NULL &&
4233 suffix != NULL){
4234 applies_to_iriref = g_strdup_printf("%s%s",
4235 str,
4236 suffix);
4237 }
4238
4239 g_free(prefix);
4240 g_free(suffix);
4241
4242 if(turtle_iter[0] == current_turtle){
4243 break;
4244 }
4245 }
4246
4247 g_object_set(lv2_preset,
4248 "applies-to", applies_to_iriref,
4249 NULL);
4250
4251 if(applies_to_pname){
4252 xmlFree(applies_to_pname);
4253 }
4254
4255 g_free(applies_to_iriref);
4256 }
4257 }
4258
4259 g_list_free(start_applies_to_xpath_result);
4260 }
4261
4262 /* port */
4263 current = NULL;
4264
4265 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#port>']";
4266
4267 xpath_result =
4268 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4269 xpath,
4270 (xmlNode *) node);
4271
4272 if(start_xpath_result != NULL){
4273 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
4274 }else if(prefix_id_lv2_core != NULL){
4275 gchar *prefix_id;
4276
4277 prefix_id = prefix_id_lv2_core;
4278
4279 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
4280 prefix_id,
4281 "port");
4282
4283 xpath_result =
4284 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4285 xpath,
4286 (xmlNode *) node);
4287
4288 g_free(xpath);
4289
4290 if(start_xpath_result != NULL){
4291 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
4292 }
4293 }
4294
4295 g_list_free(start_xpath_result);
4296
4297 if(current != NULL &&
4298 !g_ascii_strncasecmp(current->name,
4299 "rdf-object-list",
4300 16)){
4301 xmlNode *current_child;
4302
4303 current_child = NULL;
4304
4305 if(current != NULL){
4306 current_child = current->children;
4307 }
4308
4309 while(current_child != NULL){
4310 if(current_child->type == XML_ELEMENT_NODE){
4311 if(!g_ascii_strncasecmp(current_child->name,
4312 "rdf-object",
4313 12)){
4314 AgsLv2PortPreset *port_preset;
4315
4316 xmlNode *current_predicate;
4317
4318 GList *start_port_predicate_xpath_result, *port_predicate_xpath_result;
4319
4320 gchar *port_predicate_xpath;
4321 gchar *port_symbol;
4322
4323 gfloat value;
4324
4325 port_symbol = NULL;
4326 value = 0.0;
4327
4328 /* port symbol */
4329 current_predicate = NULL;
4330
4331 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/lv2core#symbol>']";
4332
4333 port_predicate_xpath_result =
4334 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4335 port_predicate_xpath,
4336 (xmlNode *) current_child);
4337
4338 if(start_port_predicate_xpath_result != NULL){
4339 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
4340 }else if(prefix_id_lv2_core != NULL){
4341 gchar *prefix_id;
4342
4343 prefix_id = prefix_id_lv2_core;
4344
4345 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
4346 prefix_id,
4347 "symbol");
4348
4349 port_predicate_xpath_result =
4350 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4351 port_predicate_xpath,
4352 (xmlNode *) current_child);
4353
4354 g_free(port_predicate_xpath);
4355
4356 if(start_port_predicate_xpath_result != NULL){
4357 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
4358 }
4359 }
4360
4361 g_list_free(start_port_predicate_xpath_result);
4362
4363 if(current_predicate != NULL){
4364 GList *start_value_xpath_result, *value_xpath_result;
4365
4366 gchar *value_xpath;
4367
4368 value_xpath = "./rdf-object/rdf-literal/rdf-string";
4369
4370 value_xpath_result =
4371 start_value_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4372 value_xpath,
4373 (xmlNode *) current_predicate);
4374
4375 if(start_value_xpath_result != NULL){
4376 gchar *str;
4377
4378 str = xmlNodeGetContent((xmlNode *) start_value_xpath_result->data);
4379
4380 if(str != NULL){
4381 if(strlen(str) > 2){
4382 if(!g_ascii_strncasecmp(str, "\"\"\"", 3)){
4383 port_symbol = g_strndup(str + 3,
4384 (gsize) (strlen(str) - 6));
4385 }else if(!g_ascii_strncasecmp(str, "'''", 3)){
4386 port_symbol = g_strndup(str + 3,
4387 (gsize) (strlen(str) - 6));
4388 }else if(str[0] = '"'){
4389 port_symbol = g_strndup(str + 1,
4390 (gsize) (strlen(str) - 2));
4391 }else if(str[0] == '\''){
4392 port_symbol = g_strndup(str + 1,
4393 (gsize) (strlen(str) - 2));
4394 }
4395 }
4396
4397 xmlFree(str);
4398 }
4399 }
4400
4401 g_list_free(start_value_xpath_result);
4402 }
4403
4404 /* value */
4405 current_predicate = NULL;
4406
4407 port_predicate_xpath = "./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://lv2plug.in/ns/ext/presets#value>']";
4408
4409 port_predicate_xpath_result =
4410 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4411 port_predicate_xpath,
4412 (xmlNode *) current_child);
4413
4414 if(start_port_predicate_xpath_result != NULL){
4415 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->next;
4416 }else if(prefix_id_lv2p != NULL){
4417 gchar *prefix_id;
4418
4419 prefix_id = prefix_id_lv2p;
4420
4421 port_predicate_xpath = g_strdup_printf("./rdf-blank-node-property-list/rdf-predicate-object-list/rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
4422 prefix_id,
4423 "value");
4424
4425 port_predicate_xpath_result =
4426 start_port_predicate_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4427 port_predicate_xpath,
4428 (xmlNode *) current_child);
4429
4430 g_free(port_predicate_xpath);
4431
4432 if(start_port_predicate_xpath_result != NULL){
4433 current_predicate = ((xmlNode *) start_port_predicate_xpath_result->data)->parent->parent->parent->parent->next;
4434 }
4435 }
4436
4437 g_list_free(start_port_predicate_xpath_result);
4438
4439 if(current_predicate != NULL){
4440 GList *start_value_xpath_result, *value_xpath_result;
4441
4442 gchar *value_xpath;
4443
4444 value_xpath = "./rdf-object/rdf-literal/rdf-numeric";
4445
4446 value_xpath_result =
4447 start_value_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4448 value_xpath,
4449 (xmlNode *) current_predicate);
4450
4451 if(start_value_xpath_result != NULL){
4452 gchar *str;
4453
4454 str = xmlNodeGetContent((xmlNode *) start_value_xpath_result->data);
4455
4456 if(str != NULL){
4457 value = g_ascii_strtod(str,
4458 NULL);
4459
4460 xmlFree(str);
4461 }
4462 }
4463
4464 g_list_free(start_value_xpath_result);
4465 }
4466
4467 if(port_symbol != NULL){
4468 port_preset = ags_lv2_port_preset_alloc(port_symbol,
4469 G_TYPE_FLOAT);
4470 lv2_preset->port_preset = g_list_prepend(lv2_preset->port_preset,
4471 port_preset);
4472
4473 g_value_set_float(port_preset->port_value,
4474 value);
4475 }
4476 }
4477 }
4478
4479 current_child = current_child->next;
4480 }
4481 }
4482 }
4483 }
4484
4485 void
ags_lv2_turtle_parser_parse_predicate_object_list_see_also(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,gchar * subject_iriref,xmlNode * node,AgsTurtle ** turtle,guint n_turtle)4486 ags_lv2_turtle_parser_parse_predicate_object_list_see_also(AgsLv2TurtleParser *lv2_turtle_parser,
4487 AgsTurtle *current_turtle,
4488 gchar *subject_iriref,
4489 xmlNode *node,
4490 AgsTurtle **turtle, guint n_turtle)
4491 {
4492 AgsTurtle **turtle_iter;
4493
4494 xmlNode *current;
4495
4496 GList *start_xpath_result, *xpath_result;
4497
4498 gchar *prefix_id_rdfs;
4499 gchar *xpath;
4500
4501 prefix_id_rdfs = NULL;
4502
4503 for(turtle_iter = turtle; turtle_iter[0] != NULL; turtle_iter++){
4504 gchar *str;
4505
4506 if((str = g_hash_table_lookup(turtle_iter[0]->prefix_id,
4507 "http://www.w3.org/2000/01/rdf-schema#")) != NULL){
4508 prefix_id_rdfs = str;
4509 }
4510
4511 if(turtle_iter[0] == current_turtle){
4512 break;
4513 }
4514 }
4515
4516 /* label */
4517 current = NULL;
4518
4519 xpath = "./rdf-verb/rdf-predicate/rdf-iri/rdf-iriref[text() = '<http://www.w3.org/2000/01/rdf-schema#seealso>']";
4520
4521 xpath_result =
4522 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4523 xpath,
4524 (xmlNode *) node);
4525
4526 if(start_xpath_result != NULL){
4527 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->next;
4528 }else if(prefix_id_rdfs != NULL){
4529 gchar *prefix_id;
4530
4531 prefix_id = prefix_id_rdfs;
4532
4533 xpath = g_strdup_printf("./rdf-verb/rdf-predicate/rdf-iri/rdf-prefixed-name/rdf-pname-ln[text() = '%s%s']",
4534 prefix_id,
4535 "seealso");
4536
4537 xpath_result =
4538 start_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4539 xpath,
4540 (xmlNode *) node);
4541
4542 g_free(xpath);
4543
4544 if(start_xpath_result != NULL){
4545 current = ((xmlNode *) start_xpath_result->data)->parent->parent->parent->parent->next;
4546 }
4547 }
4548
4549 g_list_free(start_xpath_result);
4550
4551 if(current != NULL){
4552 GList *start_iriref_xpath_result, *iriref_xpath_result;
4553
4554 gchar *iriref_xpath;
4555
4556 iriref_xpath = "./rdf-object/rdf-iri/rdf-iriref";
4557
4558 iriref_xpath_result =
4559 start_iriref_xpath_result = ags_turtle_find_xpath_with_context_node(current_turtle,
4560 iriref_xpath,
4561 (xmlNode *) current);
4562
4563 if(start_iriref_xpath_result != NULL){
4564 gchar *str;
4565
4566 str = xmlNodeGetContent((xmlNode *) start_iriref_xpath_result->data);
4567
4568 if(str != NULL &&
4569 g_str_has_suffix(str,
4570 ".ttl>")){
4571 AgsTurtle **next_turtle;
4572 AgsTurtle *next;
4573
4574 gchar *path;
4575 gchar *filename;
4576
4577 int ttl_length;
4578 guint next_n_turtle;
4579 gboolean skip;
4580
4581 path = g_path_get_dirname(turtle[0]->filename);
4582
4583 ttl_length = strlen(str) - 2;
4584 filename = g_strdup_printf("%s%c%.*s",
4585 path,
4586 G_DIR_SEPARATOR,
4587 ttl_length, &(str[1]));
4588
4589 if(ags_lv2_manager_global_get_parse_names()){
4590 skip = FALSE;
4591 }else{
4592 skip = TRUE;
4593 }
4594
4595 next = ags_turtle_manager_find(ags_turtle_manager_get_instance(),
4596 filename);
4597
4598 if(next == NULL){
4599 g_message("new turtle - %s", filename);
4600
4601 next = ags_turtle_new(filename);
4602 g_object_set(lv2_turtle_parser,
4603 "turtle", next,
4604 NULL);
4605
4606 ags_turtle_load(next,
4607 NULL);
4608
4609 ags_turtle_manager_add(ags_turtle_manager_get_instance(),
4610 (GObject *) next);
4611
4612 skip = FALSE;
4613
4614 g_object_unref(next);
4615 }
4616
4617 if(next != NULL &&
4618 !skip){
4619 next_n_turtle = n_turtle + 1;
4620
4621 next_turtle = (AgsTurtle **) malloc((next_n_turtle + 1) * sizeof(AgsTurtle *));
4622
4623 memcpy(next_turtle, turtle, n_turtle * sizeof(AgsTurtle *));
4624
4625 next_turtle[n_turtle] = next;
4626 next_turtle[n_turtle + 1] = NULL;
4627
4628 ags_lv2_turtle_parser_parse(lv2_turtle_parser,
4629 next_turtle, next_n_turtle);
4630
4631 free(next_turtle);
4632 }
4633
4634 g_free(path);
4635 g_free(filename);
4636 }
4637
4638 if(str != NULL){
4639 xmlFree(str);
4640 }
4641 }
4642
4643 g_list_free(start_iriref_xpath_result);
4644 }
4645 }
4646
4647 void
ags_lv2_turtle_parser_parse_blank_node_property_list(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle * current_turtle,gchar * subject_iriref,xmlNode * node,AgsTurtle ** turtle,guint n_turtle)4648 ags_lv2_turtle_parser_parse_blank_node_property_list(AgsLv2TurtleParser *lv2_turtle_parser,
4649 AgsTurtle *current_turtle,
4650 gchar *subject_iriref,
4651 xmlNode *node,
4652 AgsTurtle **turtle, guint n_turtle)
4653 {
4654 }
4655
4656 /**
4657 * ags_lv2_turtle_parser_parse:
4658 * @lv2_turtle_parser: the #AgsLv2TurtleParser
4659 * @turtle: (element-type Ags.Turtle) (array zero-terminated=1) (inout): the %NULL terminated array of #AgsTurtle
4660 * @n_turtle: the turtle count
4661 *
4662 * Parse manifest and referred turtles.
4663 *
4664 * Since: 3.0.0
4665 */
4666 void
ags_lv2_turtle_parser_parse(AgsLv2TurtleParser * lv2_turtle_parser,AgsTurtle ** turtle,guint n_turtle)4667 ags_lv2_turtle_parser_parse(AgsLv2TurtleParser *lv2_turtle_parser,
4668 AgsTurtle **turtle, guint n_turtle)
4669 {
4670 AgsTurtle *manifest;
4671 AgsTurtle *current_turtle;
4672
4673 xmlNode *root_node;
4674 xmlNode *node;
4675
4676 GList *list;
4677 GList *start_plugin, *plugin;
4678 GList *start_ui_plugin, *ui_plugin;
4679 GList *start_preset, *preset;
4680
4681 GRecMutex *lv2_turtle_parser_mutex;
4682
4683 if(!AGS_IS_LV2_TURTLE_PARSER(lv2_turtle_parser)){
4684 return;
4685 }
4686
4687 /* get lv2 turtle parser mutex */
4688 lv2_turtle_parser_mutex = AGS_LV2_TURTLE_PARSER_GET_OBJ_MUTEX(lv2_turtle_parser);
4689
4690 /* get manifest */
4691 manifest = NULL;
4692
4693 g_rec_mutex_lock(lv2_turtle_parser_mutex);
4694
4695 list = g_list_last(lv2_turtle_parser->turtle);
4696
4697 if(list != NULL){
4698 manifest = list->data;
4699 }
4700
4701 g_rec_mutex_unlock(lv2_turtle_parser_mutex);
4702
4703 if(turtle == NULL){
4704 if(manifest == NULL){
4705 return;
4706 }else{
4707 guint turtle_count;
4708
4709 turtle_count = 1;
4710
4711 turtle = (AgsTurtle **) malloc(2 * sizeof(AgsTurtle *));
4712 turtle[0] = manifest;
4713 turtle[1] = NULL;
4714
4715 n_turtle = turtle_count;
4716 }
4717 }
4718
4719 if(n_turtle == 0){
4720 g_warning("missing argument");
4721
4722 return;
4723 }
4724
4725 current_turtle = turtle[n_turtle - 1];
4726
4727 /* get root node */
4728 root_node = xmlDocGetRootElement(current_turtle->doc);
4729
4730 /* start parse */
4731 node = NULL;
4732
4733 if(root_node != NULL){
4734 node = root_node->children;
4735 }
4736
4737 while(node != NULL){
4738 if(node->type == XML_ELEMENT_NODE){
4739 if(!g_ascii_strncasecmp(node->name,
4740 "rdf-statement",
4741 14)){
4742 ags_lv2_turtle_parser_parse_statement(lv2_turtle_parser,
4743 current_turtle,
4744 node,
4745 turtle, n_turtle,
4746 FALSE);
4747 }
4748 }
4749
4750 node = node->next;
4751 }
4752
4753 if(root_node != NULL){
4754 node = root_node->children;
4755 }
4756
4757 while(node != NULL){
4758 if(node->type == XML_ELEMENT_NODE){
4759 if(!g_ascii_strncasecmp(node->name,
4760 "rdf-statement",
4761 14)){
4762 ags_lv2_turtle_parser_parse_statement(lv2_turtle_parser,
4763 current_turtle,
4764 node,
4765 turtle, n_turtle,
4766 TRUE);
4767 }
4768 }
4769
4770 node = node->next;
4771 }
4772
4773 /* post-process */
4774 if(current_turtle == turtle[0]){
4775 g_object_get(lv2_turtle_parser,
4776 "plugin", &start_plugin,
4777 NULL);
4778
4779 /* post-process - preset */
4780 g_object_get(lv2_turtle_parser,
4781 "preset", &start_preset,
4782 NULL);
4783
4784 preset = start_preset;
4785
4786 while(preset != NULL){
4787 gchar *applies_to;
4788
4789 g_object_get(preset->data,
4790 "applies-to", &applies_to,
4791 NULL);
4792
4793 plugin = ags_lv2_plugin_find_uri(start_plugin,
4794 applies_to);
4795
4796 if(plugin != NULL){
4797 g_object_set(plugin->data,
4798 "preset", preset->data,
4799 NULL);
4800 }else{
4801 g_warning("plugin not found %s", applies_to);
4802 }
4803
4804 g_free(applies_to);
4805
4806 preset = preset->next;
4807 }
4808
4809 g_list_free_full(start_preset,
4810 g_object_unref);
4811
4812 /* post-process - ui plugin */
4813 #if 0
4814 g_object_get(lv2_turtle_parser,
4815 "ui-plugin", &start_ui_plugin,
4816 NULL);
4817
4818 ui_plugin = start_ui_plugin;
4819
4820 while(ui_plugin != NULL){
4821
4822
4823 ui_plugin = ui_plugin->next;
4824 }
4825
4826 g_list_free_full(start_ui_plugin,
4827 g_object_unref);
4828 #endif
4829
4830 g_list_free_full(start_plugin,
4831 g_object_unref);
4832 }
4833
4834 #if 0
4835 if(strstr(current_turtle->filename, "swh") != NULL){
4836 xmlSaveFormatFileEnc("-", current_turtle->doc, "UTF-8", 1);
4837 }
4838 #endif
4839
4840 // xmlCleanupParser();
4841 }
4842
4843 /**
4844 * ags_lv2_turtle_parser_new:
4845 * @manifest: the manifest as #AgsTurtle
4846 *
4847 * Creates an #AgsLv2TurtleParser
4848 *
4849 * Returns: a new #AgsLv2TurtleParser
4850 *
4851 * Since: 3.0.0
4852 */
4853 AgsLv2TurtleParser*
ags_lv2_turtle_parser_new(AgsTurtle * manifest)4854 ags_lv2_turtle_parser_new(AgsTurtle *manifest)
4855 {
4856 AgsLv2TurtleParser *lv2_turtle_parser;
4857
4858 lv2_turtle_parser = (AgsLv2TurtleParser *) g_object_new(AGS_TYPE_LV2_TURTLE_PARSER,
4859 "turtle", manifest,
4860 NULL);
4861
4862 return(lv2_turtle_parser);
4863 }
4864