diff options
author | Grant Likely <grant.likely@arm.com> | 2018-05-15 17:42:54 -0500 |
---|---|---|
committer | David Gibson <david@gibson.dropbear.id.au> | 2018-06-04 18:50:07 +1000 |
commit | 44d3efedc81618e2d51ebbc2305ff020d1107988 (patch) | |
tree | 111fb59d82b1fefeddeb74e39b0b233338fff487 /data.c | |
parent | f0be81bd8de093e1c775e62b92449c9773e7f732 (diff) | |
download | device-tree-compiler-44d3efedc81618e2d51ebbc2305ff020d1107988.tar.gz |
Preserve datatype information when parsing dts
The current code throws away all the data type and grouping information
when parsing the DTS source file, which makes it difficult to
reconstruct the data format when emitting a format that can express data
types (ie. dts and yaml). Use the marker structure to mark the beginning
of each integer array block (<> and []), and the datatype contained in
each (8, 16, 32 & 64 bit widths).
Signed-off-by: Grant Likely <grant.likely@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
[robh: s/MARKER_/TYPE_/]
Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'data.c')
-rw-r--r-- | data.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -74,7 +74,8 @@ struct data data_copy_escape_string(const char *s, int len) struct data d; char *q; - d = data_grow_for(empty_data, len + 1); + d = data_add_marker(empty_data, TYPE_STRING, NULL); + d = data_grow_for(d, len + 1); q = d.val; while (i < len) { @@ -94,6 +95,7 @@ struct data data_copy_file(FILE *f, size_t maxlen) { struct data d = empty_data; + d = data_add_marker(d, TYPE_BLOB, NULL); while (!feof(f) && (d.len < maxlen)) { size_t chunksize, ret; |