diff --git a/dtc-lexer.l b/dtc-lexer.l
index 0cd7e67..7989abe 100644
--- a/dtc-lexer.l
+++ b/dtc-lexer.l
@@ -131,6 +131,13 @@ static bool pop_input_file(void);
return DT_DEL_PROP;
}
+<*>"/append-property/" {
+ DPRINT("Keyword: /append-property/\n");
+ DPRINT("<PROPNODENAME>\n");
+ BEGIN(PROPNODENAME);
+ return DT_APPEND_PROP;
+ }
+
<*>"/delete-node/" {
DPRINT("Keyword: /delete-node/\n");
DPRINT("<PROPNODENAME>\n");diff --git a/dtc-parser.y b/dtc-parser.y
index 4864631..a8409ed 100644
--- a/dtc-parser.y
+++ b/dtc-parser.y
@@ -63,6 +63,7 @@ static unsigned char eval_char_literal(const char *s);
%token DT_LSHIFT DT_RSHIFT DT_LE DT_GE DT_EQ DT_NE DT_AND DT_OR
%token DT_BITS
%token DT_DEL_PROP
+%token DT_APPEND_PROP
%token DT_DEL_NODE
%token <propnodename> DT_PROPNODENAME
%token <literal> DT_LITERAL
@@ -195,6 +196,10 @@ propdef:
{
$$ = build_property($1, empty_data);
}
+ | DT_APPEND_PROP DT_PROPNODENAME '=' propdata ';'
+ {
+ $$ = build_property_append($2, $4);
+ }
| DT_DEL_PROP DT_PROPNODENAME ';'
{
$$ = build_property_delete($2);diff --git a/dtc.h b/dtc.h
index 20e4d56..8687530 100644
--- a/dtc.h
+++ b/dtc.h
@@ -133,6 +133,7 @@ struct label {
};
struct property {
+ bool appended;
bool deleted;
char *name;
struct data val;@@ -186,6 +187,7 @@ void delete_labels(struct label **labels);
struct property *build_property(char *name, struct data val);
struct property *build_property_delete(char *name);
+struct property *build_property_append(char *name, struct data val);
struct property *chain_property(struct property *first, struct property *list);
struct property *reverse_properties(struct property *first);
diff --git a/livetree.c b/livetree.c
index b61465f..894e42b 100644
--- a/livetree.c
+++ b/livetree.c
@@ -74,6 +74,15 @@ struct property *build_property_delete(char *name)
return new;
}
+struct property *build_property_append(char *name, struct data val)
+{
+ struct property *new = build_property(name, val);
+
+ new->appended = 1;
+
+ return new;
+}
+
struct property *chain_property(struct property *first, struct property *list)
{
assert(first->next == NULL);@@ -167,7 +176,11 @@ struct node *merge_nodes(struct node *old_node, struct node *new_node)
for_each_label_withdel(new_prop->labels, l)
add_label(&old_prop->labels, l->label);
- old_prop->val = new_prop->val;
+ if (new_prop->appended)
+ old_prop->val = data_merge(old_prop->val, new_prop->val);
+ else
+ old_prop->val = new_prop->val;
+
old_prop->deleted = 0;
free(new_prop);
new_prop = NULL;
--
1.8.1.1