(svn r10762) -Codechange: Change enum StringIDEnum { to static const StringID = for

each STR_ entry. This avoids the need for a cast to StringID in some 
places and thus better type-safety.
This commit is contained in:
peter1138
2007-08-03 09:08:49 +00:00
parent f95df6bb61
commit 23a46a301e
5 changed files with 13 additions and 10 deletions

View File

@@ -1019,19 +1019,20 @@ static void WriteStringsH(const char *filename)
out = fopen("tmp.xxx", "w");
if (out == NULL) fatal("can't open tmp.xxx");
fprintf(out, "enum StringIdEnum {");
fprintf(out, "/* This file is automatically generated. Do not modify */\n\n");
fprintf(out, "#ifndef TABLE_STRINGS_H\n");
fprintf(out, "#define TABLE_STRINGS_H\n");
lastgrp = 0;
for (i = 0; i != lengthof(_strings); i++) {
if (_strings[i] != NULL) {
fprintf(out, next == i ? "\t%s,\n" : "\n\t%s = 0x%X,\n", _strings[i]->name, i);
if (next != i) fprintf(out, "\n");
fprintf(out, "static const StringID %s = 0x%X;\n", _strings[i]->name, i);
next = i + 1;
}
}
fprintf(out, "};\n");
fprintf(out,
"\nenum {\n"
"\tLANGUAGE_PACK_IDENT = 0x474E414C, // Big Endian value for 'LANG' (LE is 0x 4C 41 4E 47)\n"
@@ -1039,6 +1040,8 @@ static void WriteStringsH(const char *filename)
"};\n", (uint)_hash
);
fprintf(out, "\n#endif /* TABLE_STRINGS_H */\n");
fclose(out);
if (CompareFiles("tmp.xxx", filename)) {