[Spice-devel,v2,43/43] Add some format checks with arrays

Submitted by Frediano Ziglio on July 8, 2015, 1:54 p.m.

Details

Message ID 1436363656-4266-44-git-send-email-fziglio@redhat.com
State New
Headers show

Not browsing as part of any series.

Commit Message

Frediano Ziglio July 8, 2015, 1:54 p.m.
Check different format or small arrays formatting.
Is possible to omit to have a tree and dump just the elements.
This is useful for small arrays or if is possible to format all
the item (for instance having a small structure) in a single line.

Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 codegen/check_dissector |  2 ++
 codegen/out_array2.txt  | 28 ++++++++++++++++++++++++++++
 codegen/test.proto      |  8 ++++++++
 3 files changed, 38 insertions(+)
 create mode 100644 codegen/out_array2.txt

Patch hide | download patch | download mbox

diff --git a/codegen/check_dissector b/codegen/check_dissector
index e2d06b5..7493d20 100755
--- a/codegen/check_dissector
+++ b/codegen/check_dissector
@@ -62,4 +62,6 @@  check data_u16s 1 102 out_array_struct.txt --client
 
 check data_base1 1 2 out_channel.txt
 
+check data_u16s 1 103 out_array2.txt --client
+
 exit 0
diff --git a/codegen/out_array2.txt b/codegen/out_array2.txt
new file mode 100644
index 0000000..f695ca1
--- /dev/null
+++ b/codegen/out_array2.txt
@@ -0,0 +1,28 @@ 
+--- tree
+    --- item
+    Text: small[0]: 0
+    Name: small
+    Abbrev: spice2.auto.Array2_array_small
+    Type: FT_UINT16
+    Base: BASE_DEC
+    --- item
+    Text: small[1]: 1
+    Name: small
+    Abbrev: spice2.auto.Array2_array_small
+    Type: FT_UINT16
+    Base: BASE_DEC
+    --- item
+    Text: Small array
+        --- tree
+            --- item
+            Text: small_named[0]: 2
+            Name: small_named
+            Abbrev: spice2.auto.Array2_array_small_named
+            Type: FT_UINT16
+            Base: BASE_DEC
+            --- item
+            Text: small_named[1]: 3
+            Name: small_named
+            Abbrev: spice2.auto.Array2_array_small_named
+            Type: FT_UINT16
+            Base: BASE_DEC
diff --git a/codegen/test.proto b/codegen/test.proto
index c58ef7d..0c2915b 100644
--- a/codegen/test.proto
+++ b/codegen/test.proto
@@ -55,6 +55,13 @@  message ArrayStruct {
     Dummy array4[4];
 };
 
+message Array2 {
+    /* small arrays, format with text and numbers, no tree generated */
+    uint16 @ws_txt("small[%u]: %u", INDEX, small) small[2];
+    /* small arrays, format with text and numbers, tree generated due to description */
+    uint16 @ws_txt("small_named[%u]: %u", INDEX, small_named) small_named[2] @ws_desc("Small array");
+};
+
 channel BaseChannel {
   server:
     message {
@@ -86,6 +93,7 @@  channel BaseChannel {
     ArrayPrimitive array_primitive = 100;
     ArrayRaw array_raw;
     ArrayStruct array_struct;
+    Array2 array2;
 };
 
 channel Test1Channel: BaseChannel {