2 #include <glib-object.h>
7 #include "../gstparse.h"
8 #include "../gstinfo.h"
15 #define YYERROR_VERBOSE 1
16 #define YYPARSE_PARAM graph
18 #ifdef __GST_PARSE_TRACE
19 static uint __strings;
23 __gst_parse_strdup (gchar *org)
28 /* g_print ("ALLOCATED STR (%3u): %p %s\n", __strings, ret, ret); */
32 __gst_parse_strfree (gchar *str)
35 /* g_print ("FREEING STR (%3u): %p %s\n", __strings - 1, str, str); */
37 g_return_if_fail (__strings > 0);
41 link_t *__gst_parse_link_new ()
45 ret = g_new0 (link_t, 1);
46 /* g_print ("ALLOCATED LINK (%3u): %p\n", __links, ret); */
50 __gst_parse_link_free (link_t *data)
53 /* g_print ("FREEING LINK (%3u): %p\n", __links - 1, data); */
55 g_return_if_fail (__links > 0);
60 __gst_parse_chain_new ()
64 ret = g_new0 (chain_t, 1);
65 /* g_print ("ALLOCATED CHAIN (%3u): %p\n", __chains, ret); */
69 __gst_parse_chain_free (chain_t *data)
72 /* g_print ("FREEING CHAIN (%3u): %p\n", __chains - 1, data); */
74 g_return_if_fail (__chains > 0);
79 #endif /* __GST_PARSE_TRACE */
87 /* FIXME: need to connect to "disposed" signal to clean up, but there is no such signal */
90 #ifdef G_HAVE_ISO_VARARGS
91 #define SET_ERROR(error, type, ...) G_STMT_START{ \
94 g_warning (__VA_ARGS__); \
96 g_set_error ((error), GST_PARSE_ERROR, (type), __VA_ARGS__); \
100 #define ERROR(type, ...) SET_ERROR (((graph_t *) graph)->error, (type), __VA_ARGS__ )
101 #ifdef GST_DEBUG_ENABLED
103 /* bison 1.35 calls this macro with side effects, we need to make sure the
104 side effects work - crappy bison
105 # define YYFPRINTF(a, ...) GST_DEBUG (GST_CAT_PIPELINE, __VA_ARGS__)
107 # define YYFPRINTF(a, ...) G_STMT_START{ \
108 gchar *temp = g_strdup_printf (__VA_ARGS__); \
109 GST_DEBUG (GST_CAT_PIPELINE, temp); \
114 #elif defined(G_HAVE_GNUC_VARARGS)
116 #define SET_ERROR(error, type, args...) G_STMT_START{ \
119 g_warning ( ## args ); \
121 g_set_error ((error), GST_PARSE_ERROR, (type), ## args ); \
125 #define ERROR(type, args...) SET_ERROR (((graph_t *) graph)->error, (type), ## args )
126 #ifdef GST_DEBUG_ENABLED
128 /* bison 1.35 calls this macro with side effects, we need to make sure the
129 side effects work - crappy bison
130 # define YYFPRINTF(a, args...) GST_DEBUG (GST_CAT_PIPELINE, ## args )
132 # define YYFPRINTF(a, args...) G_STMT_START{ \
133 gchar *temp = g_strdup_printf ( ## args ); \
134 GST_DEBUG (GST_CAT_PIPELINE, temp); \
141 #define SET_ERROR(error, type, ...) G_STMT_START{ \
144 g_warning ("error while parsing"); \
146 g_set_error ((error), GST_PARSE_ERROR, (type), "error while parsing"); \
150 #define ERROR(type, ...) SET_ERROR (((graph_t *) graph)->error, (type), "error while parsing")
151 #ifdef GST_DEBUG_ENABLED
155 #endif /* G_HAVE_ISO_VARARGS */
157 #define GST_BIN_MAKE(res, type, chainval, assign) G_STMT_START{ \
158 chain_t *chain = chainval; \
160 GstBin *bin = (GstBin *) gst_element_factory_make (type, NULL); \
162 ERROR (GST_PARSE_ERROR_EMPTY_BIN, "Specified empty bin \"%s\", not allowed", type); \
163 g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
164 g_slist_free (assign); \
167 ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No bin \"%s\", omitting...", type); \
168 g_slist_foreach (assign, (GFunc) gst_parse_strfree, NULL); \
169 g_slist_free (assign); \
172 walk = chain->elements; \
174 gst_bin_add (bin, GST_ELEMENT (walk->data)); \
177 g_slist_free (chain->elements); \
178 chain->elements = g_slist_prepend (NULL, bin); \
180 /* set the properties now */ \
183 gst_parse_element_set ((gchar *) walk->data, GST_ELEMENT (bin), graph); \
184 walk = g_slist_next (walk); \
186 g_slist_free (assign); \
190 #define MAKE_LINK(link, _src, _src_name, _src_pads, _sink, _sink_name, _sink_pads) G_STMT_START{ \
191 link = gst_parse_link_new (); \
193 link->sink = _sink; \
194 link->src_name = _src_name; \
195 link->sink_name = _sink_name; \
196 link->src_pads = _src_pads; \
197 link->sink_pads = _sink_pads; \
201 #define MAKE_REF(link, _src, _pads) G_STMT_START{ \
202 gchar *padname = _src; \
203 GSList *pads = _pads; \
205 while (*padname != '.') padname++; \
208 if (*padname != '\0') \
209 pads = g_slist_prepend (pads, gst_parse_strdup (padname)); \
211 MAKE_LINK (link, NULL, _src, pads, NULL, NULL, NULL); \
214 static inline void gst_parse_unescape (gchar *str)
218 g_return_if_fail (str != NULL);
232 gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
236 /* parse the string, so the property name is null-terminated an pos points
237 to the beginning of the value */
238 while (!g_ascii_isspace (*pos) && (*pos != '=')) pos++;
244 while (g_ascii_isspace (*pos)) pos++;
247 while (g_ascii_isspace (*pos)) pos++;
250 pos[strlen (pos) - 1] = '\0';
252 gst_parse_unescape (pos);
253 if ((pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (element), value))) {
256 g_value_init (&v, G_PARAM_SPEC_VALUE_TYPE(pspec));
257 switch (G_TYPE_FUNDAMENTAL (G_PARAM_SPEC_VALUE_TYPE (pspec))) {
259 g_value_set_string (&v, pos);
262 if (g_ascii_strcasecmp (pos, "true") && g_ascii_strcasecmp (pos, "yes") && g_ascii_strcasecmp (pos, "1")) {
263 g_value_set_boolean (&v, FALSE);
265 g_value_set_boolean (&v, TRUE);
270 gchar *endptr = NULL;
271 GEnumClass *klass = (GEnumClass *) g_type_class_peek (G_PARAM_SPEC_VALUE_TYPE (pspec));
272 if (klass == NULL) goto error;
273 if (!(en = g_enum_get_value_by_name (klass, pos))) {
274 if (!(en = g_enum_get_value_by_nick (klass, pos))) {
275 gint i = strtol (pos, &endptr, 0);
276 if (endptr && *endptr == '\0') {
277 en = g_enum_get_value (klass, i);
283 g_value_set_enum (&v, en->value);
291 g_value_init (&v2, G_TYPE_LONG);
292 l = strtol (pos, &endptr, 0);
293 if (*endptr != '\0') goto error_conversion;
294 g_value_set_long (&v2, l);
295 if (!g_value_transform (&v2, &v)) goto error_conversion;
300 case G_TYPE_UINT64: {
303 g_value_init (&v2, G_TYPE_ULONG);
304 ul = strtoul (pos, &endptr, 0);
305 if (*endptr != '\0') goto error_conversion;
306 g_value_set_ulong (&v2, ul);
307 if (!g_value_transform (&v2, &v)) goto error_conversion;
311 case G_TYPE_DOUBLE: {
314 g_value_init (&v2, G_TYPE_DOUBLE);
315 d = strtod (pos, &endptr);
316 if (*endptr != '\0') goto error_conversion;
317 g_value_set_double (&v2, d);
318 if (!g_value_transform (&v2, &v)) goto error_conversion;
323 g_warning ("property \"%s\" in element %s cannot be set", value, GST_ELEMENT_NAME (element));
326 g_object_set_property (G_OBJECT (element), value, &v);
328 ERROR (GST_PARSE_ERROR_NO_SUCH_PROPERTY, "No property \"%s\" in element \"%s\"", value, GST_ELEMENT_NAME (element));
332 gst_parse_strfree (value);
336 ERROR (GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
337 "Could not set property \"%s\" in element \"%s\" to \"%s\"",
338 value, GST_ELEMENT_NAME (element), pos);
341 ERROR (GST_PARSE_ERROR_COULD_NOT_SET_PROPERTY,
342 "Could not convert \"%s\" so that it fits property \"%s\" in element \"%s\"",
343 pos, value, GST_ELEMENT_NAME (element));
347 gst_parse_free_link (link_t *link)
349 gst_parse_strfree (link->src_name);
350 gst_parse_strfree (link->sink_name);
351 g_slist_foreach (link->src_pads, (GFunc) gst_parse_strfree, NULL);
352 g_slist_foreach (link->sink_pads, (GFunc) gst_parse_strfree, NULL);
353 g_slist_free (link->src_pads);
354 g_slist_free (link->sink_pads);
355 gst_caps_unref (link->caps);
356 gst_parse_link_free (link);
359 gst_parse_element_lock (GstElement *element, gboolean lock)
362 GList *walk = (GList *) gst_element_get_pad_list (element);
363 gboolean unlocked_peer = FALSE;
365 if (gst_element_is_locked_state (element) == lock)
367 /* check if we have an unlocked peer */
369 pad = (GstPad *) GST_PAD_REALIZE (walk->data);
371 if (GST_PAD_IS_SINK (pad) && GST_PAD_PEER (pad) &&
372 !gst_element_is_locked_state (GST_PAD_PARENT (GST_PAD_PEER (pad)))) {
373 unlocked_peer = TRUE;
378 if (!(lock && unlocked_peer)) {
379 gst_element_set_locked_state (element, lock);
381 gst_element_sync_state_with_parent (element);
386 /* check if there are other pads to (un)lock */
387 walk = (GList *) gst_element_get_pad_list (element);
389 pad = (GstPad *) GST_PAD_REALIZE (walk->data);
391 if (GST_PAD_IS_SRC (pad) && GST_PAD_PEER (pad)) {
392 GstElement *next = GST_ELEMENT (GST_OBJECT_PARENT (GST_PAD_PEER (pad)));
393 if (gst_element_is_locked_state (next) != lock)
394 gst_parse_element_lock (next, lock);
399 gst_parse_found_pad (GstElement *src, GstPad *pad, gpointer data)
401 DelayedLink *link = (DelayedLink *) data;
403 GST_INFO (GST_CAT_PIPELINE, "trying delayed linking %s:%s to %s:%s",
404 GST_ELEMENT_NAME (src), link->src_pad,
405 GST_ELEMENT_NAME (link->sink), link->sink_pad);
407 if (gst_element_link_pads_filtered (src, link->src_pad, link->sink, link->sink_pad, link->caps)) {
408 /* do this here, we don't want to get any problems later on when unlocking states */
409 GST_DEBUG (GST_CAT_PIPELINE, "delayed linking %s:%s to %s:%s worked",
410 GST_ELEMENT_NAME (src), link->src_pad,
411 GST_ELEMENT_NAME (link->sink), link->sink_pad);
412 g_signal_handler_disconnect (src, link->signal_id);
413 g_free (link->src_pad);
414 g_free (link->sink_pad);
415 gst_caps_unref (link->caps);
416 if (!gst_element_is_locked_state (src))
417 gst_parse_element_lock (link->sink, FALSE);
421 /* both padnames and the caps may be NULL */
423 gst_parse_perform_delayed_link (GstElement *src, const gchar *src_pad,
424 GstElement *sink, const gchar *sink_pad, GstCaps *caps)
426 GList *templs = gst_element_get_pad_template_list (src);
429 GstPadTemplate *templ = (GstPadTemplate *) templs->data;
430 if ((GST_PAD_TEMPLATE_DIRECTION (templ) == GST_PAD_SRC) && (GST_PAD_TEMPLATE_PRESENCE(templ) == GST_PAD_SOMETIMES))
432 DelayedLink *data = g_new (DelayedLink, 1);
434 /* TODO: maybe we should check if src_pad matches this template's names */
436 GST_DEBUG (GST_CAT_PIPELINE, "trying delayed link %s:%s to %s:%s",
437 GST_ELEMENT_NAME (src), src_pad, GST_ELEMENT_NAME (sink), sink_pad);
439 data->src_pad = g_strdup (src_pad);
441 data->sink_pad = g_strdup (sink_pad);
442 data->caps = gst_caps_ref (caps);
443 data->signal_id = g_signal_connect (G_OBJECT (src), "new_pad",
444 G_CALLBACK (gst_parse_found_pad), data);
447 templs = g_list_next (templs);
452 * performs a link and frees the struct. src and sink elements must be given
453 * return values: 0 - link performed
458 gst_parse_perform_link (link_t *link, graph_t *graph)
460 GstElement *src = link->src;
461 GstElement *sink = link->sink;
462 GSList *srcs = link->src_pads;
463 GSList *sinks = link->sink_pads;
464 g_assert (GST_IS_ELEMENT (src));
465 g_assert (GST_IS_ELEMENT (sink));
467 GST_INFO (GST_CAT_PIPELINE, "linking %s(%s):%u to %s(%s):%u",
468 GST_ELEMENT_NAME (src), link->src_name ? link->src_name : "---", g_slist_length (srcs),
469 GST_ELEMENT_NAME (sink), link->sink_name ? link->sink_name : "---", g_slist_length (sinks));
471 if (!srcs || !sinks) {
472 if (gst_element_link_pads_filtered (src, srcs ? (const gchar *) srcs->data : NULL,
473 sink, sinks ? (const gchar *) sinks->data : NULL,
475 gst_parse_element_lock (sink, gst_element_is_locked_state (src));
478 if (gst_parse_perform_delayed_link (src, srcs ? (const gchar *) srcs->data : NULL,
479 sink, sinks ? (const gchar *) sinks->data : NULL,
481 gst_parse_element_lock (sink, TRUE);
488 if (g_slist_length (link->src_pads) != g_slist_length (link->src_pads)) {
491 while (srcs && sinks) {
492 const gchar *src_pad = (const gchar *) srcs->data;
493 const gchar *sink_pad = (const gchar *) sinks->data;
494 srcs = g_slist_next (srcs);
495 sinks = g_slist_next (sinks);
496 if (gst_element_link_pads_filtered (src, src_pad, sink, sink_pad, link->caps)) {
497 gst_parse_element_lock (sink, gst_element_is_locked_state (src));
500 if (gst_parse_perform_delayed_link (src, src_pad,
503 gst_parse_element_lock (sink, TRUE);
512 gst_parse_free_link (link);
516 ERROR (GST_PARSE_ERROR_LINK, "could not link %s to %s", GST_ELEMENT_NAME (src), GST_ELEMENT_NAME (sink));
517 gst_parse_free_link (link);
522 static int yylex (void *lvalp);
523 static int yyerror (const char *s);
535 %token <s> IDENTIFIER
536 %left <s> REF PADREF BINREF
537 %token <s> ASSIGNMENT
542 %type <l> linkpart link
545 %type <p> padlist pads assignments
547 %left '{' '}' '(' ')'
557 element: IDENTIFIER { $$ = gst_element_factory_make ($1, NULL);
559 ERROR (GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No element \"%s\"", $1);
560 gst_parse_strfree ($1);
564 | element ASSIGNMENT { gst_parse_element_set ($2, $1, graph);
569 assignments: /* NOP */ { $$ = NULL; }
570 | assignments ASSIGNMENT { $$ = g_slist_prepend ($1, $2); }
572 bin: '{' assignments chain '}' { GST_BIN_MAKE ($$, "thread", $3, $2); }
573 | '(' assignments chain ')' { GST_BIN_MAKE ($$, "bin", $3, $2); }
574 | BINREF assignments chain ')' { GST_BIN_MAKE ($$, $1, $3, $2);
575 gst_parse_strfree ($1);
577 | '{' assignments '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
578 | '(' assignments '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
579 | BINREF assignments ')' { GST_BIN_MAKE ($$, $1, NULL, $2);
580 gst_parse_strfree ($1);
582 | '{' assignments error '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
583 | '(' assignments error '}' { GST_BIN_MAKE ($$, "thread", NULL, $2); }
584 | BINREF assignments error ')' { GST_BIN_MAKE ($$, $1, NULL, $2);
585 gst_parse_strfree ($1);
589 pads: PADREF { $$ = g_slist_prepend (NULL, $1); }
590 | PADREF padlist { $$ = $2;
591 $$ = g_slist_prepend ($$, $1);
594 padlist: ',' IDENTIFIER { $$ = g_slist_prepend (NULL, $2); }
595 | ',' IDENTIFIER padlist { $$ = g_slist_prepend ($3, $2); }
598 reference: REF { MAKE_REF ($$, $1, NULL); }
599 | REF padlist { MAKE_REF ($$, $1, $2); }
602 linkpart: reference { $$ = $1; }
603 | pads { MAKE_REF ($$, NULL, $1); }
604 | /* NOP */ { MAKE_REF ($$, NULL, NULL); }
607 link: linkpart '!' linkpart { $$ = $1;
608 $$->sink_name = $3->src_name;
609 $$->sink_pads = $3->src_pads;
610 gst_parse_link_free ($3);
614 linklist: link { $$ = g_slist_prepend (NULL, $1); }
615 | link linklist { $$ = g_slist_prepend ($2, $1); }
616 | linklist error { $$ = $1; }
619 chain: element { $$ = gst_parse_chain_new ();
620 $$->first = $$->last = $1;
621 $$->front = $$->back = NULL;
622 $$->elements = g_slist_prepend (NULL, $1);
625 | chain chain { if ($1->back && $2->front) {
626 if (!$1->back->sink_name) {
627 ERROR (GST_PARSE_ERROR_LINK, "link without source element");
628 gst_parse_free_link ($1->back);
630 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back);
632 if (!$2->front->src_name) {
633 ERROR (GST_PARSE_ERROR_LINK, "link without sink element");
634 gst_parse_free_link ($2->front);
636 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front);
639 } else if ($1->back) {
640 if (!$1->back->sink_name) {
641 $1->back->sink = $2->first;
643 } else if ($2->front) {
644 if (!$2->front->src_name) {
645 $2->front->src = $1->last;
647 $1->back = $2->front;
651 if (!$1->back->sink || !$1->back->src) {
652 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $1->back);
655 gst_parse_perform_link ($1->back, (graph_t *) graph);
660 $1->elements = g_slist_concat ($1->elements, $2->elements);
661 gst_parse_chain_free ($2);
664 | link chain { if ($2->front) {
665 if (!$2->front->src_name) {
666 ERROR (GST_PARSE_ERROR_LINK, "link without source element");
667 gst_parse_free_link ($2->front);
669 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, $2->front);
672 if (!$1->sink_name) {
673 $1->sink = $2->first;
679 | chain linklist { GSList *walk;
681 $2 = g_slist_prepend ($2, $1->back);
684 if (!((link_t *) $2->data)->src_name) {
685 ((link_t *) $2->data)->src = $1->last;
690 link_t *link = (link_t *) walk->data;
692 if (!link->sink_name && walk) {
693 ERROR (GST_PARSE_ERROR_LINK, "link without sink element");
694 gst_parse_free_link (link);
695 } else if (!link->src_name && !link->src) {
696 ERROR (GST_PARSE_ERROR_LINK, "link without source element");
697 gst_parse_free_link (link);
700 ((graph_t *) graph)->links = g_slist_prepend (((graph_t *) graph)->links, link);
709 | chain error { $$ = $1; }
712 graph: /* NOP */ { ERROR (GST_PARSE_ERROR_EMPTY, "Empty pipeline not allowed");
713 $$ = (graph_t *) graph;
715 | chain { $$ = (graph_t *) graph;
717 if (!$1->front->src_name) {
718 ERROR (GST_PARSE_ERROR_LINK, "link without source element");
719 gst_parse_free_link ($1->front);
721 $$->links = g_slist_prepend ($$->links, $1->front);
726 if (!$1->back->sink_name) {
727 ERROR (GST_PARSE_ERROR_LINK, "link without sink element");
728 gst_parse_free_link ($1->back);
730 $$->links = g_slist_prepend ($$->links, $1->back);
740 extern FILE *_gst_parse_yyin;
741 int _gst_parse_yylex (YYSTYPE *lvalp);
743 static int yylex (void *lvalp) {
744 return _gst_parse_yylex ((YYSTYPE*) lvalp);
748 yyerror (const char *s)
750 /* FIXME: This should go into the GError somehow, but how? */
751 g_warning ("error: %s\n", s);
755 int _gst_parse_yy_scan_string (char*);
757 _gst_parse_launch (const gchar *str, GError **error)
765 g_return_val_if_fail (str != NULL, NULL);
771 #ifdef __GST_PARSE_TRACE
772 GST_DEBUG (GST_CAT_PIPELINE, "TRACE: tracing enabled");
773 __strings = __chains = __links = 0;
774 #endif /* __GST_PARSE_TRACE */
776 dstr = g_strdup (str);
777 _gst_parse_yy_scan_string (dstr);
779 #ifdef GST_DEBUG_ENABLED
783 if (yyparse (&g) != 0) {
784 SET_ERROR (error, GST_PARSE_ERROR_SYNTAX, "Unrecoverable syntax error while parsing pipeline");
790 GST_INFO (GST_CAT_PIPELINE, "got %u elements and %u links", g.chain ? g_slist_length (g.chain->elements) : 0, g_slist_length (g.links));
794 } else if (!(((chain_t *) g.chain)->elements->next)) {
795 /* only one toplevel element */
796 ret = (GstElement *) ((chain_t *) g.chain)->elements->data;
797 g_slist_free (((chain_t *) g.chain)->elements);
798 if (GST_IS_BIN (ret))
801 /* put all elements in our bin */
802 bin = GST_BIN (gst_element_factory_make ("pipeline", NULL));
804 walk = g.chain->elements;
806 gst_bin_add (bin, GST_ELEMENT (walk->data));
807 walk = g_slist_next (walk);
809 g_slist_free (g.chain->elements);
810 ret = GST_ELEMENT (bin);
812 gst_parse_chain_free (g.chain);
817 link_t *l = (link_t *) walk->data;
819 walk = g_slist_next (walk);
823 l->src = gst_bin_get_by_name_recurse_up (bin, l->src_name);
825 l->src = strcmp (GST_ELEMENT_NAME (ret), l->src_name) == 0 ? ret : NULL;
829 SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No element named \"%s\" - omitting link", l->src_name);
830 gst_parse_free_link (l);
837 l->sink = gst_bin_get_by_name_recurse_up (bin, l->sink_name);
839 l->sink = strcmp (GST_ELEMENT_NAME (ret), l->sink_name) == 0 ? ret : NULL;
843 SET_ERROR (error, GST_PARSE_ERROR_NO_SUCH_ELEMENT, "No element named \"%s\" - omitting link", l->sink_name);
844 gst_parse_free_link (l);
849 gst_parse_perform_link (l, &g);
851 g_slist_free (g.links);
854 #ifdef __GST_PARSE_TRACE
855 GST_DEBUG (GST_CAT_PIPELINE, "TRACE: %u strings, %u chains and %u links left", __strings, __chains, __links);
856 if (__strings || __chains || __links) {
857 g_warning ("TRACE: %u strings, %u chains and %u links left", __strings, __chains, __links);
859 #endif /* __GST_PARSE_TRACE */
867 walk = g.chain->elements;
869 gst_object_unref (GST_OBJECT (walk->data));
872 g_slist_free (g.chain->elements);
874 gst_parse_chain_free (g.chain);
878 gst_parse_free_link ((link_t *) walk->data);
881 g_slist_free (g.links);