From a12c6a014b43040b684f65d5879fa003b2131736 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Tue, 4 Apr 2017 01:39:56 +0000 Subject: [PATCH] mpers.awk: prepare for adding support of multidimensional arrays * mpers.awk (what_is) : Move formatting of array upper_bound ... : ... here. --- mpers.awk | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/mpers.awk b/mpers.awk index 2283b966..b9805421 100644 --- a/mpers.awk +++ b/mpers.awk @@ -104,7 +104,7 @@ function what_is(what_idx, type_idx, special, item, \ if ("" == to_return) to_return = 0 returned_size = to_return * returned_size - return leave(what_idx, to_return) + return leave(what_idx, "[" to_return "]") break case "structure_type": print "struct {" @@ -125,11 +125,7 @@ function what_is(what_idx, type_idx, special, item, \ prev_location = location returned = what_is(item) prev_returned_size = returned_size - printf("%s", array[item]["name"]) - if ("" != returned) { - printf("[%s]", returned) - } - print ";" + printf("%s%s;\n", array[item]["name"], returned) } } returned_size = array_get(what_idx, "byte_size") @@ -146,11 +142,7 @@ function what_is(what_idx, type_idx, special, item, \ if ("parent" in array[item] && \ array_get(item, "parent") == what_idx) { returned = what_is(item) - printf("%s", array[item]["name"]) - if ("" != returned) { - printf("[%s]", returned) - } - print ";" + printf("%s%s;\n", array[item]["name"], returned) } } printf("} ") -- 2.49.0