src/strgen/strgen.cpp
changeset 7393 f3d27c82fec3
parent 7110 bda0a45e30e5
child 7755 7038d5001e0a
equal deleted inserted replaced
7392:0964cfefbe64 7393:f3d27c82fec3
  1017 	int lastgrp;
  1017 	int lastgrp;
  1018 
  1018 
  1019 	out = fopen("tmp.xxx", "w");
  1019 	out = fopen("tmp.xxx", "w");
  1020 	if (out == NULL) fatal("can't open tmp.xxx");
  1020 	if (out == NULL) fatal("can't open tmp.xxx");
  1021 
  1021 
  1022 	fprintf(out, "enum StringIdEnum {");
  1022 	fprintf(out, "/* This file is automatically generated. Do not modify */\n\n");
       
  1023 	fprintf(out, "#ifndef TABLE_STRINGS_H\n");
       
  1024 	fprintf(out, "#define TABLE_STRINGS_H\n");
  1023 
  1025 
  1024 	lastgrp = 0;
  1026 	lastgrp = 0;
  1025 
  1027 
  1026 	for (i = 0; i != lengthof(_strings); i++) {
  1028 	for (i = 0; i != lengthof(_strings); i++) {
  1027 		if (_strings[i] != NULL) {
  1029 		if (_strings[i] != NULL) {
  1028 			fprintf(out, next == i ? "\t%s,\n" : "\n\t%s = 0x%X,\n", _strings[i]->name, i);
  1030 			if (next != i) fprintf(out, "\n");
       
  1031 			fprintf(out, "static const StringID %s = 0x%X;\n", _strings[i]->name, i);
  1029 			next = i + 1;
  1032 			next = i + 1;
  1030 		}
  1033 		}
  1031 	}
  1034 	}
  1032 
       
  1033 	fprintf(out, "};\n");
       
  1034 
  1035 
  1035 	fprintf(out,
  1036 	fprintf(out,
  1036 		"\nenum {\n"
  1037 		"\nenum {\n"
  1037 		"\tLANGUAGE_PACK_IDENT = 0x474E414C, // Big Endian value for 'LANG' (LE is 0x 4C 41 4E 47)\n"
  1038 		"\tLANGUAGE_PACK_IDENT = 0x474E414C, // Big Endian value for 'LANG' (LE is 0x 4C 41 4E 47)\n"
  1038 		"\tLANGUAGE_PACK_VERSION = 0x%X,\n"
  1039 		"\tLANGUAGE_PACK_VERSION = 0x%X,\n"
  1039 		"};\n", (uint)_hash
  1040 		"};\n", (uint)_hash
  1040 	);
  1041 	);
       
  1042 
       
  1043 	fprintf(out, "\n#endif /* TABLE_STRINGS_H */\n");
  1041 
  1044 
  1042 	fclose(out);
  1045 	fclose(out);
  1043 
  1046 
  1044 	if (CompareFiles("tmp.xxx", filename)) {
  1047 	if (CompareFiles("tmp.xxx", filename)) {
  1045 		// files are equal. tmp.xxx is not needed
  1048 		// files are equal. tmp.xxx is not needed