shithub: gofs

Download patch

ref: ed5040c6bf4539dc10cfb1af06dd6240f2d309e0
parent: 895af3a6c0ece7ed089ee2a5356cb1933a30cca3
author: sirjofri <sirjofri@sirjofri.de>
date: Sat Dec 13 17:51:18 EST 2025

make filesystem name (getter function) based on the description file

this should allow for multiple filesystem definitions in the same program

--- a/fns.h
+++ b/fns.h
@@ -4,7 +4,7 @@
 int setstone(Gogame*, Vec pos, Gostone);
 int passround(Gogame*, Gostone);
 
-Srv *getgenfs(void);
+Srv *getfs_fs(void);
 
 #define V(a, b) (Vec){(a), (b)}
 Vec _vec_pos_(Vec a);
--- a/game.c
+++ b/game.c
@@ -190,4 +190,5 @@
 static void
 validateboard(Gogame *game)
 {
+	// TODO: validate the board. Remove captured groups, etc.
 }
--- a/main.c
+++ b/main.c
@@ -34,7 +34,7 @@
 	
 	game1 = newgame(V(19, 19));
 	
-	fs = getgenfs();
+	fs = getfs_fs();
 	postmountsrv(fs, srvname, mtpt, MREPL);
 	exits(nil);
 }
--- a/mkfs.awk
+++ b/mkfs.awk
@@ -134,7 +134,12 @@
 	print("}");
 	print("");
 	print("Srv*");
-	print("getgenfs()");
+	
+	genname = FILENAME;
+	sub(/\.fs/, "", genname);
+	gsub(/\./, "_", genname);
+	
+	printf("getfs_%s()", genname);
 	print("{");
 	print("	fs.tree = alloctree(nil, nil, DMDIR|0777, nil);");
 	print("	populatetree();");
--