git » fp-git.git » commit 71224b3

group modifier parsing

author ecalot
2004-10-27 19:17:02 UTC
committer ecalot
2004-10-27 19:17:02 UTC
parent 932c90bae4beea9632fd02bffb6dcde4646b7be6

group modifier parsing

FP/src/conf/awk/tiles_conf_groups.awk +20 -6

diff --git a/FP/src/conf/awk/tiles_conf_groups.awk b/FP/src/conf/awk/tiles_conf_groups.awk
index 691f658..3fd6f3d 100644
--- a/FP/src/conf/awk/tiles_conf_groups.awk
+++ b/FP/src/conf/awk/tiles_conf_groups.awk
@@ -34,9 +34,17 @@
 
 $0 !~ /^[ ]*(#.*|tile .*|[ ]*)$/ {
 	for (i=1;i<=NF;i++) {
-		if (!total[$i]) total[$i]=0
-		groups[$i,total[$i]]=tile
-		total[$i]++;
+		group=$i
+		back=0
+		if (group ~ /@/) {
+			split(group,a,"@")
+			group=a[1]
+			back=a[2]+1
+		}
+		if (!total[group]) total[group]=0
+		groups[group,total[group]]=tile
+		backs[group,total[group]]=back
+		total[group]++;
 	}
 }
 
@@ -47,9 +55,15 @@ END {
 	for (group in total) {
 		offsets[group]=offset
 		for (i=0;i<total[group];i++) {
-			printf "%s%s+1",coma,groups[group,i]
-			coma=","
-			offset++
+			if (backs[group,total[group]]) { #if there is a back selected add them
+				printf "%s%s+1,%d",coma,groups[group,i]+128,backs[group,total[group]]
+				coma=","
+				offset+=2
+			} else {
+				printf "%s%s+1",coma,groups[group,i]
+				coma=","
+				offset++
+			}
 			if (offset%5==0) printf("\\\n")
 		}
 		printf ",0"