2013-10-15 21:58:27 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2014-01-31 02:51:28 +00:00
|
|
|
echo This file recreates localization_data.h according resource.h
|
2013-10-15 21:58:27 +00:00
|
|
|
echo
|
|
|
|
|
2014-01-24 19:59:23 +00:00
|
|
|
# check that sed is available
|
2013-10-15 21:58:27 +00:00
|
|
|
type -P sed &>/dev/null || { echo "sed command not found. Aborting." >&2; exit 1; }
|
|
|
|
|
|
|
|
# Create the first sed command file
|
|
|
|
cat > cmd.sed <<\_EOF
|
|
|
|
# Insert header
|
|
|
|
1i /*\
|
|
|
|
* Rufus: The Reliable USB Formatting Utility\
|
|
|
|
* Localization tables - autogenerated from resource.h\
|
2014-01-24 19:59:23 +00:00
|
|
|
* Copyright © 2013-2014 Pete Batard <pete@akeo.ie>\
|
2013-10-15 21:58:27 +00:00
|
|
|
*\
|
|
|
|
* This program is free software: you can redistribute it and/or modify\
|
|
|
|
* it under the terms of the GNU General Public License as published by\
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or\
|
|
|
|
* (at your option) any later version.\
|
|
|
|
*\
|
|
|
|
* This program 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 General Public License for more details.\
|
|
|
|
*\
|
|
|
|
* You should have received a copy of the GNU General Public License\
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.\
|
|
|
|
*/\
|
|
|
|
\
|
|
|
|
#include <windows.h>\
|
|
|
|
#include "resource.h"\
|
|
|
|
#include "localization.h"\
|
|
|
|
\
|
|
|
|
#define LOC_CTRL(x) { #x, x }\
|
|
|
|
#define LOC_DLG(x) { x, NULL, {NULL, NULL} }\
|
|
|
|
\
|
|
|
|
// Control IDs\
|
|
|
|
const loc_control_id control_id[] = {\
|
|
|
|
// The dialog IDs must come first
|
|
|
|
|
|
|
|
# Add the control entries - must be in IDD_, IDC_, IDS_ or MSG_
|
|
|
|
s/^#define \([I|M][D|S][D|C|S|G]_[^ ]*\) .*/\ LOC_CTRL(\1),/
|
|
|
|
|
|
|
|
# Add standard IDs from windows.h and close table
|
|
|
|
$a\
|
|
|
|
LOC_CTRL(IDOK),\
|
|
|
|
LOC_CTRL(IDCANCEL),\
|
|
|
|
LOC_CTRL(IDABORT),\
|
|
|
|
LOC_CTRL(IDRETRY),\
|
|
|
|
LOC_CTRL(IDIGNORE),\
|
|
|
|
LOC_CTRL(IDYES),\
|
|
|
|
LOC_CTRL(IDNO),\
|
|
|
|
LOC_CTRL(IDCLOSE),\
|
|
|
|
LOC_CTRL(IDHELP),\
|
|
|
|
\};\
|
|
|
|
|
|
|
|
# Remove everything else
|
|
|
|
/^[#|\/]/d
|
|
|
|
/^$/d
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
# Run first part
|
|
|
|
sed -f cmd.sed resource.h > localization_data.h
|
|
|
|
|
|
|
|
# Create the second sed command file
|
|
|
|
cat > cmd.sed <<\_EOF
|
|
|
|
|
|
|
|
# Insert dialog table header
|
|
|
|
1i // Dialog data\
|
|
|
|
loc_dlg_list loc_dlg[] = {
|
|
|
|
|
|
|
|
# Add the dialog entries - must start with IDD_
|
|
|
|
s/^#define \(IDD_[^ ]*\) .*/\ LOC_DLG(\1),/
|
|
|
|
|
|
|
|
# Close the table
|
|
|
|
$a\
|
|
|
|
};
|
|
|
|
|
|
|
|
# Remove everything else
|
|
|
|
/^[#|\/]/d
|
|
|
|
/^$/d
|
|
|
|
_EOF
|
|
|
|
|
|
|
|
# Run second part
|
|
|
|
sed -f cmd.sed resource.h >> localization_data.h
|
|
|
|
|
|
|
|
rm cmd.sed
|
|
|
|
echo Done.
|