OSDN Git Service

[MISC] Add function extraction script.
authorK.Ohta <whatisthis.sowhat@gmail.com>
Wed, 17 Oct 2018 09:43:24 +0000 (18:43 +0900)
committerK.Ohta <whatisthis.sowhat@gmail.com>
Wed, 17 Oct 2018 09:43:24 +0000 (18:43 +0900)
source/tool/misc/cut-function.awk [new file with mode: 0644]

diff --git a/source/tool/misc/cut-function.awk b/source/tool/misc/cut-function.awk
new file mode 100644 (file)
index 0000000..41ef8c5
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/gawk
+#
+# This is auto-extract filter for specified function(s) for CSP classes.
+# 2018-10-17 K.Ohta.<whatisthis.sowhat@gmail.com>
+# License: GPLv2.
+BEGIN {
+       __N_BEGIN=0;
+       __STACK=0;
+}
+
+# Set function name as regexp.
+/^bool.*::process_state.*$/ {
+       print $0;
+       __N_BEGIN=1;
+       __STACK=0;
+}
+
+# Set function name as regexp.
+/^bool.*::decl_state.*$/ {
+       print $0;
+       __N_BEGIN=1;
+       __STACK=0;
+}
+
+/^{.*$/ {
+       if(__N_BEGIN != 0)      {
+               __STACK=1;#print $0;
+       }
+}
+/^}.*$/ {
+       if(__STACK != 0) print $0;
+       __STACK=0;
+       __N_BEGIN=0;
+}
+
+/^.*$/ {
+       if(__STACK != 0) print $0;
+}