- int MAXDIE;
- for (int i=0; i<=4; i++) {
- long x = 2*i+81;
- if(RTEXT[x] != 0)
- MAXDIE=i+1;
- }
-
-
- fprintf(header_file, "#ifndef DATABASE_H\n");
- fprintf(header_file, "#define DATABASE_H\n");
- fprintf(header_file, "\n");
-
- fprintf(header_file, "#include \"common.h\"\n");
- fprintf(header_file, "#define TABSIZ 330\n");
- fprintf(header_file, "#define HNTSIZ 20\n");
- fprintf(header_file, "#define TOKLEN %d\n", TOKLEN);
- fprintf(header_file, "#define MAXDIE %d\n", MAXDIE);
- fprintf(header_file, "\n");
-
- fprintf(header_file, "\n");
- fprintf(header_file, "#ifdef DEFINE_GLOBALS_FROM_INCLUDES\n");
- fprintf(header_file, "#define LOCATION\n");
- fprintf(header_file, "#define INITIALIZE(...) __VA_ARGS__\n");
- fprintf(header_file, "#else\n");
- fprintf(header_file, "#define LOCATION extern\n");
- fprintf(header_file, "#define INITIALIZE(...)\n");
- fprintf(header_file, "#endif\n");
- fprintf(header_file, "\n");
-
- // content variables
- write_0d(header_file, TRNVLS, "TRNVLS");
- write_0d(header_file, HNTMAX, "HNTMAX");
- write_1d(header_file, OBJSND, NOBJECTS + 1, "OBJSND");
- write_1d(header_file, OBJTXT, NOBJECTS + 1, "OBJTXT");
- write_1d(header_file, COND, LOCSIZ + 1, "COND");
- write_1d(header_file, KEY, LOCSIZ + 1, "KEY");
- write_1d(header_file, LOCSND, LOCSIZ + 1, "LOCSND");
- write_1d(header_file, CVAL, CLSMAX + 1, "CVAL");
- write_1d(header_file, TRNVAL, TRNSIZ + 1, "TRNVAL");
- write_1d(header_file, TRAVEL, TRVSIZ + 1, "TRAVEL");
- write_1d(header_file, KTAB, TABSIZ + 1, "KTAB");
- write_1d(header_file, ATAB, TABSIZ + 1, "ATAB");
- write_1d(header_file, PLAC, NOBJECTS + 1, "PLAC");
- write_1d(header_file, FIXD, NOBJECTS + 1, "FIXD");
- write_1d(header_file, ACTSPK, VRBSIZ + 1, "ACTSPK");
- write_hints(header_file, HINTS, HNTSIZ + 1, 5, "HINTS");
-
- fprintf(header_file, "#undef LOCATION\n");
- fprintf(header_file, "#undef INITIALIZE\n");
- fprintf(header_file, "#endif\n");
+ int MAXDIE;
+ for (int i = 0; i <= 4; i++) {
+ long x = 2 * i + 81;
+ if (RTEXT[x] != 0)
+ MAXDIE = i + 1;
+ }
+
+
+ fprintf(header_file, "#ifndef DATABASE_H\n");
+ fprintf(header_file, "#define DATABASE_H\n");
+ fprintf(header_file, "\n");
+
+ fprintf(header_file, "#include \"common.h\"\n");
+ fprintf(header_file, "#define TABSIZ 330\n");
+ fprintf(header_file, "#define HNTSIZ 20\n");
+ fprintf(header_file, "#define TOKLEN %d\n", TOKLEN);
+ fprintf(header_file, "#define MAXDIE %d\n", MAXDIE);
+ fprintf(header_file, "\n");
+
+ fprintf(header_file, "\n");
+ fprintf(header_file, "#ifdef DEFINE_GLOBALS_FROM_INCLUDES\n");
+ fprintf(header_file, "#define LOCATION\n");
+ fprintf(header_file, "#define INITIALIZE(...) __VA_ARGS__\n");
+ fprintf(header_file, "#else\n");
+ fprintf(header_file, "#define LOCATION extern\n");
+ fprintf(header_file, "#define INITIALIZE(...)\n");
+ fprintf(header_file, "#endif\n");
+ fprintf(header_file, "\n");
+
+ // content variables
+ write_0d(header_file, TRNVLS, "TRNVLS");
+ write_0d(header_file, HNTMAX, "HNTMAX");
+ write_1d(header_file, OBJSND, NOBJECTS + 1, "OBJSND");
+ write_1d(header_file, OBJTXT, NOBJECTS + 1, "OBJTXT");
+ write_1d(header_file, COND, LOCSIZ + 1, "COND");
+ write_1d(header_file, KEY, LOCSIZ + 1, "KEY");
+ write_1d(header_file, LOCSND, LOCSIZ + 1, "LOCSND");
+ write_1d(header_file, CVAL, CLSMAX + 1, "CVAL");
+ write_1d(header_file, TRNVAL, TRNSIZ + 1, "TRNVAL");
+ write_1d(header_file, TRAVEL, TRVSIZ + 1, "TRAVEL");
+ write_1d(header_file, KTAB, TABSIZ + 1, "KTAB");
+ write_1d(header_file, ATAB, TABSIZ + 1, "ATAB");
+ write_1d(header_file, PLAC, NOBJECTS + 1, "PLAC");
+ write_1d(header_file, FIXD, NOBJECTS + 1, "FIXD");
+ write_1d(header_file, ACTSPK, VRBSIZ + 1, "ACTSPK");
+ write_hints(header_file, HINTS, HNTSIZ + 1, 5, "HINTS");
+
+ fprintf(header_file, "#undef LOCATION\n");
+ fprintf(header_file, "#undef INITIALIZE\n");
+ fprintf(header_file, "#endif\n");
+}
+
+void bug(enum bugtype num, const char *error_string)
+{
+ fprintf(stderr, "Fatal error %d, %s.\n", num, error_string);
+ exit(EXIT_FAILURE);