Index: .cvsignore
===================================================================
RCS file: /home/wine/wine/tools/.cvsignore,v
retrieving revision 1.11
diff -u -r1.11 .cvsignore
--- .cvsignore	17 Aug 2004 22:33:14 -0000	1.11
+++ .cvsignore	21 Aug 2004 14:32:10 -0000
@@ -4,4 +4,6 @@
 fnt2fon
 makedep
 sfnt2fnt
+trans
+trans_html
 wineprefixcreate
Index: Makefile.in
===================================================================
RCS file: /home/wine/wine/tools/Makefile.in,v
retrieving revision 1.41
diff -u -r1.41 Makefile.in
--- Makefile.in	17 Aug 2004 22:33:14 -0000	1.41
+++ Makefile.in	21 Aug 2004 14:32:10 -0000
@@ -13,6 +13,7 @@
 	fnt2fon \
 	makedep \
 	sfnt2fnt \
+	trans \
 	wineprefixcreate
 
 C_SRCS = \
@@ -21,6 +22,7 @@
 	fnt2fon.c \
 	makedep.c \
 	sfnt2fnt.c \
+	trans.c
 
 SUBDIRS = \
 	widl \
@@ -54,6 +56,9 @@
 
 bin2res: bin2res.o
 	$(CC) $(CFLAGS) -o bin2res bin2res.o $(LIBPORT)
+
+trans: trans.o
+	$(CC) $(CFLAGS) -o trans trans.o $(LIBPORT)
 
 wineprefixcreate: wineprefixcreate.in
 	sed -e 's,@dlldir\@,$(dlldir),g' -e 's,@datadir\@,$(datadir),g' $(SRCDIR)/wineprefixcreate.in >$@ || ($(RM) $@ && false)
--- /dev/null	2004-02-23 18:02:56.000000000 -0300
+++ trans.c	2004-08-21 00:55:19.000000000 -0300
@@ -0,0 +1,327 @@
+/*
+ * Copyright 2003-2004 Vincent B�ron
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include "windef.h"
+
+#define NB_RES_TYPE 21
+#define NB_LANG 0x94
+
+static const char *res_types[] = {
+"cursor",
+"bitmap",
+"icon",
+"menu",
+"dialog",
+"stringtable",
+"fontdir",
+"font",
+"accelerator",
+"rcdata",
+"messagetable",
+"cursor_group",
+"icon_group",
+"versioninfo",
+"ani_cursor",
+"ani_icon",
+"dlginit",
+"toolbar",
+"menuex",
+"dialogex",
+"user"
+};
+
+#define PRETTYPRINTLANG(langid) \
+	if(LANG_##langid == lid) { \
+		return #langid; \
+	}
+
+static const char *get_language_name(int lid) {
+	PRETTYPRINTLANG(NEUTRAL)
+	PRETTYPRINTLANG(AFRIKAANS)
+	PRETTYPRINTLANG(ALBANIAN)
+	PRETTYPRINTLANG(ARABIC)
+	PRETTYPRINTLANG(ARMENIAN)
+	PRETTYPRINTLANG(ASSAMESE)
+	PRETTYPRINTLANG(AZERI)
+	PRETTYPRINTLANG(BASQUE)
+	PRETTYPRINTLANG(BELARUSIAN)
+	PRETTYPRINTLANG(BENGALI)
+	PRETTYPRINTLANG(BULGARIAN)
+	PRETTYPRINTLANG(CATALAN)
+	PRETTYPRINTLANG(CHINESE)
+	PRETTYPRINTLANG(CROATIAN)
+	PRETTYPRINTLANG(CZECH)
+	PRETTYPRINTLANG(DANISH)
+	PRETTYPRINTLANG(DIVEHI)
+	PRETTYPRINTLANG(DUTCH)
+	PRETTYPRINTLANG(ENGLISH)
+	PRETTYPRINTLANG(ESTONIAN)
+	PRETTYPRINTLANG(FAEROESE)
+	PRETTYPRINTLANG(FARSI)
+	PRETTYPRINTLANG(FINNISH)
+	PRETTYPRINTLANG(FRENCH)
+	PRETTYPRINTLANG(GALICIAN)
+	PRETTYPRINTLANG(GEORGIAN)
+	PRETTYPRINTLANG(GERMAN)
+	PRETTYPRINTLANG(GREEK)
+	PRETTYPRINTLANG(GUJARATI)
+	PRETTYPRINTLANG(HEBREW)
+	PRETTYPRINTLANG(HINDI)
+	PRETTYPRINTLANG(HUNGARIAN)
+	PRETTYPRINTLANG(ICELANDIC)
+	PRETTYPRINTLANG(INDONESIAN)
+	PRETTYPRINTLANG(ITALIAN)
+	PRETTYPRINTLANG(JAPANESE)
+	PRETTYPRINTLANG(KANNADA)
+	PRETTYPRINTLANG(KASHMIRI)
+	PRETTYPRINTLANG(KAZAK)
+	PRETTYPRINTLANG(KONKANI)
+	PRETTYPRINTLANG(KOREAN)
+	PRETTYPRINTLANG(KYRGYZ)
+	PRETTYPRINTLANG(LATVIAN)
+	PRETTYPRINTLANG(LITHUANIAN)
+	PRETTYPRINTLANG(MACEDONIAN)
+	PRETTYPRINTLANG(MALAY)
+	PRETTYPRINTLANG(MALAYALAM)
+	PRETTYPRINTLANG(MANIPURI)
+	PRETTYPRINTLANG(MARATHI)
+	PRETTYPRINTLANG(MONGOLIAN)
+	PRETTYPRINTLANG(NEPALI)
+	PRETTYPRINTLANG(NORWEGIAN)
+	PRETTYPRINTLANG(ORIYA)
+	PRETTYPRINTLANG(POLISH)
+	PRETTYPRINTLANG(PORTUGUESE)
+	PRETTYPRINTLANG(PUNJABI)
+	PRETTYPRINTLANG(ROMANIAN)
+	PRETTYPRINTLANG(RUSSIAN)
+	PRETTYPRINTLANG(SANSKRIT)
+	PRETTYPRINTLANG(SERBIAN)
+	PRETTYPRINTLANG(SINDHI)
+	PRETTYPRINTLANG(SLOVAK)
+	PRETTYPRINTLANG(SLOVENIAN)
+	PRETTYPRINTLANG(SPANISH)
+	PRETTYPRINTLANG(SWAHILI)
+	PRETTYPRINTLANG(SWEDISH)
+	PRETTYPRINTLANG(SYRIAC)
+	PRETTYPRINTLANG(TAMIL)
+	PRETTYPRINTLANG(TATAR)
+	PRETTYPRINTLANG(TELUGU)
+	PRETTYPRINTLANG(THAI)
+	PRETTYPRINTLANG(TURKISH)
+	PRETTYPRINTLANG(UKRAINIAN)
+	PRETTYPRINTLANG(URDU)
+	PRETTYPRINTLANG(UZBEK)
+	PRETTYPRINTLANG(VIETNAMESE)
+	PRETTYPRINTLANG(GAELIC)
+	PRETTYPRINTLANG(MALTESE)
+	PRETTYPRINTLANG(MAORI)
+	PRETTYPRINTLANG(RHAETO_ROMANCE)
+	PRETTYPRINTLANG(SAAMI)
+	PRETTYPRINTLANG(SORBIAN)
+	PRETTYPRINTLANG(SUTU)
+	PRETTYPRINTLANG(TSONGA)
+	PRETTYPRINTLANG(TSWANA)
+	PRETTYPRINTLANG(VENDA)
+	PRETTYPRINTLANG(XHOSA)
+	PRETTYPRINTLANG(ZULU)
+	PRETTYPRINTLANG(ESPERANTO)
+	PRETTYPRINTLANG(WALON)
+	PRETTYPRINTLANG(CORNISH)
+	PRETTYPRINTLANG(WELSH)
+	PRETTYPRINTLANG(BRETON)
+	return "Unknown language";
+}
+
+int main(int argc, char *argv[]) {
+	char *p;
+	char filename_general[256], filename_res[256];
+	FILE *output_general, *output_res;
+	int i, j, k;
+	int nb_lang_relevant = 0;
+	int lang_relevant[NB_LANG];
+	int nb_files = 0;
+	struct afile {
+		char filename_orig[256];
+		char line[NB_RES_TYPE][NB_LANG+2];
+		char **problems[NB_RES_TYPE][NB_LANG];
+		int nb_problems[NB_LANG];
+		int file_relevant;
+		int lang_relevant[NB_LANG];
+		int res_relevant[NB_RES_TYPE];
+	} *files;
+	int langid;
+	char temp[256];
+	char filename[256];
+	char *lang_select[] = {"ENGLISH", "PORTUGUESE", "GERMAN", "SPANISH", "FRENCH", "ITALIAN", "POLISH"};
+	int nb_lang_select = 7;
+
+	p = strrchr(argv[0], '/');
+	*p = '\0';
+
+	sprintf(filename_general, "%s/trans_html/index.html", argv[0]);
+	output_general = fopen(filename_general, "wt");
+	fprintf(output_general, "<html>\n<head>\n</head>\n<body>\n");
+	fprintf(output_general, "  <table border>\n");
+
+	for(j = 0; j < NB_LANG; j++) {
+		lang_relevant[j] = 0;
+	}
+
+	files = malloc((nb_files+1)*sizeof(struct afile));
+	while(fgets(files[nb_files].filename_orig, 256, stdin)) {
+		for(i = 0; i < NB_RES_TYPE; i++) {
+			fgets(files[nb_files].line[i], NB_LANG+2, stdin);
+			for(j = 0; j < NB_LANG; j++) {
+				files[nb_files].problems[i][j] = malloc(sizeof(char *));
+				files[nb_files].problems[i][j][0] = NULL;
+				files[nb_files].nb_problems[j] = 0;
+			}
+			for(j = 0; j < NB_LANG; j++) {
+				if('x' == files[nb_files].line[i][j] || '-' == files[nb_files].line[i][j] || '+' == files[nb_files].line[i][j] || ' ' == files[nb_files].line[i][j]) {
+					do {
+						fgets(temp, 256, stdin);
+						p = strchr(temp, '\\');
+						if(p) {
+							p--;
+							*p = '\0';
+							p -= 2;
+							langid = strtol(p, NULL, 16);
+							*p = '\0';
+						} else {
+							p = strchr(temp, '\0') - 3;
+							langid = strtol(p, NULL, 16);
+							*p = '\0';
+							p = NULL;
+						}
+						files[nb_files].problems[i][langid][files[nb_files].nb_problems[langid]++] = strdup(temp);
+						files[nb_files].problems[i][langid] = realloc(files[nb_files].problems[i][langid], (files[nb_files].nb_problems[langid]+1)*sizeof(char *));
+						files[nb_files].problems[i][langid][files[nb_files].nb_problems[langid]] = NULL;
+					} while (p);
+				}
+			}
+		}
+
+		files[nb_files].file_relevant = 0;
+		for(j = 0; j < NB_LANG; j++) {
+			files[nb_files].lang_relevant[j] = 0;
+			for(i = 0; i < NB_RES_TYPE; i++) {
+				if(' ' != files[nb_files].line[i][j] && 'n' != files[nb_files].line[i][j]) {
+					files[nb_files].lang_relevant[j] = 1;
+					if(!lang_relevant[j]) {
+						lang_relevant[j] = 1;
+						nb_lang_relevant++;
+					}
+				}
+			}
+			if(files[nb_files].lang_relevant[j]) {
+				if(!files[nb_files].file_relevant) {
+					files[nb_files].file_relevant = 1;
+				}
+			}
+		}
+
+		nb_files++;
+		files = realloc(files, (nb_files+1)*sizeof(struct afile));
+	}
+
+	for(k = 0; k < nb_files; k++) {
+		if(files[k].file_relevant) {
+			fprintf(output_general, "    <tr>\n      <td colspan=%d><b>%s</b></td>\n    </tr>\n    <tr>\n      <td></td>\n", nb_lang_relevant+1, files[k].filename_orig);
+			for(j = 0; j < NB_LANG; j++) {
+				int lid, select = 0;
+				for(lid = 0;lid < nb_lang_select;lid++) {
+					if(strcmp(lang_select[lid],get_language_name(j))==0) {
+						select = 1;
+						break;
+					}
+				}
+				if(select && lang_relevant[j]) {
+					fprintf(output_general, "      <td>%s</td>\n", get_language_name(j));
+				}
+			}
+			fprintf(output_general, "    </tr>\n");
+		}
+
+		strcpy(filename, files[k].filename_orig);
+		p = filename;
+		while((p = strchr(p, '/')))
+			*p = '.';
+		p = strchr(filename, '\0') - 1;
+		*p = '\0';
+		for(i = 0; i < NB_RES_TYPE; i++) {
+			files[k].res_relevant[i] = 0;
+			for(j = 0; j < NB_LANG; j++) {
+				if('.' == files[k].line[i][j] || 'x' == files[k].line[i][j] || '-' == files[k].line[i][j] || '+' == files[k].line[i][j]) {
+					files[k].res_relevant[i] = 1;
+				}
+			}
+			if(files[k].res_relevant[i]) {
+				fprintf(output_general, "    <tr>\n      <td>%s</td>\n", res_types[i]);
+				for(j = 0; j < NB_LANG; j++) {
+					int lid, select = 0;
+					for(lid = 0;lid < nb_lang_select;lid++) {
+						if(strcmp(lang_select[lid],get_language_name(j))==0) {
+							select = 1;
+							break;
+						}
+					}
+					if(select && lang_relevant[j]) {
+						if('.' == files[k].line[i][j]) {
+							fprintf(output_general, "      <td bgcolor=\"green\">complete</td>\n");
+						} else if('x' == files[k].line[i][j]) {
+							fprintf(output_general, "      <td bgcolor=\"red\"><a href=\"details/%s.%s.%s.html\">mismatch</a></td>\n", filename, res_types[i], get_language_name(j));
+						} else if('-' == files[k].line[i][j]) {
+							fprintf(output_general, "      <td bgcolor=\"orange\"><a href=\"details/%s.%s.%s.html\">incomplete</a></td>\n", filename, res_types[i], get_language_name(j));
+						} else if('+' == files[k].line[i][j]) {
+							fprintf(output_general, "      <td bgcolor=\"red\"><a href=\"details/%s.%s.%s.html\">mismatch+incomplete</a></td>\n", filename, res_types[i], get_language_name(j));
+						} else if(' ' == files[k].line[i][j]) {
+							fprintf(output_general, "      <td bgcolor=\"yellow\">nothing</td>\n");
+						}
+						if('.' != files[k].line[i][j] && ' ' != files[k].line[i][j]) {
+							sprintf(filename_res, "%s/trans_html/details/%s.%s.%s.html", argv[0], filename, res_types[i], get_language_name(j));
+							output_res = fopen(filename_res, "wt");
+							fprintf(output_res, "<html>\n<head>\n</head>\n<body>\n");
+							if('x' == files[k].line[i][j]) {
+								fprintf(output_res, "Some resources are different from what they should be.");
+							} else if('+' == files[k].line[i][j]) {
+								fprintf(output_res, "Some resources are missing, and some others are different from what they should be.");
+							} else if('-' == files[k].line[i][j]) {
+								fprintf(output_res, "Some resources are missing.");
+							}							files[k].nb_problems[j] = 0;
+							while(files[k].problems[i][j][files[k].nb_problems[j]]) {
+								fprintf(output_res, "<br>\n%s", files[k].problems[i][j][files[k].nb_problems[j]++]);
+							}
+							fprintf(output_res, "\n</body>\n</html>\n");
+							fclose(output_res);
+						}
+					}
+				}
+				fprintf(output_general, "    </tr>\n");
+			}
+		}
+	}
+
+	fprintf(output_general, "  </table>\n</body>\n</html>\n");
+	fclose(output_general);
+
+	exit(0);
+	return 0;
+}
