Repository: Konstantin8105/c4go
Pull request #498 (2021-04-23 08:03:58)

fix script neatpost

codecov[bot]: # [Codecov](https://codecov.io/gh/Konstantin8105/c4go/pull/498?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin) Report
> Merging [#498](https://codecov.io/gh/Konstantin8105/c4go/pull/498?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin) (35c7993) into [master](https://codecov.io/gh/Konstantin8105/c4go/commit/a668ca54f8eda007c956f8d111f7fd719c1a454f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin) (a668ca5) will **not change** coverage.
> The diff coverage is `n/a`.

> :exclamation: Current head 35c7993 differs from pull request most recent head 391dc65. Consider uploading reports for the commit 391dc65 to get more accurate results
[![Impacted file tree graph](https://codecov.io/gh/Konstantin8105/c4go/pull/498/graphs/tree.svg?width=650&height=150&src=pr&token=esH2rHXlZ2&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin)](https://codecov.io/gh/Konstantin8105/c4go/pull/498?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin)

```diff
@@           Coverage Diff           @@
##           master     #498   +/-   ##
=======================================
  Coverage   82.75%   82.75%           
=======================================
  Files         193      193           
  Lines       10857    10857           
=======================================
  Hits         8985     8985           
  Misses       1360     1360           
  Partials      512      512           
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/Konstantin8105/c4go/pull/498?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/Konstantin8105/c4go/pull/498?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin). Last update [a668ca5...391dc65](https://codecov.io/gh/Konstantin8105/c4go/pull/498?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=Konstantin).


Patch:
diff --git a/program/program.go b/program/program.go
index 4a4f466..2a4c9c0 100644
--- a/program/program.go
+++ b/program/program.go
@@ -364,6 +364,153 @@ type simpleDefer struct {
 }
 
 func (s simpleDefer) Visit(node goast.Node) (w goast.Visitor) {
+	// from :
+	//		{
+	//			.....
+	//			func() []byte {
+	//				tempVarUnary := sstr_s
+	//				defer func() {
+	//					sstr_s = f(sstr_s, int(-1))
+	//				}()
+	//				return tempVarUnary
+	//			}()
+	//			.....
+	//		}
+	//		0: *ast.ExprStmt {
+	//		.  X: *ast.CallExpr {
+	//		.  .  Fun: *ast.FuncLit {
+	//		.  .  .  Type: *ast.FuncType {
+	//		.  .  .  .  Func: 4:2
+	//		.  .  .  .  Params: *ast.FieldList {
+	//		.  .  .  .  }
+	//		.  .  .  .  Results: *ast.FieldList {
+	//		.  .  .  .  .  Opening: -
+	//		.  .  .  .  .  List: []*ast.Field (len = 1) {
+	//		.  .  .  .  .  .  0: *ast.Field {
+	//		.  .  .  .  .  .  .  Type: *ast.ArrayType {
+	//		.  .  .  .  .  .  .  .  Elt: *ast.Ident {
+	//		.  .  .  .  .  .  .  .  .  Name: "byte"
+	//		.  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  }
+	//		.  .  .  .  .  }
+	//		.  .  .  .  .  Closing: -
+	//		.  .  .  .  }
+	//		.  .  .  }
+	//		.  .  .  Body: *ast.BlockStmt {
+	//		.  .  .  .  Lbrace: 4:16
+	//		.  .  .  .  List: []ast.Stmt (len = 3) {
+	//		.  .  .  .  .  0: *ast.AssignStmt {
+	//		.  .  .  .  .  .  Lhs: []ast.Expr (len = 1) {
+	//		.  .  .  .  .  .  .  0: *ast.Ident {
+	//		.  .  .  .  .  .  .  .  NamePos: 5:3
+	//		.  .  .  .  .  .  .  .  Name: "tempVarUnary"
+	//		.  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  }
+	//		.  .  .  .  .  .  TokPos: 5:16
+	//		.  .  .  .  .  .  Tok: :=
+	//		.  .  .  .  .  .  Rhs: []ast.Expr (len = 1) {
+	//		.  .  .  .  .  .  .  0: *ast.Ident {
+	//		.  .  .  .  .  .  .  .  Name: "sstr_s"
+	//		.  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  }
+	//		.  .  .  .  .  }
+	//		.  .  .  .  .  1: *ast.DeferStmt {
+	//		.  .  .  .  .  .  Defer: 6:3
+	//		.  .  .  .  .  .  Call: *ast.CallExpr {
+	//		.  .  .  .  .  .  .  Fun: *ast.FuncLit {
+	//		.  .  .  .  .  .  .  .  Type: *ast.FuncType {
+	//		.  .  .  .  .  .  .  .  .  Func: 6:9
+	//		.  .  .  .  .  .  .  .  .  Params: *ast.FieldList {
+	//		.  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  Body: *ast.BlockStmt {
+	//		.  .  .  .  .  .  .  .  .  Lbrace: 6:16
+	//		.  .  .  .  .  .  .  .  .  List: []ast.Stmt (len = 1) {
+	//		.  .  .  .  .  .  .  .  .  .  0: *ast.AssignStmt {
+	//		.  .  .  .  .  .  .  .  .  .  .  Lhs: []ast.Expr (len = 1) {
+	//		.  .  .  .  .  .  .  .  .  .  .  .  0: *ast.Ident {
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  Name: "sstr_s"
+	//		.  .  .  .  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  .  .  .  TokPos: 7:11
+	//		.  .  .  .  .  .  .  .  .  .  .  Tok: =
+	//		.  .  .  .  .  .  .  .  .  .  .  Rhs: []ast.Expr (len = 1) {
+	//		.  .  .  .  .  .  .  .  .  .  .  .  0: *ast.CallExpr {
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  Fun: *ast.Ident {
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  .  Name: "f"
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  Lparen: 7:14
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  Args: []ast.Expr (len = 1) {
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  .  0: *ast.Ident {
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Name: "sstr_s"
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  }
+	//		.  .  .  .  .  }
+	//		.  .  .  .  .  2: *ast.ReturnStmt {
+	//		.  .  .  .  .  .  Return: 9:3
+	//		.  .  .  .  .  .  Results: []ast.Expr (len = 1) {
+	//		.  .  .  .  .  .  .  0: *ast.Ident {
+	//		.  .  .  .  .  .  .  .  Name: "tempVarUnary"
+	//		.  .  .  .  .  .  .  }
+	//		.  .  .  .  .  .  }
+	//		.  .  .  .  .  }
+	//		.  .  .  .  }
+	//		.  .  .  }
+	//		.  .  }
+	//		.  }
+	// to   :
+	//		{
+	//			.....
+	//			sstr_s = c4goPointerArithByteSlice(sstr_s, int(-1))
+	//			.....
+	//		}
+
+	// 	from:
+	//		func f4() {
+	//			{
+	//				var i int32
+	//				for ; i < 10; i++ {
+	//				}
+	//			}
+	//		}
+	// to   :
+	//		func f4() {
+	//			var i int32
+	//			for ; i < 10; i++ {
+	//			}
+	//		}
+	if fd, ok := node.(*goast.FuncDecl); ok && len(fd.Body.List) == 1 {
+		if ib, ok := fd.Body.List[0].(*goast.BlockStmt); ok {
+			fd.Body = ib // internal body
+		}
+	}
+	// 	from:
+	//		 {
+	//			{
+	//				var i int32
+	//				for ; i < 10; i++ {
+	//				}
+	//			}
+	//		}
+	// to   :
+	//		{
+	//			var i int32
+	//			for ; i < 10; i++ {
+	//			}
+	//		}
+	if eb, ok := node.(*goast.BlockStmt); ok && len(eb.List) == 1 {
+		if ib, ok := eb.List[0].(*goast.BlockStmt); ok {
+			eb = ib // internal body
+		}
+	}
 	// Simplification from :
 	//	var cc int32 = int32(uint8((func() []byte {
 	//		defer func() {
diff --git a/scripts/9wm.sh b/scripts/9wm.sh
index 8e69936..3914816 100755
--- a/scripts/9wm.sh
+++ b/scripts/9wm.sh
@@ -43,7 +43,9 @@ echo "Calculate warnings : $TEMP_FOLDER"
 # amount unsafe
 	UNSAFE=`cat $FILE | grep "unsafe\." | wc -l`
 	echo "		Unsafe   : $UNSAFE"
-
+# amount Go code lines
+	LINES=`wc $FILE`
+	echo "(lines,words,bytes)	 : $LINES"
 
 # Arguments menu
 echo "    -s for show detail of Go build errors"
diff --git a/scripts/brainfuck.sh b/scripts/brainfuck.sh
index ca056a9..9274b41 100755
--- a/scripts/brainfuck.sh
+++ b/scripts/brainfuck.sh
@@ -51,6 +51,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/easymesh.sh b/scripts/easymesh.sh
index dc062e0..85996db 100755
--- a/scripts/easymesh.sh
+++ b/scripts/easymesh.sh
@@ -82,6 +82,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 # debugging
 if [ "$1" == "-d" ]; then
diff --git a/scripts/ed.sh b/scripts/ed.sh
index d8c74e9..f398d20 100755
--- a/scripts/ed.sh
+++ b/scripts/ed.sh
@@ -46,6 +46,9 @@ echo "Calculate warnings : $TEMP_FOLDER"
 # amount unsafe
 	UNSAFE=`cat $FILE | grep "unsafe\." | wc -l`
 	echo "		Unsafe   : $UNSAFE"
+# amount Go code lines
+	LINES=`wc $TEMP_FOLDER/$VERSION.go`
+	echo "(lines,words,bytes)	 : $LINES"
 
 # Arguments menu
 echo "    -s for show detail of Go build errors"
diff --git a/scripts/kilo.sh b/scripts/kilo.sh
index 096ba69..7725138 100755
--- a/scripts/kilo.sh
+++ b/scripts/kilo.sh
@@ -50,6 +50,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 # debugging
 if [ "$1" == "-d" ]; then
diff --git a/scripts/minmad.sh b/scripts/minmad.sh
index 975d85c..a1724df 100755
--- a/scripts/minmad.sh
+++ b/scripts/minmad.sh
@@ -50,6 +50,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/neateqn.sh b/scripts/neateqn.sh
index a5a13f9..adbf351 100755
--- a/scripts/neateqn.sh
+++ b/scripts/neateqn.sh
@@ -53,6 +53,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/neatmail.sh b/scripts/neatmail.sh
index 45d3062..444c9e7 100755
--- a/scripts/neatmail.sh
+++ b/scripts/neatmail.sh
@@ -53,6 +53,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/neatmkfn.sh b/scripts/neatmkfn.sh
index 89c3728..fc9fef4 100755
--- a/scripts/neatmkfn.sh
+++ b/scripts/neatmkfn.sh
@@ -53,6 +53,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/neatpost.sh b/scripts/neatpost.sh
index 62f059b..fa4d84f 100755
--- a/scripts/neatpost.sh
+++ b/scripts/neatpost.sh
@@ -14,7 +14,7 @@ mkdir -p ./testdata/
 	export TEMP_FOLDER="./testdata/$NAME"
 	export GO_FILE="$TEMP_FOLDER/$NAME.go"
 	export GO_APP="$TEMP_FOLDER/$NAME.app"
-	export COMMIT=14fafdadb05a2ea128a8aa3ce43ac2010f77c5e0
+	export COMMIT=393011f64e853e3e2dec6950aab8c90ef12832b9
 
 # prepare C code
     if [ ! -d $TEMP_FOLDER ]; then
@@ -23,11 +23,32 @@ mkdir -p ./testdata/
 		cd $TEMP_FOLDER/
 		git checkout $COMMIT
 		cd ../../
-		sed -i.bak '92,98d' $TEMP_FOLDER/font.c
-		sed -i.bak '163,173d;158,161d;152,156d;145,150d;139,143d;133,137d;128,131d;123,127d;109,121d;90,107d;80,88d;58,78d;47,56d;42,45d;33,40d;8d' $TEMP_FOLDER/ps.c
-		sed -i.bak '219,232d;212,217d;204,210d;196,202d;179,194d;175,177d;131,173d' $TEMP_FOLDER/ps.c
-		sed -i.bak '238,262d;123,129d;116,121d;109,114d;102,107d;95,100d;82,93d;73,80d;65,71d;57,63d' $TEMP_FOLDER/ps.c
-		sed -i.bak '47d;46d;11d;10d;9d' $TEMP_FOLDER/ps.c
+		# run 
+		# ./scripts/neatpost.sh -s 2>&1| grep "ps.c" | grep redef
+ 		sed -i.bak '92,98d  s/^/\/\/ /' $TEMP_FOLDER/font.c
+		sed -i.bak '110,122 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '124,127 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '129,132 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '134,138 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '140,144 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '147,152 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '153,157 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '159,162 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '164,174 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '187,193 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '196,367 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '34,41   s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '369,375 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '377,397 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '43,46   s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '48,57   s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '500,524 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '59,79   s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '8       s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '11,13   s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '176,177 s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '82,89   s/^/\/\/ /' $TEMP_FOLDER/ps.c
+		sed -i.bak '91,108  s/^/\/\/ /' $TEMP_FOLDER/ps.c
 	fi
 
 # remove go files from last transpilation
@@ -56,6 +77,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/neatrefer.sh b/scripts/neatrefer.sh
index 274bca7..1e60322 100755
--- a/scripts/neatrefer.sh
+++ b/scripts/neatrefer.sh
@@ -51,6 +51,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/neatroff.sh b/scripts/neatroff.sh
index 66485b9..499ca89 100755
--- a/scripts/neatroff.sh
+++ b/scripts/neatroff.sh
@@ -64,6 +64,9 @@ fi
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/neatvi.sh b/scripts/neatvi.sh
index 2437f48..4f54be5 100755
--- a/scripts/neatvi.sh
+++ b/scripts/neatvi.sh
@@ -54,6 +54,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/progress.sh b/scripts/progress.sh
index 57f82ee..f5c0cdf 100755
--- a/scripts/progress.sh
+++ b/scripts/progress.sh
@@ -52,6 +52,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/scripts.sh b/scripts/scripts.sh
index a28c3bd..cbc31a1 100755
--- a/scripts/scripts.sh
+++ b/scripts/scripts.sh
@@ -9,67 +9,67 @@ export VERIFICATION_FILE="./scripts/scripts.txt"
 
 echo "" > $OUTPUT_FILE
 
-./scripts/brainfuck.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/brainfuck.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/9wm.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/9wm.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-# ./scripts/cis71.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+# ./scripts/cis71.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 # echo "" >> $OUTPUT_FILE
 
-./scripts/ed.sh			2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/ed.sh			2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/kilo.sh			2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/kilo.sh			2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/minmad.sh			2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/minmad.sh			2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/neateqn.sh	2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/neateqn.sh	2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/neatmkfn.sh	2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/neatmkfn.sh	2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/neatmail.sh	2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/neatmail.sh	2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/neatpost.sh	2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/neatpost.sh	2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/neatrefer.sh	2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/neatrefer.sh	2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/nuklear.sh	2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/nuklear.sh	2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/neatroff.sh	2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/neatroff.sh	2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/redis.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/redis.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/neatvi.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/neatvi.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/triangle.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/triangle.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/progress.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/progress.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/sqlite.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/sqlite.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/tiny_web_server.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/tiny_web_server.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/vorbis.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/vorbis.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
-./scripts/easymesh.sh		2>&1 | grep -E 'warning|unsafe|Unsafe' | tee -a $OUTPUT_FILE
+./scripts/easymesh.sh		2>&1 | grep -E 'warning|unsafe|Unsafe|lines' | tee -a $OUTPUT_FILE
 echo "" >> $OUTPUT_FILE
 
 # Arguments menu
diff --git a/scripts/scripts.txt b/scripts/scripts.txt
index 29e61ad..e6cb2dd 100644
--- a/scripts/scripts.txt
+++ b/scripts/scripts.txt
@@ -3,39 +3,51 @@ Calculate warnings in file: ./testdata/brainfuck/brainfuck.go
 		After transpiling : 0 warnings.
 		Go build : 0 warnings
 		Unsafe   : 0
+(lines,words,bytes)	 :  186  639 4528 ./testdata/brainfuck/brainfuck.go
 
 Calculate warnings : ./testdata/9wm
 		After transpiling : 3 warnings.
 		Go build : 4 warnings
 		Unsafe   : 415
+(lines,words,bytes)	 :  10078  31716 346498 ./testdata/9wm/9wm.go
 
 Calculate warnings : ./testdata/ed
 		After transpiling : 0 warnings.
 		Go build : 7 warnings
 		Unsafe   : 165
+(lines,words,bytes)	 :   7023  23684 233822 ./testdata/ed/ed-1.15.go
 
 Calculate warnings in file: ./testdata/kilo/kilo.go
 		After transpiling : 0 warnings.
 		Go build : 0 warnings
 		Unsafe   : 17
+(lines,words,bytes)	 :  1772  7132 52429 ./testdata/kilo/kilo.go
 
 
 Calculate warnings in file: ./testdata/neateqn/neateqn.go
 		After transpiling : 0 warnings.
 		Go build : 0 warnings
 		Unsafe   : 75
+(lines,words,bytes)	 :   4772  17456 200976 ./testdata/neateqn/neateqn.go
 
 Calculate warnings in file: ./testdata/neatmkfn/neatmkfn.go
 		After transpiling : 0 warnings.
 		Go build : 271 warnings
 		Unsafe   : 141
+(lines,words,bytes)	 :   4844  29510 444311 ./testdata/neatmkfn/neatmkfn.go
 
 
+Calculate warnings in file: ./testdata/neatpost/neatpost.go
+		After transpiling : 2 warnings.
+		Go build : 5 warnings
+		Unsafe   : 47
+(lines,words,bytes)	 :   4299  15821 390186 ./testdata/neatpost/neatpost.go
 
 Calculate warnings in file: ./testdata/neatrefer/neatrefer.go
 		After transpiling : 0 warnings.
 		Go build : 0 warnings
 		Unsafe   : 17
+(lines,words,bytes)	 :  1047  3640 27194 ./testdata/neatrefer/neatrefer.go
 
 Calculate warnings : ./testdata/nuklear/x11.go
 		After transpiling : 9 warnings.
@@ -50,6 +62,7 @@ Calculate warnings in file: ./testdata/neatroff/neatroff.go
 		After transpiling : 2 warnings.
 		Go build : 5 warnings
 		Unsafe   : 247
+(lines,words,bytes)	 :  12720  49874 410282 ./testdata/neatroff/neatroff.go
 
 Calculate warnings : ./testdata/redis/dict.go
 		After transpiling : 0 warnings.
@@ -73,11 +86,13 @@ Calculate warnings in file: ./testdata/triangle/triangle.go
 		After transpiling : 2 warnings.
 		Go build : 585 warnings
 		Unsafe   : 1414
+(lines,words,bytes)	 :  16553  83432 743181 ./testdata/triangle/triangle.go
 
 Calculate warnings in file: ./testdata/progress/progress.go
 		After transpiling : 0 warnings.
 		Go build : 16 warnings
 		Unsafe   : 6
+(lines,words,bytes)	 :  242  675 7463 ./testdata/progress/progress.go
 
 Calculate warnings in file: ./testdata/SQLITE/sqlite.go
 		After transpiling : 1 warnings.
@@ -88,14 +103,17 @@ Calculate warnings in file: ./testdata/tiny-web-server/tiny-web-server.go
 		After transpiling : 0 warnings.
 		Go build : 2 warnings
 		Unsafe   : 151
+(lines,words,bytes)	 :   3619  11276 133612 ./testdata/tiny-web-server/tiny-web-server.go
 
 Calculate warnings in file: testdata/vorbis/vorbis.go
 		After transpiling : 0 warnings.
 		Go build : 19 warnings
 		Unsafe   : 127
+(lines,words,bytes)	 :   7126  30221 270224 testdata/vorbis/vorbis.go
 
 Calculate warnings in file: ./testdata/easymesh/easymesh.go
 		After transpiling : 0 warnings.
 		Go build : 0 warnings
 		Unsafe   : 10
+(lines,words,bytes)	 :  2599  9101 73376 ./testdata/easymesh/easymesh.go
 
diff --git a/scripts/tiny_web_server.sh b/scripts/tiny_web_server.sh
index a2f12db..abe1daf 100755
--- a/scripts/tiny_web_server.sh
+++ b/scripts/tiny_web_server.sh
@@ -52,6 +52,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/triangle.sh b/scripts/triangle.sh
index d3e43a2..bb834fb 100755
--- a/scripts/triangle.sh
+++ b/scripts/triangle.sh
@@ -46,6 +46,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu
diff --git a/scripts/vorbis.sh b/scripts/vorbis.sh
index 59275ae..1e990b0 100755
--- a/scripts/vorbis.sh
+++ b/scripts/vorbis.sh
@@ -51,6 +51,9 @@ mkdir -p ./testdata/
 	# amount unsafe
 		UNSAFE=`cat $GO_FILE | grep "unsafe\." | wc -l`
 		echo "		Unsafe   : $UNSAFE"
+	# amount Go code lines
+		LINES=`wc $GO_FILE`
+		echo "(lines,words,bytes)	 : $LINES"
 
 
 # Arguments menu


Test patch:
diff --git a/tests/code_quality/ap.go.expected b/tests/code_quality/ap.go.expected
index 8d7393f..02974de 100644
--- a/tests/code_quality/ap.go.expected
+++ b/tests/code_quality/ap.go.expected
@@ -20,11 +20,9 @@ func a(v1 []int32) {
 
 // b - transpiled function from  C4GO/tests/code_quality/ap.c:7
 func b(v1 []int32, size int32) {
-	{
-		// input argument - C-array
-		for size -= 1; size >= 0; size-- {
-			noarch.Printf([]byte("b: %d %d\n\x00"), size, v1[size])
-		}
+	// input argument - C-array
+	for size -= 1; size >= 0; size-- {
+		noarch.Printf([]byte("b: %d %d\n\x00"), size, v1[size])
 	}
 }
 
diff --git a/tests/code_quality/for.c b/tests/code_quality/for.c
index 740181b..4edb101 100644
--- a/tests/code_quality/for.c
+++ b/tests/code_quality/for.c
@@ -15,6 +15,14 @@ void f2()
 }
 
 void f3()
+{
+	int i = 3;
+    for (i = 0; i < 10; i++) {
+        ;
+    }
+}
+
+void f4()
 {
     for (int i = 0; i < 10; i++) {
         ;
diff --git a/tests/code_quality/for.go.expected b/tests/code_quality/for.go.expected
index 367321a..2300897 100644
--- a/tests/code_quality/for.go.expected
+++ b/tests/code_quality/for.go.expected
@@ -23,9 +23,14 @@ func f2() {
 
 // f3 - transpiled function from  C4GO/tests/code_quality/for.c:17
 func f3() {
-	{
-		var i int32
-		for ; i < 10; i++ {
-		}
+	var i int32 = 3
+	for i = 0; i < 10; i++ {
+	}
+}
+
+// f4 - transpiled function from  C4GO/tests/code_quality/for.c:25
+func f4() {
+	var i int32
+	for ; i < 10; i++ {
 	}
 }
diff --git a/tests/code_quality/function.c b/tests/code_quality/function.c
new file mode 100644
index 0000000..5033f1a
--- /dev/null
+++ b/tests/code_quality/function.c
@@ -0,0 +1,20 @@
+static char *sstr_s;
+char sstr_bufs[10];
+int sstr_n;
+
+char *sstr_pop(void)
+{
+	char *ret = sstr_s;
+	sstr_s = sstr_bufs[--sstr_n];
+	return ret;
+}
+
+int sstr_next(void)
+{
+	return *sstr_s ? (unsigned char) *sstr_s++ : -1;
+}
+
+void sstr_back(int c)
+{
+	sstr_s--;
+}
diff --git a/tests/code_quality/function.go.expected b/tests/code_quality/function.go.expected
new file mode 100644
index 0000000..b2ed4cb
--- /dev/null
+++ b/tests/code_quality/function.go.expected
@@ -0,0 +1,78 @@
+//
+//	Package - transpiled by c4go
+//
+//	If you have found any issues, please raise an issue at:
+//	https://github.com/Konstantin8105/c4go/
+//
+
+package code_quality
+
+import "reflect"
+import "runtime"
+import "unsafe"
+
+// sstr_s - transpiled function from  C4GO/tests/code_quality/function.c:1
+var sstr_s []byte
+
+// sstr_bufs - transpiled function from  C4GO/tests/code_quality/function.c:2
+var sstr_bufs []byte = make([]byte, 10)
+
+// sstr_n - transpiled function from  C4GO/tests/code_quality/function.c:3
+var sstr_n int32
+
+// sstr_pop - transpiled function from  C4GO/tests/code_quality/function.c:5
+func sstr_pop() []byte {
+	var ret []byte = sstr_s
+	sstr_s = sstr_bufs[func() int32 {
+		sstr_n--
+		return sstr_n
+	}():]
+	return ret
+}
+
+// sstr_next - transpiled function from  C4GO/tests/code_quality/function.c:12
+func sstr_next() int32 {
+	return func() int32 {
+		if int32(sstr_s[0]) != 0 {
+			return int32(uint8((func() []byte {
+				defer func() {
+					sstr_s = sstr_s[0+1:]
+				}()
+				return sstr_s
+			}())[0]))
+		}
+		return -1
+	}()
+}
+
+// sstr_back - transpiled function from  C4GO/tests/code_quality/function.c:17
+func sstr_back(c int32) {
+	func() []byte {
+		tempVarUnary := sstr_s
+		defer func() {
+			sstr_s = c4goPointerArithByteSlice(sstr_s, int(-1))
+		}()
+		return tempVarUnary
+	}()
+}
+
+// c4goPointerArithByteSlice - function of pointer arithmetic. generated by c4go
+func c4goPointerArithByteSlice(slice []byte, position int) []byte {
+	if position < 0 {
+		// invert sign
+		position = -position
+
+		// Example from: go101.org/article/unsafe.html
+		// repair size of slice
+		var hdr reflect.SliceHeader
+		sliceLen := len(slice)
+		hdr.Data = uintptr(unsafe.Pointer(&slice[0])) - (uintptr(position))*unsafe.Sizeof(slice[0])
+		runtime.KeepAlive(&slice[0]) // needed!
+		hdr.Len = sliceLen + int(position)
+		hdr.Cap = hdr.Len
+		slice = *((*[]byte)(unsafe.Pointer(&hdr)))
+		return slice
+	}
+	// position >= 0:
+	return slice[position:]
+}