[prev in list] [next in list] [prev in thread] [next in thread]
List: wine-devel
Subject: Re: tools/translations_status
From: Vincent =?ISO-8859-1?Q?B=E9ron?= <vberon () mecano ! gme ! usherb ! ca>
Date: 2003-09-29 0:37:24
[Download RAW message or body]
Le dim 21/09/2003 à 21:37, Vincent Béron a écrit :
>
> I think a combination of both is helpful. One in knowing what is
> uptodate (the MASTER), and one knowing what is not (the attached script,
> or a variation of).
>
> It's not particularly fast (would need to be ported in Perl, where
> hashtables exist, for example), but it gets the job done in knowing
> which resources have the same structure as the master language. Missing
> lines, menus, stringtables, etc. are also found and reported.
>
> The ww file is needed because my csplit dies with a "Memory exhausted"
> when used in a pipe following sed for commdlg, but not when used with
> cat. I'm stomped on that one.
>
> Ideally, it'd be integrated with Make.rules, so it knows where it is and
> what are the rc files to check.
>
> Comments (especially from those translating parts of Wine)?
>
> Vincent
> ----
>
Here's an updated version of the script. Still slow as molasse though,
only perl/C can change that I'm afraid (or another algorithm to check
the files). By slow, I mean takes a couple minutes on a XP1800+.
16 bits resources ar not checked for now, would need the trivial
addition of -O res16 to wrc args for the output file to be usable to
build Wine.
Usage:
cd to any dir in Wine build tree (including wine/), and launch. It'll
check all subdirs for Makefiles and extract its needed information from
that, no need to tell it were to look.
The output is what's missing (or different) for some types of resources
(DIALOG, DIALOGEX, MENU, STRINGTABLE, UserResource for now) compared to
LANG_ENGLISH. Some other resources types (ACCELERATOR, BITMAP, CURSOR,
GROUP_CURSOR, GROUP_ICON, ICON, MESSAGETABLE, RCDATA, VERSIONINFO) are
assumed shared for all languages, so they are skipped. Other resources
types are absent from the Wine tree, so no decisions have been taken for
now one way or the other.
A nice summary is not included for now, but should be pretty easy to add
(and is planned for the short term). Also planned is something along the
lines of the "last update" token idea from Dimi.
Vincent
["v4" (v4)]
#!/bin/sh
# 0009 == English
MASTER_LANG="0009"
unset LANGUAGES_OVERALL
NB_LANGUAGES_OVERALL=0
for MAKEFILE in `find . -name 'Makefile'`; do
DIRECTORY="`dirname "${MAKEFILE}"`"
pushd "${DIRECTORY}" >/dev/null
MAKEFILECONTENTS="`sed -e '/^[[:space:]]/s/^[[:space:]]*\([^[:space:]]\)/ \1/' \
Makefile`" RC_SRCS="`echo "${MAKEFILECONTENTS}" |\
sed -e '/^RC_SRCS[[:space:]]*=[[:space:]]*/s/^RC_SRCS[[:space:]]*=[[:space:]]*\([^[:space:]]*\)/RC_SRCS=\1/' \
|\ sed -e '/^RC_SRCS=.*$/ {
:join
N
s/[[:space:]]*\\\\\n//
t join
b next
}
:next' |\
grep '^RC_SRCS=.*$' |\
sed -e 's/^RC_SRCS=[[:space:]]*//'`"
# RC_SRCS16="`echo "${MAKEFILECONTENTS}" |\
# sed -e '/^RC_SRCS16[[:space:]]*=[[:space:]]*/s/^RC_SRCS16[[:space:]]*=[[:space:]]*\([^[:space:]]*\)/RC_SRCS16=\1/' \
|\ # sed -e '/^RC_SRCS16=.*$/ {
# :join
# N
# s/[[:space:]]*\\\\\n//
# t join
# b next
# }
# :next' |\
# grep '^RC_SRCS16=.*$' |\
# sed -e 's/^RC_SRCS16=[[:space:]]*//'`"
TOPSRCDIR="`echo "${MAKEFILECONTENTS}" |\
grep '^TOPSRCDIR[[:space:]]*=.*$' |\
sed -e 's/^TOPSRCDIR[[:space:]]*=[[:space:]]*//'`"
TOPOBJDIR="`echo "${MAKEFILECONTENTS}" |\
grep '^TOPOBJDIR[[:space:]]*=.*$' |\
sed -e 's/^TOPOBJDIR[[:space:]]*=[[:space:]]*//'`"
SRCDIR="`echo "${MAKEFILECONTENTS}" |\
grep '^SRCDIR[[:space:]]*=.*$' |\
sed -e 's/^SRCDIR[[:space:]]*=[[:space:]]*//'`"
EXTRARCFLAGS="`echo "${MAKEFILECONTENTS}" |\
grep '^EXTRARCFLAGS[[:space:]]*=.*$' |\
sed -e 's/^EXTRARCFLAGS[[:space:]]*=[[:space:]]*//'`"
INCLUDES="-I${SRCDIR} -I. -I${TOPSRCDIR}/include -I${TOPOBJDIR}/include"
LDPATH="${TOPOBJDIR}/libs/unicode:${LD_LIBRARY_PATH}"
WRC="${TOPOBJDIR}/tools/wrc/wrc"
RC="${WRC}"
RCFLAGS="--nostdinc ${INCLUDES} --debug=0x02 ${EXTRARCFLAGS}"
# if [ -n "${RC_SRCS}" -o -n "${RC_SRCS16}" ]; then
if [ -n "${RC_SRCS}" ]; then
# echo "MAKEFILE: ${MAKEFILE}"
# echo "DIRECTORY: ${DIRECTORY}"
# echo "RC_SRCS: ${RC_SRCS}"
# echo "RC_SRCS16: ${RC_SRCS16}"
# echo "TOPSRCDIR: ${TOPSRCDIR}"
# echo "TOPOBJDIR: ${TOPOBJDIR}"
# echo "SRCDIR: ${SRCDIR}"
# echo "INCLUDES: ${INCLUDES}"
# echo "LDPATH: ${LDPATH}"
# echo "WRC: ${WRC}"
# echo "RC: ${RC}"
# echo "RCFLAGS: ${RCFLAGS}"
# for RCFILE in ${RC_SRCS} ${RC_SRCS16}; do
for RCFILE in ${RC_SRCS}; do
echo "File ${DIRECTORY}/${RCFILE}:"
WORKAROUNDCSPLITBUG="`LD_LIBRARY_PATH="${LDPATH}" ${RC} ${RCFLAGS} \
-fo${RCFILE%.rc}.res ${RCFILE} |\ grep -v '^Internal resource-tree dump:$' |\
sed -e '/[[:space:]]L\"/s/\([[:space:]]\)L\"/\1\"/' \
-e '/[[:space:]]\".*\"/s/\([[:space:]]\)\".*\"/\1\"\"/' \
-e '/[[:space:]]\"[^\"]*$/ {
:join
N
s/\n//
t tj
:tj
s/\".*\"/\"\"/
t next
b join
}
:next'`"
echo -e "${WORKAROUNDCSPLITBUG}\n" |\
csplit -k -q -n 4 -z - '/^Resource: /' '{*}'
unset LANG1
unset TYPE
unset LANGUAGES
NB_LANGUAGES=0
for FILE in xx????; do
TYPE=`grep "^Resource: .*$" ${FILE} |\
sed -e "s/^Resource: //"`
case "${TYPE}" in
"DIALOG"|"DIALOGEX"|"MENU"|"STRINGTABLE"|"UserResource")
LANG1=`grep "^LANGUAGE .*" ${FILE} |\
sed -e "s/LANGUAGE \(.*\), .*$/\1/"`
COUNTER1=0
FOUND=0
while [ ${COUNTER1} -lt ${NB_LANGUAGES} ]; do
if [ "${LANGUAGES[${COUNTER1}]}" = "${LANG1}" ]; then
FOUND=1
break
fi
COUNTER1=$[${COUNTER1}+1]
done
if [ $FOUND -eq 0 ]; then
LANGUAGES[${NB_LANGUAGES}]="${LANG1}"
NB_LANGUAGES=$[${NB_LANGUAGES}+1]
fi
COUNTER1=0
FOUND=0
while [ ${COUNTER1} -lt ${NB_LANGUAGES_OVERALL} ]; do
if [ "${LANGUAGES_OVERALL[${COUNTER1}]}" = "${LANG1}" ]; then
FOUND=1
break
fi
COUNTER1=$[${COUNTER1}+1]
done
if [ $FOUND -eq 0 ]; then
LANGUAGES_OVERALL[${NB_LANGUAGES_OVERALL}]="${LANG1}"
NB_LANGUAGES_OVERALL=$[${NB_LANGUAGES_OVERALL}+1]
fi
;;
esac
done
unset LANG1
unset TYPE
for PROCESSED_TYPE in DIALOG DIALOGEX MENU STRINGTABLE UserResource; do
echo "${PROCESSED_TYPE}:"
unset ID
unset LANG1
unset LANG2
unset MD5
unset MASTER
unset TYPE
NB=0
NB_MASTER=0
for FILE in xx????; do
TYPE=`grep "^Resource: .*$" ${FILE} |\
sed -e "s/^Resource: //"`
case "${TYPE}" in
"${PROCESSED_TYPE}")
ID[${NB}]=`grep "^Id: .*" ${FILE} |\
sed -e "s/^Id: //"`
LANG1[${NB}]=`grep "^LANGUAGE .*" ${FILE} |\
sed -e "s/LANGUAGE \(.*\), .*$/\1/"`
LANG2[${NB}]=`grep "^LANGUAGE .*" ${FILE} |\
sed -e "s/LANGUAGE .*, \(.*\)$/\1/"`
MD5[${NB}]=`grep -v "^Id: .*" ${FILE} |\
grep -v "^LANGUAGE .*" |\
md5sum`
if [ "${LANG1[${NB}]}" = "${MASTER_LANG}" ]; then
MASTER[${NB_MASTER}]=${NB}
NB_MASTER=$[${NB_MASTER}+1]
fi
NB=$[${NB}+1]
;;
"DIALOG"|"DIALOGEX"|"MENU"|"STRINGTABLE"|"UserResource")
# Real treatment is elsewhere
true
;;
"ACCELERATOR"|"BITMAP"|"CURSOR"|"GROUP_CURSOR"|"GROUP_ICON"|"ICON"|"MESSAGETABLE"|"RCDATA"|"VERSIONINFO")
# No further treatment needed
true
;;
*)
echo "Ressource type unknown: ${TYPE}"
exit 1
;;
esac
done
if [ ${NB} -ne 0 -a ${NB_MASTER} -eq 0 ]; then
echo "Did not find the MASTER language for ${PROCESSED_TYPE}s"
exit 1
fi
COUNTER1=0
while [ ${COUNTER1} -lt ${NB_MASTER} ]; do
COUNTER2=0
while [ ${COUNTER2} -lt ${NB} ]; do
if [ ${MASTER[${COUNTER1}]} -ne ${COUNTER2} ]; then
if [ "${ID[${MASTER[${COUNTER1}]}]}" = "${ID[${COUNTER2}]}" ]; then
if [ "${MD5[${MASTER[${COUNTER1}]}]}" != "${MD5[${COUNTER2}]}" ]; then
echo "${MASTER[${COUNTER1}]} and ${COUNTER2}: Differences for ID \
${ID[${COUNTER2}]} (language ${LANG1[${COUNTER2}]})" fi
fi
fi
COUNTER2=$[${COUNTER2}+1]
done
COUNTER1=$[${COUNTER1}+1]
done
COUNTER1=0
while [ ${COUNTER1} -lt ${NB_MASTER} ]; do
COUNTER2=0
while [ ${COUNTER2} -lt ${NB_LANGUAGES} ]; do
MATCHES[${COUNTER2}]=0
COUNTER2=$[${COUNTER2}+1]
done
COUNTER2=0
while [ ${COUNTER2} -lt ${NB} ]; do
if [ "${ID[${MASTER[${COUNTER1}]}]}" = "${ID[${COUNTER2}]}" ]; then
COUNTER3=0
while [ ${COUNTER3} -lt ${NB_LANGUAGES} ]; do
if [ "${LANG1[${COUNTER2}]}" = "${LANGUAGES[${COUNTER3}]}" ]; then
break
fi
COUNTER3=$[${COUNTER3}+1]
done
MATCHES[${COUNTER3}]=1
fi
COUNTER2=$[${COUNTER2}+1]
done
COUNTER2=0
while [ ${COUNTER2} -lt ${NB_LANGUAGES} ]; do
if [ ${MATCHES[${COUNTER2}]} -eq 0 ]; then
echo "${ID[${MASTER[${COUNTER1}]}]}: No equivalent for language \
${LANGUAGES[${COUNTER2}]}" fi
COUNTER2=$[${COUNTER2}+1]
done
COUNTER1=$[${COUNTER1}+1]
done
done
rm xx????
done
fi
popd >/dev/null
done
exit
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic