--- /dev/null
+/* magscrolls.c Treaty of Babel module for Z-code files\r
+ * 2006 By L. Ross Raszewski\r
+ *\r
+ * This file depends on treaty_builder.h\r
+ *\r
+ * This file is public domain, but note that any changes to this file\r
+ * may render it noncompliant with the Treaty of Babel\r
+ */\r
+\r
+#define FORMAT magscrolls\r
+#define HOME_PAGE "http://www.if-legends.org/~msmemorial/memorial.htm"\r
+#define FORMAT_EXT ".mag"\r
+#define NO_COVER\r
+#define NO_METADATA\r
+\r
+#include "treaty_builder.h"\r
+#include <ctype.h>\r
+#include <stdio.h>\r
+\r
+struct maginfo\r
+{\r
+ int gv;\r
+ char header[21];\r
+ char *title;\r
+ int bafn;\r
+ int year;\r
+ char *ifid;\r
+ char *author;\r
+ char *meta;\r
+};\r
+\r
+\r
+static struct maginfo manifest[] = {\r
+ { 0, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",\r
+ "The Pawn",\r
+ 0,\r
+ 1985,\r
+ "MAGNETIC-1",\r
+ "Rob Steggles",\r
+ },\r
+ { 1, "\000\004\000\001\007\370\000\000\340\000\000\000\041\064\000\000\040\160\000\000",\r
+ "Guild of Thieves",\r
+ 0,\r
+ 1987,\r
+ "MAGNETIC-2",\r
+ "Rob Steggles",\r
+ },\r
+ { 2, "\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000\000",\r
+ "Jinxter",\r
+ 0,\r
+ 1987,\r
+ "MAGNETIC-3",\r
+ "Georgina Sinclair and Michael Bywater",\r
+ },\r
+ { 4, "\000\004\000\001\045\140\000\001\000\000\000\000\161\017\000\000\035\210\000\001",\r
+ "Corruption",\r
+ 0,\r
+ 1988,\r
+ "MAGNETIC-4",\r
+ "Rob Steggles and Hugh Steers",\r
+ },\r
+ { 4, "\000\004\000\001\044\304\000\001\000\000\000\000\134\137\000\000\040\230\000\001",\r
+ "Fish!",\r
+ 0,\r
+ 1988,\r
+ "MAGNETIC-5",\r
+ "John Molloy, Pete Kemp, Phil South, Rob Steggles",\r
+ },\r
+ { 4, "\000\003\000\000\377\000\000\000\340\000\000\000\221\000\000\000\036\000\000\001",\r
+ "Corruption",\r
+ 0,\r
+ 1988,\r
+ "MAGNETIC-4",\r
+ "Rob Steggles and Hugh Steers",\r
+ },\r
+ { 4, "\000\003\000\001\000\000\000\000\340\000\000\000\175\000\000\000\037\000\000\001",\r
+ "Fish!",\r
+ 0,\r
+ 1988,\r
+ "MAGNETIC-5",\r
+ "John Molloy, Pete Kemp, Phil South, Rob Steggles",\r
+ },\r
+ { 4, "\000\003\000\000\335\000\000\000\140\000\000\000\064\000\000\000\023\000\000\000",\r
+ "Myth",\r
+ 0,\r
+ 1989,\r
+ "MAGNETIC-6",\r
+ "Paul Findley",\r
+ },\r
+ { 4, "\000\004\000\001\122\074\000\001\000\000\000\000\114\146\000\000\057\240\000\001",\r
+ "Wonderland",\r
+ 0,\r
+ 1990,\r
+ "MAGNETIC-7",\r
+ "David Bishop",\r
+ },\r
+ { 0, "0", NULL, 0, 0, NULL, NULL }\r
+ };\r
+\r
+static int32 get_story_file_IFID(void *story_file, int32 extent, char *output, int32 output_extent)\r
+{\r
+ int i;\r
+ unsigned char *sf=(unsigned char *)story_file;\r
+ if (extent < 42) return INVALID_STORY_FILE_RV;\r
+\r
+ for(i=0;manifest[i].title;i++)\r
+ if ((sf[13]<3 && manifest[i].gv==sf[13]) || memcmp(manifest[i].header,sf+12,20)==0)\r
+ {\r
+ ASSERT_OUTPUT_SIZE(((int32) strlen(manifest[i].ifid)+1));\r
+ strcpy(output,manifest[i].ifid);\r
+ return 1;\r
+ }\r
+ strcpy(output,"MAGNETIC-");\r
+ return INCOMPLETE_REPLY_RV;\r
+}\r
+\r
+static int32 claim_story_file(void *story_file, int32 extent)\r
+{\r
+ if (extent<42 ||\r
+ memcmp(story_file,"MaSc",4)\r
+ ) return INVALID_STORY_FILE_RV;\r
+ return VALID_STORY_FILE_RV;\r
+}\r
+\r