aboutsummaryrefslogtreecommitdiff
path: root/test/ppu-stm-integration-demo/data2test.awk
diff options
context:
space:
mode:
Diffstat (limited to 'test/ppu-stm-integration-demo/data2test.awk')
-rwxr-xr-xtest/ppu-stm-integration-demo/data2test.awk15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ppu-stm-integration-demo/data2test.awk b/test/ppu-stm-integration-demo/data2test.awk
new file mode 100755
index 0000000..286a388
--- /dev/null
+++ b/test/ppu-stm-integration-demo/data2test.awk
@@ -0,0 +1,15 @@
+#!/bin/awk -f
+BEGIN {
+ print "#pragma once"
+ print "#include <stdint.h>"
+ printf("const uint8_t HH_PPUINTDEMO_ARR[] = { ")
+}
+
+length($1) == 4 && length($2) == 4 {
+ printf "0x"substr($1,1,2)", 0x"substr($1,3,2)", 0x"substr($2,1,2)", 0x"substr($2,3,2)", "
+}
+
+END {
+ printf("};\n") # close array
+ printf("#define HH_PPUINTDEMO_LENGTH %d\n", NR*4) # calculate array length
+}