Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f0cf44e78 | ||
|
|
2417647110 | ||
|
|
982cd7bde2 | ||
|
|
d6bd289fcf | ||
|
|
ba44e61733 | ||
|
|
845652cbfe | ||
|
|
ceafa06efc | ||
|
|
e6f487474b | ||
|
|
d8461bb44f | ||
|
|
e25d366728 | ||
|
|
2abf0b98ac | ||
|
|
0f087d13bb | ||
|
|
2e914c61d1 | ||
|
|
3f599d5a28 | ||
|
|
6ef1f73d4d | ||
|
|
38b84baf9d | ||
|
|
fae50c0e19 | ||
|
|
50f7e2084c | ||
|
|
67cc5402cf | ||
|
|
2259d4f309 | ||
|
|
f8d903e7d2 | ||
|
|
805cde8ae8 | ||
|
|
b23906e327 | ||
|
|
2052afdb66 | ||
|
|
d9c7a40d4a | ||
|
|
cb2e017bcf | ||
|
|
d91fbf5d36 | ||
|
|
9859e43be7 | ||
|
|
306fec6f9e | ||
|
|
3e8b3e868b | ||
|
|
9261d9c5b2 | ||
|
|
f97941f86e | ||
|
|
a4810bd6c8 | ||
|
|
93cbba218a | ||
|
|
e749346f0c | ||
|
|
a658883664 | ||
|
|
d94c10014f | ||
|
|
45629386bb | ||
|
|
ffec9d64d5 | ||
|
|
3e9f17af86 | ||
|
|
03ff2fc007 | ||
|
|
4492c00840 | ||
|
|
e15319ac9b | ||
|
|
fa012aefe1 | ||
|
|
e681d2d24d | ||
|
|
76e54762d8 | ||
|
|
3b7d517be2 | ||
|
|
f4da64e3fa | ||
|
|
384acf8e31 | ||
|
|
a423451383 | ||
|
|
66cfceedaf | ||
|
|
fe9107fa9d | ||
|
|
e4f2db54e7 | ||
|
|
2f5fe01ae0 | ||
|
|
1bb7bd0abc | ||
|
|
a84ec88bc3 | ||
|
|
4a2e78081a | ||
|
|
d09d2cb445 | ||
|
|
1faa585e83 | ||
|
|
7479c82691 | ||
|
|
cfab2236da | ||
|
|
d2ee344b22 | ||
|
|
b22737223e | ||
|
|
578158c060 | ||
|
|
8eda0f78f7 | ||
|
|
2c2c82dc1a | ||
|
|
d8c9522ec9 | ||
|
|
492aef2165 | ||
|
|
fc0409e967 | ||
|
|
8a89b57e48 | ||
|
|
0f6b9ba181 | ||
|
|
8f1b4004c9 | ||
|
|
bee5250940 | ||
|
|
c61a2e6ba2 | ||
|
|
d293bb9672 | ||
|
|
9fb3f4c9a3 | ||
|
|
9a60441e54 | ||
|
|
29cf728fac | ||
|
|
3c78c5c57d | ||
|
|
7f3f332821 | ||
|
|
38576082fb | ||
|
|
4a4b5661f2 | ||
|
|
1e879dc432 | ||
|
|
f3c8ff19b9 | ||
|
|
fdd19632bf | ||
|
|
efc4a513ce | ||
|
|
b13793b2a4 | ||
|
|
e102d218ff | ||
|
|
20cdec33fb | ||
|
|
12d4a6d291 | ||
|
|
d2b1ff595d | ||
|
|
03d79fba16 | ||
|
|
989c29f7a0 | ||
|
|
8a79c0a4e0 | ||
|
|
307c333c50 | ||
|
|
3ce8b9f09c | ||
|
|
4dbe637510 | ||
|
|
c0e97e7f43 | ||
|
|
37fc64e97d | ||
|
|
ca93f08230 | ||
|
|
3581ce811c | ||
|
|
0411c40fae | ||
|
|
68cb96ab97 | ||
|
|
0159b8d0a3 | ||
|
|
aea3b49a51 | ||
|
|
1a6f775cc3 | ||
|
|
ddd192fad0 | ||
|
|
2e4fb32dac | ||
|
|
7d6e210625 | ||
|
|
3ca42ce42f | ||
|
|
e4e40cf049 | ||
|
|
d4f912e3b0 | ||
|
|
eec4443c95 | ||
|
|
b938c75892 | ||
|
|
455cb9ca24 | ||
|
|
24e7f5f864 | ||
|
|
298fa36c5d | ||
|
|
d31e9c5b55 | ||
|
|
30f53f398f | ||
|
|
eee217deec | ||
|
|
487ef6f1b9 | ||
|
|
a554b886c6 | ||
|
|
f2d68b075c | ||
|
|
dc24de3501 | ||
|
|
d2c73f072e | ||
|
|
96bc7f7aa6 | ||
|
|
bd48b24000 | ||
|
|
a26867bbdb | ||
|
|
8d570b7ba3 | ||
|
|
96f5a8adb3 | ||
|
|
3b34f0a972 | ||
|
|
fe5a0b7c64 | ||
|
|
2aa5324225 | ||
|
|
22f50402fe | ||
|
|
4e2f1bcf2b | ||
|
|
ca34b0c8d6 | ||
|
|
0df5ef996c | ||
|
|
4c0ea2695e | ||
|
|
48556ca428 | ||
|
|
5db50bbaff | ||
|
|
416da7cdc8 | ||
|
|
f47057e800 | ||
|
|
090559a766 | ||
|
|
1a6a3de443 | ||
|
|
0293fbfe99 | ||
|
|
ecfb52eabe | ||
|
|
999e1a525e | ||
|
|
ef530c2f7d | ||
|
|
3e5d1a436c | ||
|
|
962eb531ff | ||
|
|
07e1ca40a4 | ||
|
|
83bb908ff0 | ||
|
|
515c18c855 | ||
|
|
58de672915 | ||
|
|
16b5037486 | ||
|
|
bcec8b98f7 | ||
|
|
fa3dcdb24f | ||
|
|
311258dda0 | ||
|
|
a0f8816de7 | ||
|
|
c546b6225c | ||
|
|
f6c6621af8 |
No files matched your search
@@ -1,717 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
# This file is meant for authors, maintainers, co-maintainers or installers
|
||||
# of packages which are internationalized with the help of GNU gettext. For
|
||||
# further information how to use it consult the GNU gettext manual.
|
||||
|
||||
progname=$0
|
||||
package=gettext-tools
|
||||
version=0.18.1
|
||||
|
||||
# Set variables
|
||||
# - gettext_dir directory where the sources are stored.
|
||||
prefix="/usr/local/i686-w64-mingw32/stow/gettext-0.18.1.1"
|
||||
datarootdir="${prefix}/share"
|
||||
gettext_dir="${datarootdir}/gettext"
|
||||
|
||||
# func_tmpdir
|
||||
# creates a temporary directory.
|
||||
# Sets variable
|
||||
# - tmp pathname of freshly created temporary directory
|
||||
func_tmpdir ()
|
||||
{
|
||||
# Use the environment variable TMPDIR, falling back to /tmp. This allows
|
||||
# users to specify a different temporary directory, for example, if their
|
||||
# /tmp is filled up or too small.
|
||||
: ${TMPDIR=/tmp}
|
||||
{
|
||||
# Use the mktemp program if available. If not available, hide the error
|
||||
# message.
|
||||
tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} ||
|
||||
{
|
||||
# Use a simple mkdir command. It is guaranteed to fail if the directory
|
||||
# already exists. $RANDOM is bash specific and expands to empty in shells
|
||||
# other than bash, ksh and zsh. Its use does not increase security;
|
||||
# rather, it minimizes the probability of failure in a very cluttered /tmp
|
||||
# directory.
|
||||
tmp=$TMPDIR/gt$$-$RANDOM
|
||||
(umask 077 && mkdir "$tmp")
|
||||
} ||
|
||||
{
|
||||
echo "$0: cannot create a temporary directory in $TMPDIR" >&2
|
||||
{ (exit 1); exit 1; }
|
||||
}
|
||||
}
|
||||
|
||||
# Support for relocatability.
|
||||
func_find_curr_installdir ()
|
||||
{
|
||||
# Determine curr_installdir, even taking into account symlinks.
|
||||
curr_executable="$0"
|
||||
case "$curr_executable" in
|
||||
*/* | *\\*) ;;
|
||||
*) # Need to look in the PATH.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
func_tmpdir
|
||||
{ echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
|
||||
chmod +x "$tmp"/conf.sh
|
||||
if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
|
||||
PATH_SEPARATOR=';'
|
||||
else
|
||||
PATH_SEPARATOR=:
|
||||
fi
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
save_IFS="$IFS"; IFS="$PATH_SEPARATOR"
|
||||
for dir in $PATH; do
|
||||
IFS="$save_IFS"
|
||||
test -z "$dir" && dir=.
|
||||
for exec_ext in ''; do
|
||||
if test -f "$dir/$curr_executable$exec_ext"; then
|
||||
curr_executable="$dir/$curr_executable$exec_ext"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
;;
|
||||
esac
|
||||
# Make absolute.
|
||||
case "$curr_executable" in
|
||||
/* | ?:/* | ?:\\*) ;;
|
||||
*) curr_executable=`pwd`/"$curr_executable" ;;
|
||||
esac
|
||||
# Resolve symlinks.
|
||||
sed_dirname='s,/[^/]*$,,'
|
||||
sed_linkdest='s,^.* -> \(.*\),\1,p'
|
||||
while : ; do
|
||||
lsline=`LC_ALL=C ls -l "$curr_executable"`
|
||||
case "$lsline" in
|
||||
*" -> "*)
|
||||
linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
|
||||
case "$linkdest" in
|
||||
/* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
|
||||
*) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
|
||||
esac ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
curr_installdir=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`
|
||||
# Canonicalize.
|
||||
curr_installdir=`cd "$curr_installdir" && pwd`
|
||||
}
|
||||
func_find_prefixes ()
|
||||
{
|
||||
# Compute the original/current installation prefixes by stripping the
|
||||
# trailing directories off the original/current installation directories.
|
||||
orig_installprefix="$orig_installdir"
|
||||
curr_installprefix="$curr_installdir"
|
||||
while true; do
|
||||
orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
if test -z "$orig_last" || test -z "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
if test "$orig_last" != "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
orig_installprefix=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'`
|
||||
curr_installprefix=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'`
|
||||
done
|
||||
}
|
||||
if test "no" = yes; then
|
||||
exec_prefix="${prefix}"
|
||||
bindir="${exec_prefix}/bin"
|
||||
orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables
|
||||
func_find_curr_installdir # determine curr_installdir
|
||||
func_find_prefixes
|
||||
# Relocate the directory variables that we use.
|
||||
gettext_dir=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
|
||||
fi
|
||||
|
||||
# func_usage
|
||||
# outputs to stdout the --help usage message.
|
||||
func_usage ()
|
||||
{
|
||||
echo "\
|
||||
Usage: autopoint [OPTION]...
|
||||
|
||||
Copies standard gettext infrastructure files into a source package.
|
||||
|
||||
Options:
|
||||
--help print this help and exit
|
||||
--version print version information and exit
|
||||
-f, --force force overwriting of files that already exist
|
||||
-n, --dry-run print modifications but don't perform them"
|
||||
# echo "\
|
||||
# -V version copy the infrastructure of the specified gettext version
|
||||
# (dangerous)"
|
||||
echo "
|
||||
Report bugs to <bug-gnu-gettext@gnu.org>."
|
||||
}
|
||||
|
||||
# func_version
|
||||
# outputs to stdout the --version message.
|
||||
func_version ()
|
||||
{
|
||||
echo "$progname (GNU $package) $version"
|
||||
echo "Uses a versions archive in git format."
|
||||
echo "Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
echo "Written by" "Bruno Haible"
|
||||
}
|
||||
|
||||
# func_fatal_error message
|
||||
# outputs to stderr a fatal error message, and terminates the program.
|
||||
func_fatal_error ()
|
||||
{
|
||||
echo "autopoint: *** $1" 1>&2
|
||||
echo "autopoint: *** Stop." 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Command-line option processing.
|
||||
# Removes the OPTIONS from the arguments. Sets the variables:
|
||||
# - force yes if --force was given, empty otherwise
|
||||
# - ver gettext version if -V was given, empty otherwise
|
||||
# - doit false if --dry-run was given, : otherwise
|
||||
{
|
||||
force=
|
||||
ver=
|
||||
doit=:
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-n | --dry-run | --dry-ru | --dry-r | --dry- | --dry | --dr | --d )
|
||||
shift
|
||||
doit=false ;;
|
||||
-f | --force | --forc | --for | --fo | --f )
|
||||
shift
|
||||
force=yes ;;
|
||||
--help | --hel | --he | --h )
|
||||
func_usage; exit 0 ;;
|
||||
# -V ) # Some people put a space between -V and the version number.
|
||||
# shift
|
||||
# if test $# = 0; then
|
||||
# func_usage 1>&2
|
||||
# exit 1
|
||||
# fi
|
||||
# ver=$1;
|
||||
# shift ;;
|
||||
# -V*) # Some people omit the space between -V and the version number.
|
||||
# ver=`echo "X$1" | sed -e 's/^X-V//'`
|
||||
# shift ;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v )
|
||||
func_version
|
||||
exit 0 ;;
|
||||
-- ) # Stop option prcessing
|
||||
shift; break ;;
|
||||
-* )
|
||||
echo "autopoint: unknown option $1" 1>&2
|
||||
echo "Try 'autopoint --help' for more information." 1>&2
|
||||
exit 1 ;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Command-line argument processing.
|
||||
# Analyzes the remaining arguments.
|
||||
{
|
||||
if test $# -gt 0; then
|
||||
func_usage 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
srcdir=`pwd`
|
||||
# The current directory is now $srcdir.
|
||||
|
||||
# Check integrity of package: A configure.in/ac must be present. Sets variable
|
||||
# - configure_in name of configure.in/ac file.
|
||||
if test -f configure.in; then
|
||||
configure_in=configure.in
|
||||
else
|
||||
if test -f configure.ac; then
|
||||
configure_in=configure.ac
|
||||
else
|
||||
# KDE specific convention: configure.in.in
|
||||
if test -f configure.in.in; then
|
||||
configure_in=configure.in.in
|
||||
else
|
||||
func_fatal_error "Missing configure.in or configure.ac, please cd to your package first."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether the -V option and the version number in configure.in match.
|
||||
# At least one of the two must be given. If both are given, they must agree.
|
||||
sed_extract_AM_GNU_GETTEXT_VERSION_argument='s/^AM_GNU_GETTEXT_VERSION(\([^()]*\)).*$/\1/'
|
||||
sed_remove_outer_brackets='s/^\[\(.*\)\]$/\1/'
|
||||
xver=`cat "$configure_in" | grep '^AM_GNU_GETTEXT_VERSION(' | sed -n -e "$sed_extract_AM_GNU_GETTEXT_VERSION_argument"p | sed -e "$sed_remove_outer_brackets" | sed -e 1q`
|
||||
if test -z "$xver" && test -f intl/VERSION; then
|
||||
xver=`cat intl/VERSION | LC_ALL=C sed -n -e 's/^.*gettext-\([-+_.0-9A-Za-z]*\).*$/\1/p'`
|
||||
fi
|
||||
if test -n "$xver"; then
|
||||
if test -n "$ver"; then
|
||||
if test "X$ver" != "X$xver"; then
|
||||
func_fatal_error "Version mismatch: specified -V $ver but the package uses gettext version $xver"
|
||||
fi
|
||||
else
|
||||
ver="$xver"
|
||||
fi
|
||||
else
|
||||
if test -z "$ver"; then
|
||||
func_fatal_error "Missing version: please specify in $configure_in through a line 'AM_GNU_GETTEXT_VERSION(x.yy.zz)' the gettext version the package is using"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether the version number is supported.
|
||||
case "$ver" in
|
||||
0.10.35 | 0.10.36 | 0.10.37 | 0.10.38 | 0.10.39 | 0.10.40 | \
|
||||
0.11 | 0.11.1 | 0.11.2 | 0.11.3 | 0.11.4 | 0.11.5 | \
|
||||
0.12 | 0.12.1 | \
|
||||
0.13 | 0.13.1 | \
|
||||
0.14 | 0.14.1 | 0.14.2 | 0.14.3 | 0.14.4 | 0.14.5 | 0.14.6 | \
|
||||
0.15 | \
|
||||
0.16 | 0.16.1 | \
|
||||
0.17 | \
|
||||
0.18 | 0.18.1 )
|
||||
;;
|
||||
*)
|
||||
func_fatal_error "The AM_GNU_GETTEXT_VERSION declaration in your $configure_in
|
||||
file requires the infrastructure from gettext-$ver but this version
|
||||
is older. Please upgrade to gettext-$ver or newer."
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check in which directory config.rpath, mkinstalldirs etc. belong.
|
||||
auxdir=`cat "$configure_in" | grep '^AC_CONFIG_AUX_DIR' | sed -n -e 's/AC_CONFIG_AUX_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
|
||||
if test -n "$auxdir"; then
|
||||
auxdir="$auxdir/"
|
||||
fi
|
||||
|
||||
# Check in which directory the *.m4 macros belong.
|
||||
m4dir=m4
|
||||
if test -f Makefile.am; then
|
||||
# A package using automake.
|
||||
# Extract the macro directory name from Makefile.am.
|
||||
aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' Makefile.am | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'`
|
||||
m4dir_is_next=
|
||||
for arg in $aclocal_amflags; do
|
||||
if test -n "$m4dir_is_next"; then
|
||||
m4dir="$arg"
|
||||
break
|
||||
else
|
||||
if test "X$arg" = "X-I"; then
|
||||
m4dir_is_next=yes
|
||||
else
|
||||
m4dir_is_next=
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Check whether to omit the intl/ directory.
|
||||
omitintl=`cat "$configure_in" | grep '^AM_GNU_GETTEXT' | sed -n -e 's/^AM_GNU_GETTEXT(\([^(),]*\).*$/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
|
||||
omitintl=`if test 'external' = "$omitintl"; then echo yes; fi`
|
||||
|
||||
# Check in which directory or directories the po/* infrastructure belongs.
|
||||
sed_extract_config_files='s,#.*$,,
|
||||
s,^dnl .*$,,
|
||||
s, dnl .*$,,
|
||||
/AC_CONFIG_FILES(/ {
|
||||
ta
|
||||
:a
|
||||
s/)/)/
|
||||
tb
|
||||
s/\\$//
|
||||
N
|
||||
ba
|
||||
:b
|
||||
s,^.*AC_CONFIG_FILES([[ ]*\([^]"$`\\)]*\).*$,\1,p
|
||||
}'
|
||||
configfiles=`cat "$configure_in" | sed -n -e "$sed_extract_config_files"`
|
||||
# PO directories have a Makefile.in generated from Makefile.in.in.
|
||||
# Treat a directory as a PO directory if and only if it has a
|
||||
# POTFILES.in file. This allows packages to have multiple PO
|
||||
# directories under different names or in different locations.
|
||||
sed_remove_Makefile_in='s,/Makefile\.in$,,'
|
||||
podirs=`for f in $configfiles; do case "$f" in */Makefile.in) echo $f;; esac; done | sed -e "$sed_remove_Makefile_in"`
|
||||
if test -z "$podirs"; then
|
||||
# If we cannot get the list of PO directories from configure.ac, assume the
|
||||
# common default.
|
||||
podirs="po"
|
||||
fi
|
||||
|
||||
# Set up a temporary checkout directory.
|
||||
# Set variables
|
||||
# - work_dir directory containing the temporary checkout
|
||||
work_dir=tmpwrk$$
|
||||
mkdir "$work_dir" || {
|
||||
if test -d "$work_dir"; then
|
||||
func_fatal_error "directory $work_dir already exists"
|
||||
else
|
||||
func_fatal_error "cannot create directory $work_dir"
|
||||
fi
|
||||
}
|
||||
|
||||
# We support three archive formats.
|
||||
#
|
||||
# Format | Size (KiB) for gettext-0.17 | Extra tools needed |
|
||||
# -------+-----------------------------+--------------------+
|
||||
# dir | 3000 | -- |
|
||||
# cvs | 356 | cvs |
|
||||
# git | 484 | git |
|
||||
# -------+-----------------------------+--------------------+
|
||||
|
||||
case "git" in
|
||||
dir)
|
||||
# The archive of different versions is very large, but using it does not
|
||||
# require special tools.
|
||||
gzip -d -c < "$gettext_dir/archive.dir.tar.gz" | (cd "$work_dir" && tar xf - "gettext-$ver")
|
||||
if test `find "$work_dir" -type f -print | wc -l` = 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
fi
|
||||
mv "$work_dir/gettext-$ver" "$work_dir/archive"
|
||||
;;
|
||||
|
||||
cvs)
|
||||
# We distributed the many different versions of the files in a CVS
|
||||
# repository. This guaranteed a good compression rate:
|
||||
#
|
||||
# Including version size in KB of
|
||||
# "du autopoint-files/archive"
|
||||
# 0.10.35 240
|
||||
# 0.10.36 428
|
||||
# 0.10.37 436
|
||||
# 0.10.38 488
|
||||
# 0.10.39 500
|
||||
# 0.10.40 528
|
||||
# 0.11 720
|
||||
# 0.11.1 740
|
||||
# 0.11.2 748
|
||||
# 0.11.3 804
|
||||
# 0.11.4 864
|
||||
# 0.11.5 880
|
||||
# 0.12 1032
|
||||
# 0.12.1 1032
|
||||
# 0.13 1220
|
||||
# 0.13.1 1236
|
||||
# 0.14 1296
|
||||
# 0.14.1 1300
|
||||
# 0.14.2 1420
|
||||
# 0.14.3 1428
|
||||
# 0.14.4 1464
|
||||
# 0.14.5 1508
|
||||
# 0.14.6 1580
|
||||
# 0.15 1760
|
||||
# 0.16 1808
|
||||
# 0.16.1 1812
|
||||
# 0.17 2128
|
||||
# 0.18 2656
|
||||
#
|
||||
# The requirement that the user must have the CVS program available is not
|
||||
# a severe restrictions, because most of the people who use autopoint are
|
||||
# users of CVS.
|
||||
#
|
||||
# But the CVS format is now deprecated, because "cvs init" does not work in
|
||||
# all circumstances
|
||||
# (see <http://lists.gnu.org/archive/html/bug-cvs/2010-05/msg00003.html>)
|
||||
# and we are not allowed to distribute the cvs infrastructure files
|
||||
# ourselves
|
||||
# (see <http://lists.gnu.org/archive/html/bug-cvs/2010-06/msg00011.html>).
|
||||
#
|
||||
# Check availability of the CVS program.
|
||||
(cvs -v) >/dev/null 2>/dev/null || func_fatal_error "cvs program not found"
|
||||
|
||||
# Set up a temporary CVS repository.
|
||||
# We need the temporary CVS repository because any checkout needs write
|
||||
# access to the CVSROOT/history file, so it cannot be under $gettext_dir.
|
||||
# We need the temporary checkout directory because when --force was not
|
||||
# given, we need to compare the existing files with the checked out ones.
|
||||
# Set variables
|
||||
# - cvs_dir directory containing the temporary repository
|
||||
cvs_dir=tmpcvs$$
|
||||
# Use an umask of 077, to avoid attacks that work by overwriting files in
|
||||
# the "$CVSROOT"/CVSROOT directory.
|
||||
(umask 077 && mkdir "$cvs_dir") || {
|
||||
if test -d "$cvs_dir"; then
|
||||
func_fatal_error "directory $cvs_dir already exists"
|
||||
else
|
||||
func_fatal_error "cannot create directory $cvs_dir"
|
||||
fi
|
||||
}
|
||||
CVSROOT="$srcdir/$cvs_dir"
|
||||
unset CVS_CLIENT_LOG
|
||||
unset CVS_CLIENT_PORT
|
||||
unset CVS_IGNORE_REMOTE_ROOT
|
||||
unset CVS_LOCAL_BRANCH_NUM
|
||||
unset CVS_NOBASES
|
||||
unset CVS_PASSFILE
|
||||
unset CVS_PASSWORD
|
||||
unset CVS_PROXY_PORT
|
||||
unset CVS_RCMD_PORT
|
||||
unset CVS_RSH
|
||||
unset CVS_SERVER
|
||||
unset CVS_SERVER_SLEEP
|
||||
CVS_SIGN_COMMITS=
|
||||
export CVS_SIGN_COMMITS
|
||||
unset CVS_SSH
|
||||
unset CVS_VERIFY_CHECKOUTS
|
||||
unset CVS_VERIFY_TEMPLATE
|
||||
unset CVSIGNORE
|
||||
unset CVSREAD
|
||||
unset CVSREADONLYFS
|
||||
unset CVSUMASK
|
||||
unset CVSWRAPPERS
|
||||
|
||||
# Need to pass -d "$CVSROOT", because there may be a CVS directory in the
|
||||
# current directory.
|
||||
cvs -d "$CVSROOT" init
|
||||
gzip -d -c < "$gettext_dir/archive.cvs.tar.gz" | (cd "$cvs_dir" && tar xf -)
|
||||
|
||||
cd "$work_dir"
|
||||
cvsver=gettext-`echo "$ver" | sed -e 's/\./_/g'`
|
||||
(cvs -d "$CVSROOT" checkout -r"$cvsver" archive > /dev/null) 2>&1 | grep -v '^cvs checkout: Updating'
|
||||
find archive -name CVS -type d -print | xargs rm -rf
|
||||
cd ..
|
||||
rm -rf "$cvs_dir"
|
||||
# Check that really all CVS directories are gone, otherwise we would overwrite
|
||||
# the contents of the user's CVS directories.
|
||||
if test `find $work_dir/archive -name CVS -type d -print | wc -l` != 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "failed to remove all CVS subdirectories"
|
||||
fi
|
||||
if test `find $work_dir/archive -type f -print | wc -l` = 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
fi
|
||||
;;
|
||||
|
||||
git)
|
||||
# Check availability of the git program.
|
||||
(git --version) >/dev/null 2>/dev/null || func_fatal_error "git program not found"
|
||||
mkdir "$work_dir/archive"
|
||||
gzip -d -c < "$gettext_dir/archive.git.tar.gz" | (cd "$work_dir/archive" && tar xf -)
|
||||
(cd "$work_dir/archive" && git checkout -q "gettext-$ver") || {
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
}
|
||||
(cd "$work_dir/archive" && rm -rf .git .gitignore)
|
||||
;;
|
||||
esac
|
||||
|
||||
# func_destfile file
|
||||
# determines the destination file, relative to the package's top level
|
||||
# directory, for a given file name, relative to archive.
|
||||
# Sets variables
|
||||
# - destfile relative destination file name, or
|
||||
# empty if the file shall be omitted
|
||||
# - sharedowner yes if the file is not only owned by GNU gettext but may
|
||||
# be installed by automake or other tools, otherwise empty
|
||||
# - allpodirs yes if the file is to be installed in every dir in $podirs
|
||||
func_destfile ()
|
||||
{
|
||||
# There are five categories of files:
|
||||
# ABOUT_NLS -> top level directory
|
||||
# config.rpath mkinstalldirs -> $auxdir
|
||||
# m4/* -> $m4dir/
|
||||
# intl/* -> intl/
|
||||
# po/* ->
|
||||
sharedowner=
|
||||
allpodirs=
|
||||
case `echo "$1" | sed -e 's,[^/]*$,,'` in
|
||||
"" )
|
||||
case "$1" in
|
||||
config.rpath ) destfile="$auxdir$1" ;;
|
||||
mkinstalldirs ) destfile="$auxdir$1" sharedowner=yes ;;
|
||||
* ) destfile="$1" ;;
|
||||
esac
|
||||
;;
|
||||
m4/ ) destfile=`echo "$1" | sed -e "s,^m4/,$m4dir/,"` ;;
|
||||
intl/ ) if test -n "$omitintl"; then destfile=""; else destfile="$1"; fi ;;
|
||||
po/ ) destfile=`echo "$1" | sed -e "s,^po/,,"` allpodirs=yes ;;
|
||||
* ) destfile="$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_compare existingfile gettextfile
|
||||
# compares the existing file and the file from gettext, and decides whether the
|
||||
# existing file should be overwritten with the file from gettext. Returns 0 if
|
||||
# it should be overwritten, or 1 if it should be skipped.
|
||||
sed_extract_serial='s/^#.* serial \([^ ]*\).*/\1/p
|
||||
1q'
|
||||
func_compare ()
|
||||
{
|
||||
if cmp -s "$1" "$2"; then
|
||||
false
|
||||
else
|
||||
case "$2" in
|
||||
*.m4)
|
||||
# For interoperability with gnulib. gnulib often has newer versions of
|
||||
# the *.m4 files than the latest gettext release. Don't overwrite a
|
||||
# newer version from gnulib with an older version from the gettext
|
||||
# release. The version can be retrieved from the first line, which
|
||||
# looks like this: # file.m4 serial NN ...
|
||||
existing_serial=`sed -n -e "$sed_extract_serial" < "$1"`
|
||||
gettext_serial=`sed -n -e "$sed_extract_serial" < "$2"`
|
||||
if test -n "$existing_serial" && test -n "$gettext_serial" \
|
||||
&& test "$existing_serial" -ge "$gettext_serial" 2> /dev/null; then
|
||||
false
|
||||
else
|
||||
true
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
true
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
# If some files have been locally modified and we have not been requested
|
||||
# to overwrite them, then bail out. This is better than leaving a source
|
||||
# package around where half of the files are locally modified and half are
|
||||
# original - too great risk of version mismatch.
|
||||
if test -z "$force"; then
|
||||
mismatch=
|
||||
func_tmpdir
|
||||
mismatchfile="$tmp"/autopoint.diff
|
||||
for file in `find "$work_dir/archive" -type f -print | sed -e "s,^$work_dir/archive/,," | LC_ALL=C sort`; do
|
||||
func_destfile "$file"
|
||||
if test -n "$destfile"; then
|
||||
func_compare_to_destfile ()
|
||||
{
|
||||
finaldestfile="$1"
|
||||
if test -f "$finaldestfile"; then
|
||||
if func_compare "$finaldestfile" "$work_dir/archive/$file"; then
|
||||
if test -n "$sharedowner"; then
|
||||
echo "autopoint: warning: File $finaldestfile has been locally modified." 1>&2
|
||||
else
|
||||
echo "autopoint: File $finaldestfile has been locally modified." 1>&2
|
||||
mismatch=yes
|
||||
diff -c "$work_dir/archive/$file" "$finaldestfile" | sed -e "1s,$work_dir/archive/,," >> "$mismatchfile"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
if test -n "$allpodirs"; then
|
||||
for dir in $podirs; do
|
||||
func_compare_to_destfile "$dir/$destfile"
|
||||
done
|
||||
else
|
||||
func_compare_to_destfile "$destfile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if test -n "$mismatch"; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "Some files have been locally modified. Not overwriting them because --force has not been specified. For your convenience, you find the local modifications in the file '$mismatchfile'."
|
||||
fi
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
|
||||
# func_mkdir_for to
|
||||
# ensures the directory that would the given file exists.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_mkdir_for ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's,/[^/]*$,,'`
|
||||
if test "X$base" != "X$1" && test -n "$base"; then
|
||||
func_mkdir_for "$base"
|
||||
# Recompute base. It was clobbered by the recursive call.
|
||||
base=`echo "$1" | sed -e 's,/[^/]*$,,'`
|
||||
test -d "$base" || { echo "Creating directory $base"; mkdir "$base"; }
|
||||
fi
|
||||
}
|
||||
|
||||
# func_copy from to
|
||||
# copies a file.
|
||||
# 'from' is a relative pathname, relative to the current directory.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_copy ()
|
||||
{
|
||||
if $doit; then
|
||||
func_mkdir_for "$2"
|
||||
rm -f "$2"
|
||||
echo "Copying file $2"
|
||||
cp "$1" "$2"
|
||||
else
|
||||
echo "Copy file $2"
|
||||
fi
|
||||
}
|
||||
|
||||
# func_backup to
|
||||
# makes a backup of a file that is about to be overwritten or replaced.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_backup ()
|
||||
{
|
||||
if $doit; then
|
||||
if test -f "$1"; then
|
||||
rm -f "$1~"
|
||||
cp -p "$1" "$1~"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Now copy the files.
|
||||
for file in `find "$work_dir/archive" -type f -print | sed -e "s,^$work_dir/archive/,," | LC_ALL=C sort`; do
|
||||
func_destfile "$file"
|
||||
if test -n "$destfile"; then
|
||||
func_copy_to_destfile ()
|
||||
{
|
||||
finaldestfile="$1"
|
||||
mustcopy=
|
||||
if test -f "$finaldestfile"; then
|
||||
if func_compare "$finaldestfile" "$work_dir/archive/$file"; then
|
||||
if test -n "$force"; then
|
||||
# Overwrite locally modified file.
|
||||
mustcopy=yes
|
||||
fi
|
||||
# If --force is not specified, don't overwrite locally modified files
|
||||
# for which GNU gettext is a shared owner.
|
||||
fi
|
||||
else
|
||||
mustcopy=yes
|
||||
fi
|
||||
if test -n "$mustcopy"; then
|
||||
func_backup "$finaldestfile"
|
||||
func_copy "$work_dir/archive/$file" "$finaldestfile"
|
||||
fi
|
||||
}
|
||||
if test -n "$allpodirs"; then
|
||||
for dir in $podirs; do
|
||||
func_copy_to_destfile "$dir/$destfile"
|
||||
done
|
||||
else
|
||||
func_copy_to_destfile "$destfile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# That's it.
|
||||
rm -rf "$work_dir"
|
||||
exit 0
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,123 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library General Public License as published
|
||||
# by the Free Software Foundation; either version 2, 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 Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
|
||||
# Find a way to echo strings without interpreting backslash.
|
||||
if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo='echo'
|
||||
else
|
||||
if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo='printf %s\n'
|
||||
else
|
||||
echo_func () {
|
||||
cat <<EOT
|
||||
$*
|
||||
EOT
|
||||
}
|
||||
echo='echo_func'
|
||||
fi
|
||||
fi
|
||||
|
||||
# This script is primarily a shell function library. In order for
|
||||
# ". gettext.sh" to find it, we install it in $PREFIX/bin (that is usually
|
||||
# contained in $PATH), rather than in some other location such as
|
||||
# $PREFIX/share/sh-scripts or $PREFIX/share/gettext. In order to not violate
|
||||
# the Filesystem Hierarchy Standard when doing so, this script is executable.
|
||||
# Therefore it needs to support the standard --help and --version.
|
||||
if test -z "$ZSH_VERSION"; then
|
||||
# zsh is not POSIX compliant: By default, while ". gettext.sh" is executed,
|
||||
# it sets $0 to "gettext.sh", defeating the purpose of this test. But
|
||||
# fortunately we know that when running under zsh, this script is always
|
||||
# being sourced, not executed, because hardly anyone is crazy enough to
|
||||
# install zsh as /bin/sh.
|
||||
case "$0" in
|
||||
gettext.sh | */gettext.sh | *\\gettext.sh)
|
||||
progname=$0
|
||||
package=gettext-runtime
|
||||
version=0.18.1
|
||||
# func_usage
|
||||
# outputs to stdout the --help usage message.
|
||||
func_usage ()
|
||||
{
|
||||
echo "GNU gettext shell script function library version $version"
|
||||
echo "Usage: . gettext.sh"
|
||||
}
|
||||
# func_version
|
||||
# outputs to stdout the --version message.
|
||||
func_version ()
|
||||
{
|
||||
echo "$progname (GNU $package) $version"
|
||||
echo "Copyright (C) 2003-2007 Free Software Foundation, Inc.
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
echo "Written by" "Bruno Haible"
|
||||
}
|
||||
if test $# = 1; then
|
||||
case "$1" in
|
||||
--help | --hel | --he | --h )
|
||||
func_usage; exit 0 ;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v )
|
||||
func_version; exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
func_usage 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# eval_gettext MSGID
|
||||
# looks up the translation of MSGID and substitutes shell variables in the
|
||||
# result.
|
||||
eval_gettext () {
|
||||
gettext "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1")
|
||||
}
|
||||
|
||||
# eval_ngettext MSGID MSGID-PLURAL COUNT
|
||||
# looks up the translation of MSGID / MSGID-PLURAL for COUNT and substitutes
|
||||
# shell variables in the result.
|
||||
eval_ngettext () {
|
||||
ngettext "$1" "$2" "$3" | (export PATH `envsubst --variables "$1 $2"`; envsubst "$1 $2")
|
||||
}
|
||||
|
||||
# Note: This use of envsubst is much safer than using the shell built-in 'eval'
|
||||
# would be.
|
||||
# 1) The security problem with Chinese translations that happen to use a
|
||||
# character such as \xe0\x60 is avoided.
|
||||
# 2) The security problem with malevolent translators who put in command lists
|
||||
# like "$(...)" or "`...`" is avoided.
|
||||
# 3) The translations can only refer to shell variables that are already
|
||||
# mentioned in MSGID or MSGID-PLURAL.
|
||||
#
|
||||
# Note: "export PATH" above is a dummy; this is for the case when
|
||||
# `envsubst --variables ...` returns nothing.
|
||||
#
|
||||
# Note: In eval_ngettext above, "$1 $2" means a string whose variables set is
|
||||
# the union of the variables set of "$1" and "$2".
|
||||
#
|
||||
# Note: The minimal use of backquote above ensures that trailing newlines are
|
||||
# not dropped, not from the gettext invocation and not from the value of any
|
||||
# shell variable.
|
||||
#
|
||||
# Note: Field splitting on the `envsubst --variables ...` result is desired,
|
||||
# since envsubst outputs the variables, separated by newlines. Pathname
|
||||
# wildcard expansion or tilde expansion has no effect here, since the words
|
||||
# output by "envsubst --variables ..." consist solely of alphanumeric
|
||||
# characters and underscore.
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,717 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
|
||||
# This file is meant for authors, maintainers, co-maintainers or installers
|
||||
# of packages which are internationalized with the help of GNU gettext. For
|
||||
# further information how to use it consult the GNU gettext manual.
|
||||
|
||||
progname=$0
|
||||
package=gettext-tools
|
||||
version=0.18.1
|
||||
|
||||
# Set variables
|
||||
# - gettext_dir directory where the sources are stored.
|
||||
prefix="/usr/local/x86_64-w64-mingw32/stow/gettext-0.18.1.1"
|
||||
datarootdir="${prefix}/share"
|
||||
gettext_dir="${datarootdir}/gettext"
|
||||
|
||||
# func_tmpdir
|
||||
# creates a temporary directory.
|
||||
# Sets variable
|
||||
# - tmp pathname of freshly created temporary directory
|
||||
func_tmpdir ()
|
||||
{
|
||||
# Use the environment variable TMPDIR, falling back to /tmp. This allows
|
||||
# users to specify a different temporary directory, for example, if their
|
||||
# /tmp is filled up or too small.
|
||||
: ${TMPDIR=/tmp}
|
||||
{
|
||||
# Use the mktemp program if available. If not available, hide the error
|
||||
# message.
|
||||
tmp=`(umask 077 && mktemp -d "$TMPDIR/gtXXXXXX") 2>/dev/null` &&
|
||||
test -n "$tmp" && test -d "$tmp"
|
||||
} ||
|
||||
{
|
||||
# Use a simple mkdir command. It is guaranteed to fail if the directory
|
||||
# already exists. $RANDOM is bash specific and expands to empty in shells
|
||||
# other than bash, ksh and zsh. Its use does not increase security;
|
||||
# rather, it minimizes the probability of failure in a very cluttered /tmp
|
||||
# directory.
|
||||
tmp=$TMPDIR/gt$$-$RANDOM
|
||||
(umask 077 && mkdir "$tmp")
|
||||
} ||
|
||||
{
|
||||
echo "$0: cannot create a temporary directory in $TMPDIR" >&2
|
||||
{ (exit 1); exit 1; }
|
||||
}
|
||||
}
|
||||
|
||||
# Support for relocatability.
|
||||
func_find_curr_installdir ()
|
||||
{
|
||||
# Determine curr_installdir, even taking into account symlinks.
|
||||
curr_executable="$0"
|
||||
case "$curr_executable" in
|
||||
*/* | *\\*) ;;
|
||||
*) # Need to look in the PATH.
|
||||
if test "${PATH_SEPARATOR+set}" != set; then
|
||||
func_tmpdir
|
||||
{ echo "#! /bin/sh"; echo "exit 0"; } > "$tmp"/conf.sh
|
||||
chmod +x "$tmp"/conf.sh
|
||||
if (PATH="/nonexistent;$tmp"; conf.sh) >/dev/null 2>&1; then
|
||||
PATH_SEPARATOR=';'
|
||||
else
|
||||
PATH_SEPARATOR=:
|
||||
fi
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
save_IFS="$IFS"; IFS="$PATH_SEPARATOR"
|
||||
for dir in $PATH; do
|
||||
IFS="$save_IFS"
|
||||
test -z "$dir" && dir=.
|
||||
for exec_ext in ''; do
|
||||
if test -f "$dir/$curr_executable$exec_ext"; then
|
||||
curr_executable="$dir/$curr_executable$exec_ext"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
IFS="$save_IFS"
|
||||
;;
|
||||
esac
|
||||
# Make absolute.
|
||||
case "$curr_executable" in
|
||||
/* | ?:/* | ?:\\*) ;;
|
||||
*) curr_executable=`pwd`/"$curr_executable" ;;
|
||||
esac
|
||||
# Resolve symlinks.
|
||||
sed_dirname='s,/[^/]*$,,'
|
||||
sed_linkdest='s,^.* -> \(.*\),\1,p'
|
||||
while : ; do
|
||||
lsline=`LC_ALL=C ls -l "$curr_executable"`
|
||||
case "$lsline" in
|
||||
*" -> "*)
|
||||
linkdest=`echo "$lsline" | sed -n -e "$sed_linkdest"`
|
||||
case "$linkdest" in
|
||||
/* | ?:/* | ?:\\*) curr_executable="$linkdest" ;;
|
||||
*) curr_executable=`echo "$curr_executable" | sed -e "$sed_dirname"`/"$linkdest" ;;
|
||||
esac ;;
|
||||
*) break ;;
|
||||
esac
|
||||
done
|
||||
curr_installdir=`echo "$curr_executable" | sed -e 's,/[^/]*$,,'`
|
||||
# Canonicalize.
|
||||
curr_installdir=`cd "$curr_installdir" && pwd`
|
||||
}
|
||||
func_find_prefixes ()
|
||||
{
|
||||
# Compute the original/current installation prefixes by stripping the
|
||||
# trailing directories off the original/current installation directories.
|
||||
orig_installprefix="$orig_installdir"
|
||||
curr_installprefix="$curr_installdir"
|
||||
while true; do
|
||||
orig_last=`echo "$orig_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
curr_last=`echo "$curr_installprefix" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
if test -z "$orig_last" || test -z "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
if test "$orig_last" != "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
orig_installprefix=`echo "$orig_installprefix" | sed -e 's,/[^/]*$,,'`
|
||||
curr_installprefix=`echo "$curr_installprefix" | sed -e 's,/[^/]*$,,'`
|
||||
done
|
||||
}
|
||||
if test "no" = yes; then
|
||||
exec_prefix="${prefix}"
|
||||
bindir="${exec_prefix}/bin"
|
||||
orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables
|
||||
func_find_curr_installdir # determine curr_installdir
|
||||
func_find_prefixes
|
||||
# Relocate the directory variables that we use.
|
||||
gettext_dir=`echo "$gettext_dir/" | sed -e "s%^${orig_installprefix}/%${curr_installprefix}/%" | sed -e 's,/$,,'`
|
||||
fi
|
||||
|
||||
# func_usage
|
||||
# outputs to stdout the --help usage message.
|
||||
func_usage ()
|
||||
{
|
||||
echo "\
|
||||
Usage: autopoint [OPTION]...
|
||||
|
||||
Copies standard gettext infrastructure files into a source package.
|
||||
|
||||
Options:
|
||||
--help print this help and exit
|
||||
--version print version information and exit
|
||||
-f, --force force overwriting of files that already exist
|
||||
-n, --dry-run print modifications but don't perform them"
|
||||
# echo "\
|
||||
# -V version copy the infrastructure of the specified gettext version
|
||||
# (dangerous)"
|
||||
echo "
|
||||
Report bugs to <bug-gnu-gettext@gnu.org>."
|
||||
}
|
||||
|
||||
# func_version
|
||||
# outputs to stdout the --version message.
|
||||
func_version ()
|
||||
{
|
||||
echo "$progname (GNU $package) $version"
|
||||
echo "Uses a versions archive in git format."
|
||||
echo "Copyright (C) 2002-2010 Free Software Foundation, Inc.
|
||||
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
echo "Written by" "Bruno Haible"
|
||||
}
|
||||
|
||||
# func_fatal_error message
|
||||
# outputs to stderr a fatal error message, and terminates the program.
|
||||
func_fatal_error ()
|
||||
{
|
||||
echo "autopoint: *** $1" 1>&2
|
||||
echo "autopoint: *** Stop." 1>&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Command-line option processing.
|
||||
# Removes the OPTIONS from the arguments. Sets the variables:
|
||||
# - force yes if --force was given, empty otherwise
|
||||
# - ver gettext version if -V was given, empty otherwise
|
||||
# - doit false if --dry-run was given, : otherwise
|
||||
{
|
||||
force=
|
||||
ver=
|
||||
doit=:
|
||||
|
||||
while test $# -gt 0; do
|
||||
case "$1" in
|
||||
-n | --dry-run | --dry-ru | --dry-r | --dry- | --dry | --dr | --d )
|
||||
shift
|
||||
doit=false ;;
|
||||
-f | --force | --forc | --for | --fo | --f )
|
||||
shift
|
||||
force=yes ;;
|
||||
--help | --hel | --he | --h )
|
||||
func_usage; exit 0 ;;
|
||||
# -V ) # Some people put a space between -V and the version number.
|
||||
# shift
|
||||
# if test $# = 0; then
|
||||
# func_usage 1>&2
|
||||
# exit 1
|
||||
# fi
|
||||
# ver=$1;
|
||||
# shift ;;
|
||||
# -V*) # Some people omit the space between -V and the version number.
|
||||
# ver=`echo "X$1" | sed -e 's/^X-V//'`
|
||||
# shift ;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v )
|
||||
func_version
|
||||
exit 0 ;;
|
||||
-- ) # Stop option prcessing
|
||||
shift; break ;;
|
||||
-* )
|
||||
echo "autopoint: unknown option $1" 1>&2
|
||||
echo "Try 'autopoint --help' for more information." 1>&2
|
||||
exit 1 ;;
|
||||
* )
|
||||
break ;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
# Command-line argument processing.
|
||||
# Analyzes the remaining arguments.
|
||||
{
|
||||
if test $# -gt 0; then
|
||||
func_usage 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
srcdir=`pwd`
|
||||
# The current directory is now $srcdir.
|
||||
|
||||
# Check integrity of package: A configure.in/ac must be present. Sets variable
|
||||
# - configure_in name of configure.in/ac file.
|
||||
if test -f configure.in; then
|
||||
configure_in=configure.in
|
||||
else
|
||||
if test -f configure.ac; then
|
||||
configure_in=configure.ac
|
||||
else
|
||||
# KDE specific convention: configure.in.in
|
||||
if test -f configure.in.in; then
|
||||
configure_in=configure.in.in
|
||||
else
|
||||
func_fatal_error "Missing configure.in or configure.ac, please cd to your package first."
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether the -V option and the version number in configure.in match.
|
||||
# At least one of the two must be given. If both are given, they must agree.
|
||||
sed_extract_AM_GNU_GETTEXT_VERSION_argument='s/^AM_GNU_GETTEXT_VERSION(\([^()]*\)).*$/\1/'
|
||||
sed_remove_outer_brackets='s/^\[\(.*\)\]$/\1/'
|
||||
xver=`cat "$configure_in" | grep '^AM_GNU_GETTEXT_VERSION(' | sed -n -e "$sed_extract_AM_GNU_GETTEXT_VERSION_argument"p | sed -e "$sed_remove_outer_brackets" | sed -e 1q`
|
||||
if test -z "$xver" && test -f intl/VERSION; then
|
||||
xver=`cat intl/VERSION | LC_ALL=C sed -n -e 's/^.*gettext-\([-+_.0-9A-Za-z]*\).*$/\1/p'`
|
||||
fi
|
||||
if test -n "$xver"; then
|
||||
if test -n "$ver"; then
|
||||
if test "X$ver" != "X$xver"; then
|
||||
func_fatal_error "Version mismatch: specified -V $ver but the package uses gettext version $xver"
|
||||
fi
|
||||
else
|
||||
ver="$xver"
|
||||
fi
|
||||
else
|
||||
if test -z "$ver"; then
|
||||
func_fatal_error "Missing version: please specify in $configure_in through a line 'AM_GNU_GETTEXT_VERSION(x.yy.zz)' the gettext version the package is using"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether the version number is supported.
|
||||
case "$ver" in
|
||||
0.10.35 | 0.10.36 | 0.10.37 | 0.10.38 | 0.10.39 | 0.10.40 | \
|
||||
0.11 | 0.11.1 | 0.11.2 | 0.11.3 | 0.11.4 | 0.11.5 | \
|
||||
0.12 | 0.12.1 | \
|
||||
0.13 | 0.13.1 | \
|
||||
0.14 | 0.14.1 | 0.14.2 | 0.14.3 | 0.14.4 | 0.14.5 | 0.14.6 | \
|
||||
0.15 | \
|
||||
0.16 | 0.16.1 | \
|
||||
0.17 | \
|
||||
0.18 | 0.18.1 )
|
||||
;;
|
||||
*)
|
||||
func_fatal_error "The AM_GNU_GETTEXT_VERSION declaration in your $configure_in
|
||||
file requires the infrastructure from gettext-$ver but this version
|
||||
is older. Please upgrade to gettext-$ver or newer."
|
||||
;;
|
||||
esac
|
||||
|
||||
# Check in which directory config.rpath, mkinstalldirs etc. belong.
|
||||
auxdir=`cat "$configure_in" | grep '^AC_CONFIG_AUX_DIR' | sed -n -e 's/AC_CONFIG_AUX_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
|
||||
if test -n "$auxdir"; then
|
||||
auxdir="$auxdir/"
|
||||
fi
|
||||
|
||||
# Check in which directory the *.m4 macros belong.
|
||||
m4dir=m4
|
||||
if test -f Makefile.am; then
|
||||
# A package using automake.
|
||||
# Extract the macro directory name from Makefile.am.
|
||||
aclocal_amflags=`grep '^ACLOCAL_AMFLAGS[ ]*=' Makefile.am | sed -e 's/^ACLOCAL_AMFLAGS[ ]*=\(.*\)$/\1/'`
|
||||
m4dir_is_next=
|
||||
for arg in $aclocal_amflags; do
|
||||
if test -n "$m4dir_is_next"; then
|
||||
m4dir="$arg"
|
||||
break
|
||||
else
|
||||
if test "X$arg" = "X-I"; then
|
||||
m4dir_is_next=yes
|
||||
else
|
||||
m4dir_is_next=
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# Check whether to omit the intl/ directory.
|
||||
omitintl=`cat "$configure_in" | grep '^AM_GNU_GETTEXT' | sed -n -e 's/^AM_GNU_GETTEXT(\([^(),]*\).*$/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q`
|
||||
omitintl=`if test 'external' = "$omitintl"; then echo yes; fi`
|
||||
|
||||
# Check in which directory or directories the po/* infrastructure belongs.
|
||||
sed_extract_config_files='s,#.*$,,
|
||||
s,^dnl .*$,,
|
||||
s, dnl .*$,,
|
||||
/AC_CONFIG_FILES(/ {
|
||||
ta
|
||||
:a
|
||||
s/)/)/
|
||||
tb
|
||||
s/\\$//
|
||||
N
|
||||
ba
|
||||
:b
|
||||
s,^.*AC_CONFIG_FILES([[ ]*\([^]"$`\\)]*\).*$,\1,p
|
||||
}'
|
||||
configfiles=`cat "$configure_in" | sed -n -e "$sed_extract_config_files"`
|
||||
# PO directories have a Makefile.in generated from Makefile.in.in.
|
||||
# Treat a directory as a PO directory if and only if it has a
|
||||
# POTFILES.in file. This allows packages to have multiple PO
|
||||
# directories under different names or in different locations.
|
||||
sed_remove_Makefile_in='s,/Makefile\.in$,,'
|
||||
podirs=`for f in $configfiles; do case "$f" in */Makefile.in) echo $f;; esac; done | sed -e "$sed_remove_Makefile_in"`
|
||||
if test -z "$podirs"; then
|
||||
# If we cannot get the list of PO directories from configure.ac, assume the
|
||||
# common default.
|
||||
podirs="po"
|
||||
fi
|
||||
|
||||
# Set up a temporary checkout directory.
|
||||
# Set variables
|
||||
# - work_dir directory containing the temporary checkout
|
||||
work_dir=tmpwrk$$
|
||||
mkdir "$work_dir" || {
|
||||
if test -d "$work_dir"; then
|
||||
func_fatal_error "directory $work_dir already exists"
|
||||
else
|
||||
func_fatal_error "cannot create directory $work_dir"
|
||||
fi
|
||||
}
|
||||
|
||||
# We support three archive formats.
|
||||
#
|
||||
# Format | Size (KiB) for gettext-0.17 | Extra tools needed |
|
||||
# -------+-----------------------------+--------------------+
|
||||
# dir | 3000 | -- |
|
||||
# cvs | 356 | cvs |
|
||||
# git | 484 | git |
|
||||
# -------+-----------------------------+--------------------+
|
||||
|
||||
case "git" in
|
||||
dir)
|
||||
# The archive of different versions is very large, but using it does not
|
||||
# require special tools.
|
||||
gzip -d -c < "$gettext_dir/archive.dir.tar.gz" | (cd "$work_dir" && tar xf - "gettext-$ver")
|
||||
if test `find "$work_dir" -type f -print | wc -l` = 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
fi
|
||||
mv "$work_dir/gettext-$ver" "$work_dir/archive"
|
||||
;;
|
||||
|
||||
cvs)
|
||||
# We distributed the many different versions of the files in a CVS
|
||||
# repository. This guaranteed a good compression rate:
|
||||
#
|
||||
# Including version size in KB of
|
||||
# "du autopoint-files/archive"
|
||||
# 0.10.35 240
|
||||
# 0.10.36 428
|
||||
# 0.10.37 436
|
||||
# 0.10.38 488
|
||||
# 0.10.39 500
|
||||
# 0.10.40 528
|
||||
# 0.11 720
|
||||
# 0.11.1 740
|
||||
# 0.11.2 748
|
||||
# 0.11.3 804
|
||||
# 0.11.4 864
|
||||
# 0.11.5 880
|
||||
# 0.12 1032
|
||||
# 0.12.1 1032
|
||||
# 0.13 1220
|
||||
# 0.13.1 1236
|
||||
# 0.14 1296
|
||||
# 0.14.1 1300
|
||||
# 0.14.2 1420
|
||||
# 0.14.3 1428
|
||||
# 0.14.4 1464
|
||||
# 0.14.5 1508
|
||||
# 0.14.6 1580
|
||||
# 0.15 1760
|
||||
# 0.16 1808
|
||||
# 0.16.1 1812
|
||||
# 0.17 2128
|
||||
# 0.18 2656
|
||||
#
|
||||
# The requirement that the user must have the CVS program available is not
|
||||
# a severe restrictions, because most of the people who use autopoint are
|
||||
# users of CVS.
|
||||
#
|
||||
# But the CVS format is now deprecated, because "cvs init" does not work in
|
||||
# all circumstances
|
||||
# (see <http://lists.gnu.org/archive/html/bug-cvs/2010-05/msg00003.html>)
|
||||
# and we are not allowed to distribute the cvs infrastructure files
|
||||
# ourselves
|
||||
# (see <http://lists.gnu.org/archive/html/bug-cvs/2010-06/msg00011.html>).
|
||||
#
|
||||
# Check availability of the CVS program.
|
||||
(cvs -v) >/dev/null 2>/dev/null || func_fatal_error "cvs program not found"
|
||||
|
||||
# Set up a temporary CVS repository.
|
||||
# We need the temporary CVS repository because any checkout needs write
|
||||
# access to the CVSROOT/history file, so it cannot be under $gettext_dir.
|
||||
# We need the temporary checkout directory because when --force was not
|
||||
# given, we need to compare the existing files with the checked out ones.
|
||||
# Set variables
|
||||
# - cvs_dir directory containing the temporary repository
|
||||
cvs_dir=tmpcvs$$
|
||||
# Use an umask of 077, to avoid attacks that work by overwriting files in
|
||||
# the "$CVSROOT"/CVSROOT directory.
|
||||
(umask 077 && mkdir "$cvs_dir") || {
|
||||
if test -d "$cvs_dir"; then
|
||||
func_fatal_error "directory $cvs_dir already exists"
|
||||
else
|
||||
func_fatal_error "cannot create directory $cvs_dir"
|
||||
fi
|
||||
}
|
||||
CVSROOT="$srcdir/$cvs_dir"
|
||||
unset CVS_CLIENT_LOG
|
||||
unset CVS_CLIENT_PORT
|
||||
unset CVS_IGNORE_REMOTE_ROOT
|
||||
unset CVS_LOCAL_BRANCH_NUM
|
||||
unset CVS_NOBASES
|
||||
unset CVS_PASSFILE
|
||||
unset CVS_PASSWORD
|
||||
unset CVS_PROXY_PORT
|
||||
unset CVS_RCMD_PORT
|
||||
unset CVS_RSH
|
||||
unset CVS_SERVER
|
||||
unset CVS_SERVER_SLEEP
|
||||
CVS_SIGN_COMMITS=
|
||||
export CVS_SIGN_COMMITS
|
||||
unset CVS_SSH
|
||||
unset CVS_VERIFY_CHECKOUTS
|
||||
unset CVS_VERIFY_TEMPLATE
|
||||
unset CVSIGNORE
|
||||
unset CVSREAD
|
||||
unset CVSREADONLYFS
|
||||
unset CVSUMASK
|
||||
unset CVSWRAPPERS
|
||||
|
||||
# Need to pass -d "$CVSROOT", because there may be a CVS directory in the
|
||||
# current directory.
|
||||
cvs -d "$CVSROOT" init
|
||||
gzip -d -c < "$gettext_dir/archive.cvs.tar.gz" | (cd "$cvs_dir" && tar xf -)
|
||||
|
||||
cd "$work_dir"
|
||||
cvsver=gettext-`echo "$ver" | sed -e 's/\./_/g'`
|
||||
(cvs -d "$CVSROOT" checkout -r"$cvsver" archive > /dev/null) 2>&1 | grep -v '^cvs checkout: Updating'
|
||||
find archive -name CVS -type d -print | xargs rm -rf
|
||||
cd ..
|
||||
rm -rf "$cvs_dir"
|
||||
# Check that really all CVS directories are gone, otherwise we would overwrite
|
||||
# the contents of the user's CVS directories.
|
||||
if test `find $work_dir/archive -name CVS -type d -print | wc -l` != 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "failed to remove all CVS subdirectories"
|
||||
fi
|
||||
if test `find $work_dir/archive -type f -print | wc -l` = 0; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
fi
|
||||
;;
|
||||
|
||||
git)
|
||||
# Check availability of the git program.
|
||||
(git --version) >/dev/null 2>/dev/null || func_fatal_error "git program not found"
|
||||
mkdir "$work_dir/archive"
|
||||
gzip -d -c < "$gettext_dir/archive.git.tar.gz" | (cd "$work_dir/archive" && tar xf -)
|
||||
(cd "$work_dir/archive" && git checkout -q "gettext-$ver") || {
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "infrastructure files for version $ver not found; this is autopoint from GNU $package $version"
|
||||
}
|
||||
(cd "$work_dir/archive" && rm -rf .git .gitignore)
|
||||
;;
|
||||
esac
|
||||
|
||||
# func_destfile file
|
||||
# determines the destination file, relative to the package's top level
|
||||
# directory, for a given file name, relative to archive.
|
||||
# Sets variables
|
||||
# - destfile relative destination file name, or
|
||||
# empty if the file shall be omitted
|
||||
# - sharedowner yes if the file is not only owned by GNU gettext but may
|
||||
# be installed by automake or other tools, otherwise empty
|
||||
# - allpodirs yes if the file is to be installed in every dir in $podirs
|
||||
func_destfile ()
|
||||
{
|
||||
# There are five categories of files:
|
||||
# ABOUT_NLS -> top level directory
|
||||
# config.rpath mkinstalldirs -> $auxdir
|
||||
# m4/* -> $m4dir/
|
||||
# intl/* -> intl/
|
||||
# po/* ->
|
||||
sharedowner=
|
||||
allpodirs=
|
||||
case `echo "$1" | sed -e 's,[^/]*$,,'` in
|
||||
"" )
|
||||
case "$1" in
|
||||
config.rpath ) destfile="$auxdir$1" ;;
|
||||
mkinstalldirs ) destfile="$auxdir$1" sharedowner=yes ;;
|
||||
* ) destfile="$1" ;;
|
||||
esac
|
||||
;;
|
||||
m4/ ) destfile=`echo "$1" | sed -e "s,^m4/,$m4dir/,"` ;;
|
||||
intl/ ) if test -n "$omitintl"; then destfile=""; else destfile="$1"; fi ;;
|
||||
po/ ) destfile=`echo "$1" | sed -e "s,^po/,,"` allpodirs=yes ;;
|
||||
* ) destfile="$1" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# func_compare existingfile gettextfile
|
||||
# compares the existing file and the file from gettext, and decides whether the
|
||||
# existing file should be overwritten with the file from gettext. Returns 0 if
|
||||
# it should be overwritten, or 1 if it should be skipped.
|
||||
sed_extract_serial='s/^#.* serial \([^ ]*\).*/\1/p
|
||||
1q'
|
||||
func_compare ()
|
||||
{
|
||||
if cmp -s "$1" "$2"; then
|
||||
false
|
||||
else
|
||||
case "$2" in
|
||||
*.m4)
|
||||
# For interoperability with gnulib. gnulib often has newer versions of
|
||||
# the *.m4 files than the latest gettext release. Don't overwrite a
|
||||
# newer version from gnulib with an older version from the gettext
|
||||
# release. The version can be retrieved from the first line, which
|
||||
# looks like this: # file.m4 serial NN ...
|
||||
existing_serial=`sed -n -e "$sed_extract_serial" < "$1"`
|
||||
gettext_serial=`sed -n -e "$sed_extract_serial" < "$2"`
|
||||
if test -n "$existing_serial" && test -n "$gettext_serial" \
|
||||
&& test "$existing_serial" -ge "$gettext_serial" 2> /dev/null; then
|
||||
false
|
||||
else
|
||||
true
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
true
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
}
|
||||
|
||||
# If some files have been locally modified and we have not been requested
|
||||
# to overwrite them, then bail out. This is better than leaving a source
|
||||
# package around where half of the files are locally modified and half are
|
||||
# original - too great risk of version mismatch.
|
||||
if test -z "$force"; then
|
||||
mismatch=
|
||||
func_tmpdir
|
||||
mismatchfile="$tmp"/autopoint.diff
|
||||
for file in `find "$work_dir/archive" -type f -print | sed -e "s,^$work_dir/archive/,," | LC_ALL=C sort`; do
|
||||
func_destfile "$file"
|
||||
if test -n "$destfile"; then
|
||||
func_compare_to_destfile ()
|
||||
{
|
||||
finaldestfile="$1"
|
||||
if test -f "$finaldestfile"; then
|
||||
if func_compare "$finaldestfile" "$work_dir/archive/$file"; then
|
||||
if test -n "$sharedowner"; then
|
||||
echo "autopoint: warning: File $finaldestfile has been locally modified." 1>&2
|
||||
else
|
||||
echo "autopoint: File $finaldestfile has been locally modified." 1>&2
|
||||
mismatch=yes
|
||||
diff -c "$work_dir/archive/$file" "$finaldestfile" | sed -e "1s,$work_dir/archive/,," >> "$mismatchfile"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
}
|
||||
if test -n "$allpodirs"; then
|
||||
for dir in $podirs; do
|
||||
func_compare_to_destfile "$dir/$destfile"
|
||||
done
|
||||
else
|
||||
func_compare_to_destfile "$destfile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if test -n "$mismatch"; then
|
||||
rm -rf "$work_dir"
|
||||
func_fatal_error "Some files have been locally modified. Not overwriting them because --force has not been specified. For your convenience, you find the local modifications in the file '$mismatchfile'."
|
||||
fi
|
||||
rm -rf "$tmp"
|
||||
fi
|
||||
|
||||
# func_mkdir_for to
|
||||
# ensures the directory that would the given file exists.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_mkdir_for ()
|
||||
{
|
||||
base=`echo "$1" | sed -e 's,/[^/]*$,,'`
|
||||
if test "X$base" != "X$1" && test -n "$base"; then
|
||||
func_mkdir_for "$base"
|
||||
# Recompute base. It was clobbered by the recursive call.
|
||||
base=`echo "$1" | sed -e 's,/[^/]*$,,'`
|
||||
test -d "$base" || { echo "Creating directory $base"; mkdir "$base"; }
|
||||
fi
|
||||
}
|
||||
|
||||
# func_copy from to
|
||||
# copies a file.
|
||||
# 'from' is a relative pathname, relative to the current directory.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_copy ()
|
||||
{
|
||||
if $doit; then
|
||||
func_mkdir_for "$2"
|
||||
rm -f "$2"
|
||||
echo "Copying file $2"
|
||||
cp "$1" "$2"
|
||||
else
|
||||
echo "Copy file $2"
|
||||
fi
|
||||
}
|
||||
|
||||
# func_backup to
|
||||
# makes a backup of a file that is about to be overwritten or replaced.
|
||||
# 'to' is a relative pathname, relative to the current directory.
|
||||
func_backup ()
|
||||
{
|
||||
if $doit; then
|
||||
if test -f "$1"; then
|
||||
rm -f "$1~"
|
||||
cp -p "$1" "$1~"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# Now copy the files.
|
||||
for file in `find "$work_dir/archive" -type f -print | sed -e "s,^$work_dir/archive/,," | LC_ALL=C sort`; do
|
||||
func_destfile "$file"
|
||||
if test -n "$destfile"; then
|
||||
func_copy_to_destfile ()
|
||||
{
|
||||
finaldestfile="$1"
|
||||
mustcopy=
|
||||
if test -f "$finaldestfile"; then
|
||||
if func_compare "$finaldestfile" "$work_dir/archive/$file"; then
|
||||
if test -n "$force"; then
|
||||
# Overwrite locally modified file.
|
||||
mustcopy=yes
|
||||
fi
|
||||
# If --force is not specified, don't overwrite locally modified files
|
||||
# for which GNU gettext is a shared owner.
|
||||
fi
|
||||
else
|
||||
mustcopy=yes
|
||||
fi
|
||||
if test -n "$mustcopy"; then
|
||||
func_backup "$finaldestfile"
|
||||
func_copy "$work_dir/archive/$file" "$finaldestfile"
|
||||
fi
|
||||
}
|
||||
if test -n "$allpodirs"; then
|
||||
for dir in $podirs; do
|
||||
func_copy_to_destfile "$dir/$destfile"
|
||||
done
|
||||
else
|
||||
func_copy_to_destfile "$destfile"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# That's it.
|
||||
rm -rf "$work_dir"
|
||||
exit 0
|
||||
Binary file not shown.
Binary file not shown.
@@ -1,123 +0,0 @@
|
||||
#! /bin/sh
|
||||
#
|
||||
# Copyright (C) 2003, 2005-2007 Free Software Foundation, Inc.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU Library General Public License as published
|
||||
# by the Free Software Foundation; either version 2, 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 Library General Public
|
||||
# License along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
# USA.
|
||||
#
|
||||
|
||||
# Find a way to echo strings without interpreting backslash.
|
||||
if test "X`(echo '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo='echo'
|
||||
else
|
||||
if test "X`(printf '%s\n' '\t') 2>/dev/null`" = 'X\t'; then
|
||||
echo='printf %s\n'
|
||||
else
|
||||
echo_func () {
|
||||
cat <<EOT
|
||||
$*
|
||||
EOT
|
||||
}
|
||||
echo='echo_func'
|
||||
fi
|
||||
fi
|
||||
|
||||
# This script is primarily a shell function library. In order for
|
||||
# ". gettext.sh" to find it, we install it in $PREFIX/bin (that is usually
|
||||
# contained in $PATH), rather than in some other location such as
|
||||
# $PREFIX/share/sh-scripts or $PREFIX/share/gettext. In order to not violate
|
||||
# the Filesystem Hierarchy Standard when doing so, this script is executable.
|
||||
# Therefore it needs to support the standard --help and --version.
|
||||
if test -z "$ZSH_VERSION"; then
|
||||
# zsh is not POSIX compliant: By default, while ". gettext.sh" is executed,
|
||||
# it sets $0 to "gettext.sh", defeating the purpose of this test. But
|
||||
# fortunately we know that when running under zsh, this script is always
|
||||
# being sourced, not executed, because hardly anyone is crazy enough to
|
||||
# install zsh as /bin/sh.
|
||||
case "$0" in
|
||||
gettext.sh | */gettext.sh | *\\gettext.sh)
|
||||
progname=$0
|
||||
package=gettext-runtime
|
||||
version=0.18.1
|
||||
# func_usage
|
||||
# outputs to stdout the --help usage message.
|
||||
func_usage ()
|
||||
{
|
||||
echo "GNU gettext shell script function library version $version"
|
||||
echo "Usage: . gettext.sh"
|
||||
}
|
||||
# func_version
|
||||
# outputs to stdout the --version message.
|
||||
func_version ()
|
||||
{
|
||||
echo "$progname (GNU $package) $version"
|
||||
echo "Copyright (C) 2003-2007 Free Software Foundation, Inc.
|
||||
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl.html>
|
||||
This is free software: you are free to change and redistribute it.
|
||||
There is NO WARRANTY, to the extent permitted by law."
|
||||
echo "Written by" "Bruno Haible"
|
||||
}
|
||||
if test $# = 1; then
|
||||
case "$1" in
|
||||
--help | --hel | --he | --h )
|
||||
func_usage; exit 0 ;;
|
||||
--version | --versio | --versi | --vers | --ver | --ve | --v )
|
||||
func_version; exit 0 ;;
|
||||
esac
|
||||
fi
|
||||
func_usage 1>&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# eval_gettext MSGID
|
||||
# looks up the translation of MSGID and substitutes shell variables in the
|
||||
# result.
|
||||
eval_gettext () {
|
||||
gettext "$1" | (export PATH `envsubst --variables "$1"`; envsubst "$1")
|
||||
}
|
||||
|
||||
# eval_ngettext MSGID MSGID-PLURAL COUNT
|
||||
# looks up the translation of MSGID / MSGID-PLURAL for COUNT and substitutes
|
||||
# shell variables in the result.
|
||||
eval_ngettext () {
|
||||
ngettext "$1" "$2" "$3" | (export PATH `envsubst --variables "$1 $2"`; envsubst "$1 $2")
|
||||
}
|
||||
|
||||
# Note: This use of envsubst is much safer than using the shell built-in 'eval'
|
||||
# would be.
|
||||
# 1) The security problem with Chinese translations that happen to use a
|
||||
# character such as \xe0\x60 is avoided.
|
||||
# 2) The security problem with malevolent translators who put in command lists
|
||||
# like "$(...)" or "`...`" is avoided.
|
||||
# 3) The translations can only refer to shell variables that are already
|
||||
# mentioned in MSGID or MSGID-PLURAL.
|
||||
#
|
||||
# Note: "export PATH" above is a dummy; this is for the case when
|
||||
# `envsubst --variables ...` returns nothing.
|
||||
#
|
||||
# Note: In eval_ngettext above, "$1 $2" means a string whose variables set is
|
||||
# the union of the variables set of "$1" and "$2".
|
||||
#
|
||||
# Note: The minimal use of backquote above ensures that trailing newlines are
|
||||
# not dropped, not from the gettext invocation and not from the value of any
|
||||
# shell variable.
|
||||
#
|
||||
# Note: Field splitting on the `envsubst --variables ...` result is desired,
|
||||
# since envsubst outputs the variables, separated by newlines. Pathname
|
||||
# wildcard expansion or tilde expansion has no effect here, since the words
|
||||
# output by "envsubst --variables ..." consist solely of alphanumeric
|
||||
# characters and underscore.
|
||||
File diff suppressed because it is too large.
Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,177 +0,0 @@
|
||||
--- gettext-runtime/intl/printf.c
|
||||
+++ gettext-runtime/intl/printf.c
|
||||
@@ -69,7 +69,7 @@
|
||||
#define STATIC static
|
||||
|
||||
/* This needs to be consistent with libgnuintl.h.in. */
|
||||
-#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
|
||||
+#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__
|
||||
/* Don't break __attribute__((format(printf,M,N))).
|
||||
This redefinition is only possible because the libc in NetBSD, Cygwin,
|
||||
mingw does not have a function __printf__. */
|
||||
--- gettext-runtime/intl/libgnuintl.h.in
|
||||
+++ gettext-runtime/intl/libgnuintl.h.in
|
||||
@@ -330,7 +330,7 @@
|
||||
|
||||
#if !(defined printf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef printf
|
||||
-#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
|
||||
+#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__
|
||||
/* Don't break __attribute__((format(printf,M,N))).
|
||||
This redefinition is only possible because the libc in NetBSD, Cygwin,
|
||||
mingw does not have a function __printf__.
|
||||
---- gettext-tools/gnulib-lib/clean-temp.c
|
||||
+++ gettext-tools/gnulib-lib/clean-temp.c
|
||||
@@ -66,9 +66,11 @@
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+#ifndef _WIN64
|
||||
#ifndef uintptr_t
|
||||
# define uintptr_t unsigned long
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
#if !GNULIB_FCNTL_SAFER
|
||||
/* The results of open() in this file are not used with fchdir,
|
||||
--- gettext-tools/gnulib-lib/fstrcmp.c
|
||||
+++ gettext-tools/gnulib-lib/fstrcmp.c
|
||||
@@ -55,9 +55,11 @@
|
||||
#include "minmax.h"
|
||||
#include "xalloc.h"
|
||||
|
||||
+#ifndef _WIN64
|
||||
#ifndef uintptr_t
|
||||
# define uintptr_t unsigned long
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
|
||||
#define ELEMENT char
|
||||
--- gettext-tools/gnulib-lib/gl_array_list.c
|
||||
+++ gettext-tools/gnulib-lib/gl_array_list.c
|
||||
@@ -55,9 +55,11 @@
|
||||
/* Checked size_t computations. */
|
||||
#include "xsize.h"
|
||||
|
||||
+#ifndef _WIN64
|
||||
#ifndef uintptr_t
|
||||
# define uintptr_t unsigned long
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
/* -------------------------- gl_list_t Data Type -------------------------- */
|
||||
|
||||
--- gettext-tools/gnulib-lib/gl_linkedhash_list.c
|
||||
+++ gettext-tools/gnulib-lib/gl_linkedhash_list.c
|
||||
@@ -55,9 +55,11 @@
|
||||
|
||||
#include "xsize.h"
|
||||
|
||||
+#ifndef _WIN64
|
||||
#ifndef uintptr_t
|
||||
# define uintptr_t unsigned long
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
#define WITH_HASHTABLE 1
|
||||
|
||||
--- gettext-tools/gnulib-lib/stdio.in.h
|
||||
+++ gettext-tools/gnulib-lib/stdio.in.h
|
||||
@@ -642,10 +642,6 @@
|
||||
# if (@GNULIB_PRINTF_POSIX@ && @REPLACE_PRINTF@) \
|
||||
|| (@GNULIB_PRINTF@ && @REPLACE_STDIO_WRITE_FUNCS@ && @GNULIB_STDIO_H_SIGPIPE@)
|
||||
# if defined __GNUC__
|
||||
-# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
-/* Don't break __attribute__((format(printf,M,N))). */
|
||||
-# define printf __printf__
|
||||
-# endif
|
||||
_GL_FUNCDECL_RPL_1 (__printf__, int,
|
||||
(const char *format, ...)
|
||||
__asm__ (@ASM_SYMBOL_PREFIX@
|
||||
--- gettext-tools/gnulib-lib/tempname.c
|
||||
+++ gettext-tools/gnulib-lib/tempname.c
|
||||
@@ -54,6 +54,10 @@
|
||||
#include <stdint.h>
|
||||
#include <unistd.h>
|
||||
|
||||
+#ifdef _WIN32
|
||||
+# include <direct.h>
|
||||
+#endif
|
||||
+
|
||||
#include <sys/stat.h>
|
||||
|
||||
#if _LIBC
|
||||
@@ -73,6 +73,10 @@
|
||||
# define __xstat64(version, file, buf) stat (file, buf)
|
||||
#endif
|
||||
|
||||
+#ifdef _WIN32
|
||||
+# define mkdir(path,mode) _mkdir(path)
|
||||
+#endif
|
||||
+
|
||||
#if ! (HAVE___SECURE_GETENV || _LIBC)
|
||||
# define __secure_getenv getenv
|
||||
#endif
|
||||
--- gettext-tools/src/write-java.c
|
||||
+++ gettext-tools/src/write-java.c
|
||||
@@ -30,6 +30,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
+#ifdef _WIN32
|
||||
+# include <direct.h>
|
||||
+#endif
|
||||
+
|
||||
#include <sys/stat.h>
|
||||
#if !defined S_ISDIR && defined S_IFDIR
|
||||
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
@@ -53,6 +53,10 @@
|
||||
# define S_IXUSR 00100
|
||||
#endif
|
||||
|
||||
+#ifdef _WIN32
|
||||
+# define mkdir(path,mode) _mkdir(path)
|
||||
+#endif
|
||||
+
|
||||
#include "c-ctype.h"
|
||||
#include "error.h"
|
||||
#include "xerror.h"
|
||||
--- gettext-tools/src/write-csharp.c
|
||||
+++ gettext-tools/src/write-csharp.c
|
||||
@@ -29,6 +29,10 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
+#ifdef _WIN32
|
||||
+# include <direct.h>
|
||||
+#endif
|
||||
+
|
||||
#include <sys/stat.h>
|
||||
#if !defined S_ISDIR && defined S_IFDIR
|
||||
# define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
|
||||
@@ -70,6 +70,10 @@
|
||||
# define S_IXOTH (S_IXUSR >> 6)
|
||||
#endif
|
||||
|
||||
+#ifdef _WIN32
|
||||
+# define mkdir(path,mode) _mkdir(path)
|
||||
+#endif
|
||||
+
|
||||
#include "c-ctype.h"
|
||||
#include "relocatable.h"
|
||||
#include "error.h"
|
||||
--- gettext-tools/woe32dll/export.h
|
||||
+++ gettext-tools/woe32dll/export.h
|
||||
@@ -90,7 +90,11 @@
|
||||
--export-all-symbols is used. */
|
||||
|
||||
/* IMP(x) is a symbol that contains the address of x. */
|
||||
+#ifdef _WIN64
|
||||
+#define IMP(x) __imp_##x
|
||||
+#else
|
||||
#define IMP(x) _imp__##x
|
||||
+#endif
|
||||
|
||||
/* Ensure that the variable x is exported from the library, and that a
|
||||
pseudo-variable IMP(x) is available. */
|
||||
@@ -1,66 +0,0 @@
|
||||
/* Class autosprintf - formatted output to an ostream.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _AUTOSPRINTF_H
|
||||
#define _AUTOSPRINTF_H
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace gnu
|
||||
{
|
||||
/* A temporary object, usually allocated on the stack, representing
|
||||
the result of an asprintf() call. */
|
||||
class autosprintf
|
||||
{
|
||||
public:
|
||||
/* Constructor: takes a format string and the printf arguments. */
|
||||
autosprintf (const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
/* Copy constructor. */
|
||||
autosprintf (const autosprintf& src);
|
||||
/* Destructor: frees the temporarily allocated string. */
|
||||
~autosprintf ();
|
||||
/* Conversion to string. */
|
||||
operator char * () const;
|
||||
operator std::string () const;
|
||||
/* Output to an ostream. */
|
||||
friend inline std::ostream& operator<< (std::ostream& stream, const autosprintf& tmp)
|
||||
{
|
||||
stream << (tmp.str ? tmp.str : "(error in autosprintf)");
|
||||
return stream;
|
||||
}
|
||||
private:
|
||||
char *str;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _AUTOSPRINTF_H */
|
||||
@@ -1,357 +0,0 @@
|
||||
/* Public API for GNU gettext PO files - contained in libgettextpo.
|
||||
Copyright (C) 2003-2008, 2010 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
|
||||
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/>. */
|
||||
|
||||
#ifndef _GETTEXT_PO_H
|
||||
#define _GETTEXT_PO_H 1
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* =========================== Meta Information ============================ */
|
||||
|
||||
/* Version number: (major<<16) + (minor<<8) + subminor */
|
||||
#define LIBGETTEXTPO_VERSION 0x001201
|
||||
extern __declspec (dllimport) int libgettextpo_version;
|
||||
|
||||
/* ================================= Types ================================= */
|
||||
|
||||
/* A po_file_t represents the contents of a PO file. */
|
||||
typedef struct po_file *po_file_t;
|
||||
|
||||
/* A po_message_iterator_t represents an iterator through a domain of a
|
||||
PO file. */
|
||||
typedef struct po_message_iterator *po_message_iterator_t;
|
||||
|
||||
/* A po_message_t represents a message in a PO file. */
|
||||
typedef struct po_message *po_message_t;
|
||||
|
||||
/* A po_filepos_t represents a string's position within a source file. */
|
||||
typedef struct po_filepos *po_filepos_t;
|
||||
|
||||
/* A po_error_handler handles error situations. */
|
||||
struct po_error_handler
|
||||
{
|
||||
/* Signal an error. The error message is built from FORMAT and the following
|
||||
arguments. ERRNUM, if nonzero, is an errno value.
|
||||
Must increment the error_message_count variable declared in error.h.
|
||||
Must not return if STATUS is nonzero. */
|
||||
void (*error) (int status, int errnum,
|
||||
const char *format, ...)
|
||||
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)))
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Signal an error. The error message is built from FORMAT and the following
|
||||
arguments. The error location is at FILENAME line LINENO. ERRNUM, if
|
||||
nonzero, is an errno value.
|
||||
Must increment the error_message_count variable declared in error.h.
|
||||
Must not return if STATUS is nonzero. */
|
||||
void (*error_at_line) (int status, int errnum,
|
||||
const char *filename, unsigned int lineno,
|
||||
const char *format, ...)
|
||||
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__
|
||||
__attribute__ ((__format__ (__printf__, 5, 6)))
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Signal a multiline warning. The PREFIX applies to all lines of the
|
||||
MESSAGE. Free the PREFIX and MESSAGE when done. */
|
||||
void (*multiline_warning) (char *prefix, char *message);
|
||||
|
||||
/* Signal a multiline error. The PREFIX applies to all lines of the
|
||||
MESSAGE. Free the PREFIX and MESSAGE when done.
|
||||
Must increment the error_message_count variable declared in error.h if
|
||||
PREFIX is non-NULL. */
|
||||
void (*multiline_error) (char *prefix, char *message);
|
||||
};
|
||||
typedef const struct po_error_handler *po_error_handler_t;
|
||||
|
||||
/* A po_xerror_handler handles warnings, error and fatal error situations. */
|
||||
#define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */
|
||||
#define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */
|
||||
#define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */
|
||||
struct po_xerror_handler
|
||||
{
|
||||
/* Signal a problem of the given severity.
|
||||
MESSAGE and/or FILENAME + LINENO indicate where the problem occurred.
|
||||
If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored.
|
||||
If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored.
|
||||
If COLUMN is (size_t)(-1), it should be ignored.
|
||||
MESSAGE_TEXT is the problem description (if MULTILINE_P is true,
|
||||
multiple lines of text, each terminated with a newline, otherwise
|
||||
usually a single line).
|
||||
Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */
|
||||
void (*xerror) (int severity,
|
||||
po_message_t message,
|
||||
const char *filename, size_t lineno, size_t column,
|
||||
int multiline_p, const char *message_text);
|
||||
/* Signal a problem that refers to two messages.
|
||||
Similar to two calls to xerror.
|
||||
If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to
|
||||
MESSAGE_TEXT2. */
|
||||
void (*xerror2) (int severity,
|
||||
po_message_t message1,
|
||||
const char *filename1, size_t lineno1, size_t column1,
|
||||
int multiline_p1, const char *message_text1,
|
||||
po_message_t message2,
|
||||
const char *filename2, size_t lineno2, size_t column2,
|
||||
int multiline_p2, const char *message_text2);
|
||||
};
|
||||
typedef const struct po_xerror_handler *po_xerror_handler_t;
|
||||
|
||||
/* Memory allocation:
|
||||
The memory allocations performed by these functions use xmalloc(),
|
||||
therefore will cause a program exit if memory is exhausted.
|
||||
The memory allocated by po_file_read, and implicitly returned through
|
||||
the po_message_* functions, lasts until freed with po_file_free. */
|
||||
|
||||
|
||||
/* ============================= po_file_t API ============================= */
|
||||
|
||||
/* Create an empty PO file representation in memory. */
|
||||
extern po_file_t po_file_create (void);
|
||||
|
||||
/* Read a PO file into memory.
|
||||
Return its contents. Upon failure, return NULL and set errno. */
|
||||
#define po_file_read po_file_read_v3
|
||||
extern po_file_t po_file_read (const char *filename,
|
||||
po_xerror_handler_t handler);
|
||||
|
||||
/* Write an in-memory PO file to a file.
|
||||
Upon failure, return NULL and set errno. */
|
||||
#define po_file_write po_file_write_v2
|
||||
extern po_file_t po_file_write (po_file_t file, const char *filename,
|
||||
po_xerror_handler_t handler);
|
||||
|
||||
/* Free a PO file from memory. */
|
||||
extern void po_file_free (po_file_t file);
|
||||
|
||||
/* Return the names of the domains covered by a PO file in memory. */
|
||||
extern const char * const * po_file_domains (po_file_t file);
|
||||
|
||||
|
||||
/* =========================== Header entry API ============================ */
|
||||
|
||||
/* Return the header entry of a domain of a PO file in memory.
|
||||
The domain NULL denotes the default domain.
|
||||
Return NULL if there is no header entry. */
|
||||
extern const char * po_file_domain_header (po_file_t file, const char *domain);
|
||||
|
||||
/* Return the value of a field in a header entry.
|
||||
The return value is either a freshly allocated string, to be freed by the
|
||||
caller, or NULL. */
|
||||
extern char * po_header_field (const char *header, const char *field);
|
||||
|
||||
/* Return the header entry with a given field set to a given value. The field
|
||||
is added if necessary.
|
||||
The return value is a freshly allocated string. */
|
||||
extern char * po_header_set_field (const char *header, const char *field, const char *value);
|
||||
|
||||
|
||||
/* ======================= po_message_iterator_t API ======================= */
|
||||
|
||||
/* Create an iterator for traversing a domain of a PO file in memory.
|
||||
The domain NULL denotes the default domain. */
|
||||
extern po_message_iterator_t po_message_iterator (po_file_t file, const char *domain);
|
||||
|
||||
/* Free an iterator. */
|
||||
extern void po_message_iterator_free (po_message_iterator_t iterator);
|
||||
|
||||
/* Return the next message, and advance the iterator.
|
||||
Return NULL at the end of the message list. */
|
||||
extern po_message_t po_next_message (po_message_iterator_t iterator);
|
||||
|
||||
/* Insert a message in a PO file in memory, in the domain and at the position
|
||||
indicated by the iterator. The iterator thereby advances past the freshly
|
||||
inserted message. */
|
||||
extern void po_message_insert (po_message_iterator_t iterator, po_message_t message);
|
||||
|
||||
|
||||
/* =========================== po_message_t API ============================ */
|
||||
|
||||
/* Return a freshly constructed message.
|
||||
To finish initializing the message, you must set the msgid and msgstr. */
|
||||
extern po_message_t po_message_create (void);
|
||||
|
||||
/* Return the context of a message, or NULL for a message not restricted to a
|
||||
context. */
|
||||
extern const char * po_message_msgctxt (po_message_t message);
|
||||
|
||||
/* Change the context of a message. NULL means a message not restricted to a
|
||||
context. */
|
||||
extern void po_message_set_msgctxt (po_message_t message, const char *msgctxt);
|
||||
|
||||
/* Return the msgid (untranslated English string) of a message. */
|
||||
extern const char * po_message_msgid (po_message_t message);
|
||||
|
||||
/* Change the msgid (untranslated English string) of a message. */
|
||||
extern void po_message_set_msgid (po_message_t message, const char *msgid);
|
||||
|
||||
/* Return the msgid_plural (untranslated English plural string) of a message,
|
||||
or NULL for a message without plural. */
|
||||
extern const char * po_message_msgid_plural (po_message_t message);
|
||||
|
||||
/* Change the msgid_plural (untranslated English plural string) of a message.
|
||||
NULL means a message without plural. */
|
||||
extern void po_message_set_msgid_plural (po_message_t message, const char *msgid_plural);
|
||||
|
||||
/* Return the msgstr (translation) of a message.
|
||||
Return the empty string for an untranslated message. */
|
||||
extern const char * po_message_msgstr (po_message_t message);
|
||||
|
||||
/* Change the msgstr (translation) of a message.
|
||||
Use an empty string to denote an untranslated message. */
|
||||
extern void po_message_set_msgstr (po_message_t message, const char *msgstr);
|
||||
|
||||
/* Return the msgstr[index] for a message with plural handling, or
|
||||
NULL when the index is out of range or for a message without plural. */
|
||||
extern const char * po_message_msgstr_plural (po_message_t message, int index);
|
||||
|
||||
/* Change the msgstr[index] for a message with plural handling.
|
||||
Use a NULL value at the end to reduce the number of plural forms. */
|
||||
extern void po_message_set_msgstr_plural (po_message_t message, int index, const char *msgstr);
|
||||
|
||||
/* Return the comments for a message. */
|
||||
extern const char * po_message_comments (po_message_t message);
|
||||
|
||||
/* Change the comments for a message.
|
||||
comments should be a multiline string, ending in a newline, or empty. */
|
||||
extern void po_message_set_comments (po_message_t message, const char *comments);
|
||||
|
||||
/* Return the extracted comments for a message. */
|
||||
extern const char * po_message_extracted_comments (po_message_t message);
|
||||
|
||||
/* Change the extracted comments for a message.
|
||||
comments should be a multiline string, ending in a newline, or empty. */
|
||||
extern void po_message_set_extracted_comments (po_message_t message, const char *comments);
|
||||
|
||||
/* Return the i-th file position for a message, or NULL if i is out of
|
||||
range. */
|
||||
extern po_filepos_t po_message_filepos (po_message_t message, int i);
|
||||
|
||||
/* Remove the i-th file position from a message.
|
||||
The indices of all following file positions for the message are decremented
|
||||
by one. */
|
||||
extern void po_message_remove_filepos (po_message_t message, int i);
|
||||
|
||||
/* Add a file position to a message, if it is not already present for the
|
||||
message.
|
||||
file is the file name.
|
||||
start_line is the line number where the string starts, or (size_t)(-1) if no
|
||||
line number is available. */
|
||||
extern void po_message_add_filepos (po_message_t message, const char *file, size_t start_line);
|
||||
|
||||
/* Return the previous context of a message, or NULL for none. */
|
||||
extern const char * po_message_prev_msgctxt (po_message_t message);
|
||||
|
||||
/* Change the previous context of a message. NULL is allowed. */
|
||||
extern void po_message_set_prev_msgctxt (po_message_t message, const char *prev_msgctxt);
|
||||
|
||||
/* Return the previous msgid (untranslated English string) of a message, or
|
||||
NULL for none. */
|
||||
extern const char * po_message_prev_msgid (po_message_t message);
|
||||
|
||||
/* Change the previous msgid (untranslated English string) of a message.
|
||||
NULL is allowed. */
|
||||
extern void po_message_set_prev_msgid (po_message_t message, const char *prev_msgid);
|
||||
|
||||
/* Return the previous msgid_plural (untranslated English plural string) of a
|
||||
message, or NULL for none. */
|
||||
extern const char * po_message_prev_msgid_plural (po_message_t message);
|
||||
|
||||
/* Change the previous msgid_plural (untranslated English plural string) of a
|
||||
message. NULL is allowed. */
|
||||
extern void po_message_set_prev_msgid_plural (po_message_t message, const char *prev_msgid_plural);
|
||||
|
||||
/* Return true if the message is marked obsolete. */
|
||||
extern int po_message_is_obsolete (po_message_t message);
|
||||
|
||||
/* Change the obsolete mark of a message. */
|
||||
extern void po_message_set_obsolete (po_message_t message, int obsolete);
|
||||
|
||||
/* Return true if the message is marked fuzzy. */
|
||||
extern int po_message_is_fuzzy (po_message_t message);
|
||||
|
||||
/* Change the fuzzy mark of a message. */
|
||||
extern void po_message_set_fuzzy (po_message_t message, int fuzzy);
|
||||
|
||||
/* Return true if the message is marked as being a format string of the given
|
||||
type (e.g. "c-format"). */
|
||||
extern int po_message_is_format (po_message_t message, const char *format_type);
|
||||
|
||||
/* Change the format string mark for a given type of a message. */
|
||||
extern void po_message_set_format (po_message_t message, const char *format_type, /*bool*/int value);
|
||||
|
||||
/* If a numeric range of a message is set, return true and store the minimum
|
||||
and maximum value in *MINP and *MAXP. */
|
||||
extern int po_message_is_range (po_message_t message, int *minp, int *maxp);
|
||||
|
||||
/* Change the numeric range of a message. MIN and MAX must be non-negative,
|
||||
with MIN < MAX. Use MIN = MAX = -1 to remove the numeric range of a
|
||||
message. */
|
||||
extern void po_message_set_range (po_message_t message, int min, int max);
|
||||
|
||||
|
||||
/* =========================== po_filepos_t API ============================ */
|
||||
|
||||
/* Return the file name. */
|
||||
extern const char * po_filepos_file (po_filepos_t filepos);
|
||||
|
||||
/* Return the line number where the string starts, or (size_t)(-1) if no line
|
||||
number is available. */
|
||||
extern size_t po_filepos_start_line (po_filepos_t filepos);
|
||||
|
||||
|
||||
/* ============================ Format type API ============================= */
|
||||
|
||||
/* Return a NULL terminated array of the supported format types. */
|
||||
extern const char * const * po_format_list (void);
|
||||
|
||||
/* Return the pretty name associated with a format type.
|
||||
For example, for "csharp-format", return "C#".
|
||||
Return NULL if the argument is not a supported format type. */
|
||||
extern const char * po_format_pretty_name (const char *format_type);
|
||||
|
||||
|
||||
/* ============================= Checking API ============================== */
|
||||
|
||||
/* Test whether an entire file PO file is valid, like msgfmt does it.
|
||||
If it is invalid, pass the reasons to the handler. */
|
||||
extern void po_file_check_all (po_file_t file, po_xerror_handler_t handler);
|
||||
|
||||
/* Test a single message, to be inserted in a PO file in memory, like msgfmt
|
||||
does it. If it is invalid, pass the reasons to the handler. The iterator
|
||||
is not modified by this call; it only specifies the file and the domain. */
|
||||
extern void po_message_check_all (po_message_t message, po_message_iterator_t iterator, po_xerror_handler_t handler);
|
||||
|
||||
/* Test whether the message translation is a valid format string if the message
|
||||
is marked as being a format string. If it is invalid, pass the reasons to
|
||||
the handler. */
|
||||
#define po_message_check_format po_message_check_format_v2
|
||||
extern void po_message_check_format (po_message_t message, po_xerror_handler_t handler);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GETTEXT_PO_H */
|
||||
@@ -1,464 +0,0 @@
|
||||
/* Message catalogs for internationalization.
|
||||
Copyright (C) 1995-1997, 2000-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H 1
|
||||
|
||||
#include <locale.h>
|
||||
#if (defined __APPLE__ && defined __MACH__) && 0
|
||||
# include <xlocale.h>
|
||||
#endif
|
||||
|
||||
/* The LC_MESSAGES locale category is the category used by the functions
|
||||
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
|
||||
On systems that don't define it, use an arbitrary value instead.
|
||||
On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
|
||||
then includes <libintl.h> (i.e. this file!) and then only defines
|
||||
LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
|
||||
in this case. */
|
||||
#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
|
||||
# define LC_MESSAGES 1729
|
||||
#endif
|
||||
|
||||
/* We define an additional symbol to signal that we use the GNU
|
||||
implementation of gettext. */
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
|
||||
/* Provide information about the supported file formats. Returns the
|
||||
maximum minor revision number supported for a given major revision. */
|
||||
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
|
||||
((major) == 0 || (major) == 1 ? 1 : -1)
|
||||
|
||||
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
|
||||
precedence over _conio_gettext. */
|
||||
#ifdef __DJGPP__
|
||||
# undef gettext
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number: (major<<16) + (minor<<8) + subminor */
|
||||
#define LIBINTL_VERSION 0x001201
|
||||
extern int libintl_version;
|
||||
|
||||
|
||||
/* We redirect the functions to those prefixed with "libintl_". This is
|
||||
necessary, because some systems define gettext/textdomain/... in the C
|
||||
library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
|
||||
If we used the unprefixed names, there would be cases where the
|
||||
definition in the C library would override the one in the libintl.so
|
||||
shared library. Recall that on ELF systems, the symbols are looked
|
||||
up in the following order:
|
||||
1. in the executable,
|
||||
2. in the shared libraries specified on the link command line, in order,
|
||||
3. in the dependencies of the shared libraries specified on the link
|
||||
command line,
|
||||
4. in the dlopen()ed shared libraries, in the order in which they were
|
||||
dlopen()ed.
|
||||
The definition in the C library would override the one in libintl.so if
|
||||
either
|
||||
* -lc is given on the link command line and -lintl isn't, or
|
||||
* -lc is given on the link command line before -lintl, or
|
||||
* libintl.so is a dependency of a dlopen()ed shared library but not
|
||||
linked to the executable at link time.
|
||||
Since Solaris gettext() behaves differently than GNU gettext(), this
|
||||
would be unacceptable.
|
||||
|
||||
The redirection happens by default through macros in C, so that &gettext
|
||||
is independent of the compilation unit, but through inline functions in
|
||||
C++, in order not to interfere with the name mangling of class fields or
|
||||
class methods called 'gettext'. */
|
||||
|
||||
/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
|
||||
If he doesn't, we choose the method. A third possible method is
|
||||
_INTL_REDIRECT_ASM, supported only by GCC. */
|
||||
#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
|
||||
# if defined __GNUC__ && __GNUC__ >= 2 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
|
||||
# define _INTL_REDIRECT_ASM
|
||||
# else
|
||||
# ifdef __cplusplus
|
||||
# define _INTL_REDIRECT_INLINE
|
||||
# else
|
||||
# define _INTL_REDIRECT_MACROS
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* Auxiliary macros. */
|
||||
#ifdef _INTL_REDIRECT_ASM
|
||||
# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
|
||||
# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
|
||||
# define _INTL_STRINGIFY(prefix) #prefix
|
||||
#else
|
||||
# define _INTL_ASM(cname)
|
||||
#endif
|
||||
|
||||
/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
|
||||
its n-th argument literally. This enables GCC to warn for example about
|
||||
printf (gettext ("foo %y")). */
|
||||
#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && defined __cplusplus)
|
||||
# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
|
||||
#else
|
||||
# define _INTL_MAY_RETURN_STRING_ARG(n)
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_gettext (const char *__msgid)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1);
|
||||
static inline char *gettext (const char *__msgid)
|
||||
{
|
||||
return libintl_gettext (__msgid);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define gettext libintl_gettext
|
||||
#endif
|
||||
extern char *gettext (const char *__msgid)
|
||||
_INTL_ASM (libintl_gettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1);
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dgettext (const char *__domainname, const char *__msgid)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *dgettext (const char *__domainname, const char *__msgid)
|
||||
{
|
||||
return libintl_dgettext (__domainname, __msgid);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dgettext libintl_dgettext
|
||||
#endif
|
||||
extern char *dgettext (const char *__domainname, const char *__msgid)
|
||||
_INTL_ASM (libintl_dgettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
{
|
||||
return libintl_dcgettext (__domainname, __msgid, __category);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dcgettext libintl_dcgettext
|
||||
#endif
|
||||
extern char *dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
_INTL_ASM (libintl_dcgettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
|
||||
/* Similar to `gettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
{
|
||||
return libintl_ngettext (__msgid1, __msgid2, __n);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define ngettext libintl_ngettext
|
||||
#endif
|
||||
extern char *ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_ASM (libintl_ngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
/* Similar to `dgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
static inline char *dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n)
|
||||
{
|
||||
return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dngettext libintl_dngettext
|
||||
#endif
|
||||
extern char *dngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_ASM (libintl_dngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
#endif
|
||||
|
||||
/* Similar to `dcgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
static inline char *dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
{
|
||||
return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dcngettext libintl_dcngettext
|
||||
#endif
|
||||
extern char *dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
_INTL_ASM (libintl_dcngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_textdomain (const char *__domainname);
|
||||
static inline char *textdomain (const char *__domainname)
|
||||
{
|
||||
return libintl_textdomain (__domainname);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define textdomain libintl_textdomain
|
||||
#endif
|
||||
extern char *textdomain (const char *__domainname)
|
||||
_INTL_ASM (libintl_textdomain);
|
||||
#endif
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_bindtextdomain (const char *__domainname,
|
||||
const char *__dirname);
|
||||
static inline char *bindtextdomain (const char *__domainname,
|
||||
const char *__dirname)
|
||||
{
|
||||
return libintl_bindtextdomain (__domainname, __dirname);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define bindtextdomain libintl_bindtextdomain
|
||||
#endif
|
||||
extern char *bindtextdomain (const char *__domainname, const char *__dirname)
|
||||
_INTL_ASM (libintl_bindtextdomain);
|
||||
#endif
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset);
|
||||
static inline char *bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset)
|
||||
{
|
||||
return libintl_bind_textdomain_codeset (__domainname, __codeset);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define bind_textdomain_codeset libintl_bind_textdomain_codeset
|
||||
#endif
|
||||
extern char *bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset)
|
||||
_INTL_ASM (libintl_bind_textdomain_codeset);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Support for format strings with positions in *printf(), following the
|
||||
POSIX/XSI specification.
|
||||
Note: These replacements for the *printf() functions are visible only
|
||||
in source files that #include <libintl.h> or #include "gettext.h".
|
||||
Packages that use *printf() in source files that don't refer to _()
|
||||
or gettext() but for which the format string could be the return value
|
||||
of _() or gettext() need to add this #include. Oh well. */
|
||||
|
||||
#if !0
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Get va_list. */
|
||||
#if (defined __STDC__ && __STDC__) || defined __cplusplus || defined _MSC_VER
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
|
||||
#if !(defined fprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef fprintf
|
||||
#define fprintf libintl_fprintf
|
||||
extern int fprintf (FILE *, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vfprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vfprintf
|
||||
#define vfprintf libintl_vfprintf
|
||||
extern int vfprintf (FILE *, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if !(defined printf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef printf
|
||||
#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
|
||||
/* Don't break __attribute__((format(printf,M,N))).
|
||||
This redefinition is only possible because the libc in NetBSD, Cygwin,
|
||||
mingw does not have a function __printf__.
|
||||
Alternatively, we could have done this redirection only when compiling with
|
||||
__GNUC__, together with a symbol redirection:
|
||||
extern int printf (const char *, ...)
|
||||
__asm__ (#__USER_LABEL_PREFIX__ "libintl_printf");
|
||||
But doing it now would introduce a binary incompatibility with already
|
||||
distributed versions of libintl on these systems. */
|
||||
# define libintl_printf __printf__
|
||||
#endif
|
||||
#define printf libintl_printf
|
||||
extern int printf (const char *, ...);
|
||||
#endif
|
||||
#if !(defined vprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vprintf
|
||||
#define vprintf libintl_vprintf
|
||||
extern int vprintf (const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if !(defined sprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef sprintf
|
||||
#define sprintf libintl_sprintf
|
||||
extern int sprintf (char *, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vsprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vsprintf
|
||||
#define vsprintf libintl_vsprintf
|
||||
extern int vsprintf (char *, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
|
||||
#if !(defined snprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef snprintf
|
||||
#define snprintf libintl_snprintf
|
||||
extern int snprintf (char *, size_t, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vsnprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vsnprintf
|
||||
#define vsnprintf libintl_vsnprintf
|
||||
extern int vsnprintf (char *, size_t, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
#if !(defined asprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef asprintf
|
||||
#define asprintf libintl_asprintf
|
||||
extern int asprintf (char **, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vasprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vasprintf
|
||||
#define vasprintf libintl_vasprintf
|
||||
extern int vasprintf (char **, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
#undef fwprintf
|
||||
#define fwprintf libintl_fwprintf
|
||||
extern int fwprintf (FILE *, const wchar_t *, ...);
|
||||
#undef vfwprintf
|
||||
#define vfwprintf libintl_vfwprintf
|
||||
extern int vfwprintf (FILE *, const wchar_t *, va_list);
|
||||
|
||||
#undef wprintf
|
||||
#define wprintf libintl_wprintf
|
||||
extern int wprintf (const wchar_t *, ...);
|
||||
#undef vwprintf
|
||||
#define vwprintf libintl_vwprintf
|
||||
extern int vwprintf (const wchar_t *, va_list);
|
||||
|
||||
#undef swprintf
|
||||
#define swprintf libintl_swprintf
|
||||
extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
|
||||
#undef vswprintf
|
||||
#define vswprintf libintl_vswprintf
|
||||
extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Support for the locale chosen by the user. */
|
||||
#if (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
|
||||
|
||||
#undef setlocale
|
||||
#define setlocale libintl_setlocale
|
||||
extern char *setlocale (int, const char *);
|
||||
|
||||
#if 0
|
||||
|
||||
#undef newlocale
|
||||
#define newlocale libintl_newlocale
|
||||
extern locale_t newlocale (int, const char *, locale_t);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
#define libintl_set_relocation_prefix libintl_set_relocation_prefix
|
||||
extern void
|
||||
libintl_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* libintl.h */
|
||||
@@ -1,66 +0,0 @@
|
||||
/* Class autosprintf - formatted output to an ostream.
|
||||
Copyright (C) 2002 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _AUTOSPRINTF_H
|
||||
#define _AUTOSPRINTF_H
|
||||
|
||||
#ifndef __attribute__
|
||||
/* This feature is available in gcc versions 2.5 and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
|
||||
# define __attribute__(Spec) /* empty */
|
||||
# endif
|
||||
/* The __-protected variants of `format' and `printf' attributes
|
||||
are accepted by gcc versions 2.6.4 (effectively 2.7) and later. */
|
||||
# if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
|
||||
# define __format__ format
|
||||
# define __printf__ printf
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
|
||||
namespace gnu
|
||||
{
|
||||
/* A temporary object, usually allocated on the stack, representing
|
||||
the result of an asprintf() call. */
|
||||
class autosprintf
|
||||
{
|
||||
public:
|
||||
/* Constructor: takes a format string and the printf arguments. */
|
||||
autosprintf (const char *format, ...)
|
||||
__attribute__ ((__format__ (__printf__, 2, 3)));
|
||||
/* Copy constructor. */
|
||||
autosprintf (const autosprintf& src);
|
||||
/* Destructor: frees the temporarily allocated string. */
|
||||
~autosprintf ();
|
||||
/* Conversion to string. */
|
||||
operator char * () const;
|
||||
operator std::string () const;
|
||||
/* Output to an ostream. */
|
||||
friend inline std::ostream& operator<< (std::ostream& stream, const autosprintf& tmp)
|
||||
{
|
||||
stream << (tmp.str ? tmp.str : "(error in autosprintf)");
|
||||
return stream;
|
||||
}
|
||||
private:
|
||||
char *str;
|
||||
};
|
||||
}
|
||||
|
||||
#endif /* _AUTOSPRINTF_H */
|
||||
@@ -1,357 +0,0 @@
|
||||
/* Public API for GNU gettext PO files - contained in libgettextpo.
|
||||
Copyright (C) 2003-2008, 2010 Free Software Foundation, Inc.
|
||||
Written by Bruno Haible <bruno@clisp.org>, 2003.
|
||||
|
||||
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/>. */
|
||||
|
||||
#ifndef _GETTEXT_PO_H
|
||||
#define _GETTEXT_PO_H 1
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* =========================== Meta Information ============================ */
|
||||
|
||||
/* Version number: (major<<16) + (minor<<8) + subminor */
|
||||
#define LIBGETTEXTPO_VERSION 0x001201
|
||||
extern int libgettextpo_version;
|
||||
|
||||
/* ================================= Types ================================= */
|
||||
|
||||
/* A po_file_t represents the contents of a PO file. */
|
||||
typedef struct po_file *po_file_t;
|
||||
|
||||
/* A po_message_iterator_t represents an iterator through a domain of a
|
||||
PO file. */
|
||||
typedef struct po_message_iterator *po_message_iterator_t;
|
||||
|
||||
/* A po_message_t represents a message in a PO file. */
|
||||
typedef struct po_message *po_message_t;
|
||||
|
||||
/* A po_filepos_t represents a string's position within a source file. */
|
||||
typedef struct po_filepos *po_filepos_t;
|
||||
|
||||
/* A po_error_handler handles error situations. */
|
||||
struct po_error_handler
|
||||
{
|
||||
/* Signal an error. The error message is built from FORMAT and the following
|
||||
arguments. ERRNUM, if nonzero, is an errno value.
|
||||
Must increment the error_message_count variable declared in error.h.
|
||||
Must not return if STATUS is nonzero. */
|
||||
void (*error) (int status, int errnum,
|
||||
const char *format, ...)
|
||||
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__
|
||||
__attribute__ ((__format__ (__printf__, 3, 4)))
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Signal an error. The error message is built from FORMAT and the following
|
||||
arguments. The error location is at FILENAME line LINENO. ERRNUM, if
|
||||
nonzero, is an errno value.
|
||||
Must increment the error_message_count variable declared in error.h.
|
||||
Must not return if STATUS is nonzero. */
|
||||
void (*error_at_line) (int status, int errnum,
|
||||
const char *filename, unsigned int lineno,
|
||||
const char *format, ...)
|
||||
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__
|
||||
__attribute__ ((__format__ (__printf__, 5, 6)))
|
||||
#endif
|
||||
;
|
||||
|
||||
/* Signal a multiline warning. The PREFIX applies to all lines of the
|
||||
MESSAGE. Free the PREFIX and MESSAGE when done. */
|
||||
void (*multiline_warning) (char *prefix, char *message);
|
||||
|
||||
/* Signal a multiline error. The PREFIX applies to all lines of the
|
||||
MESSAGE. Free the PREFIX and MESSAGE when done.
|
||||
Must increment the error_message_count variable declared in error.h if
|
||||
PREFIX is non-NULL. */
|
||||
void (*multiline_error) (char *prefix, char *message);
|
||||
};
|
||||
typedef const struct po_error_handler *po_error_handler_t;
|
||||
|
||||
/* A po_xerror_handler handles warnings, error and fatal error situations. */
|
||||
#define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */
|
||||
#define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */
|
||||
#define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */
|
||||
struct po_xerror_handler
|
||||
{
|
||||
/* Signal a problem of the given severity.
|
||||
MESSAGE and/or FILENAME + LINENO indicate where the problem occurred.
|
||||
If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored.
|
||||
If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored.
|
||||
If COLUMN is (size_t)(-1), it should be ignored.
|
||||
MESSAGE_TEXT is the problem description (if MULTILINE_P is true,
|
||||
multiple lines of text, each terminated with a newline, otherwise
|
||||
usually a single line).
|
||||
Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */
|
||||
void (*xerror) (int severity,
|
||||
po_message_t message,
|
||||
const char *filename, size_t lineno, size_t column,
|
||||
int multiline_p, const char *message_text);
|
||||
/* Signal a problem that refers to two messages.
|
||||
Similar to two calls to xerror.
|
||||
If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to
|
||||
MESSAGE_TEXT2. */
|
||||
void (*xerror2) (int severity,
|
||||
po_message_t message1,
|
||||
const char *filename1, size_t lineno1, size_t column1,
|
||||
int multiline_p1, const char *message_text1,
|
||||
po_message_t message2,
|
||||
const char *filename2, size_t lineno2, size_t column2,
|
||||
int multiline_p2, const char *message_text2);
|
||||
};
|
||||
typedef const struct po_xerror_handler *po_xerror_handler_t;
|
||||
|
||||
/* Memory allocation:
|
||||
The memory allocations performed by these functions use xmalloc(),
|
||||
therefore will cause a program exit if memory is exhausted.
|
||||
The memory allocated by po_file_read, and implicitly returned through
|
||||
the po_message_* functions, lasts until freed with po_file_free. */
|
||||
|
||||
|
||||
/* ============================= po_file_t API ============================= */
|
||||
|
||||
/* Create an empty PO file representation in memory. */
|
||||
extern po_file_t po_file_create (void);
|
||||
|
||||
/* Read a PO file into memory.
|
||||
Return its contents. Upon failure, return NULL and set errno. */
|
||||
#define po_file_read po_file_read_v3
|
||||
extern po_file_t po_file_read (const char *filename,
|
||||
po_xerror_handler_t handler);
|
||||
|
||||
/* Write an in-memory PO file to a file.
|
||||
Upon failure, return NULL and set errno. */
|
||||
#define po_file_write po_file_write_v2
|
||||
extern po_file_t po_file_write (po_file_t file, const char *filename,
|
||||
po_xerror_handler_t handler);
|
||||
|
||||
/* Free a PO file from memory. */
|
||||
extern void po_file_free (po_file_t file);
|
||||
|
||||
/* Return the names of the domains covered by a PO file in memory. */
|
||||
extern const char * const * po_file_domains (po_file_t file);
|
||||
|
||||
|
||||
/* =========================== Header entry API ============================ */
|
||||
|
||||
/* Return the header entry of a domain of a PO file in memory.
|
||||
The domain NULL denotes the default domain.
|
||||
Return NULL if there is no header entry. */
|
||||
extern const char * po_file_domain_header (po_file_t file, const char *domain);
|
||||
|
||||
/* Return the value of a field in a header entry.
|
||||
The return value is either a freshly allocated string, to be freed by the
|
||||
caller, or NULL. */
|
||||
extern char * po_header_field (const char *header, const char *field);
|
||||
|
||||
/* Return the header entry with a given field set to a given value. The field
|
||||
is added if necessary.
|
||||
The return value is a freshly allocated string. */
|
||||
extern char * po_header_set_field (const char *header, const char *field, const char *value);
|
||||
|
||||
|
||||
/* ======================= po_message_iterator_t API ======================= */
|
||||
|
||||
/* Create an iterator for traversing a domain of a PO file in memory.
|
||||
The domain NULL denotes the default domain. */
|
||||
extern po_message_iterator_t po_message_iterator (po_file_t file, const char *domain);
|
||||
|
||||
/* Free an iterator. */
|
||||
extern void po_message_iterator_free (po_message_iterator_t iterator);
|
||||
|
||||
/* Return the next message, and advance the iterator.
|
||||
Return NULL at the end of the message list. */
|
||||
extern po_message_t po_next_message (po_message_iterator_t iterator);
|
||||
|
||||
/* Insert a message in a PO file in memory, in the domain and at the position
|
||||
indicated by the iterator. The iterator thereby advances past the freshly
|
||||
inserted message. */
|
||||
extern void po_message_insert (po_message_iterator_t iterator, po_message_t message);
|
||||
|
||||
|
||||
/* =========================== po_message_t API ============================ */
|
||||
|
||||
/* Return a freshly constructed message.
|
||||
To finish initializing the message, you must set the msgid and msgstr. */
|
||||
extern po_message_t po_message_create (void);
|
||||
|
||||
/* Return the context of a message, or NULL for a message not restricted to a
|
||||
context. */
|
||||
extern const char * po_message_msgctxt (po_message_t message);
|
||||
|
||||
/* Change the context of a message. NULL means a message not restricted to a
|
||||
context. */
|
||||
extern void po_message_set_msgctxt (po_message_t message, const char *msgctxt);
|
||||
|
||||
/* Return the msgid (untranslated English string) of a message. */
|
||||
extern const char * po_message_msgid (po_message_t message);
|
||||
|
||||
/* Change the msgid (untranslated English string) of a message. */
|
||||
extern void po_message_set_msgid (po_message_t message, const char *msgid);
|
||||
|
||||
/* Return the msgid_plural (untranslated English plural string) of a message,
|
||||
or NULL for a message without plural. */
|
||||
extern const char * po_message_msgid_plural (po_message_t message);
|
||||
|
||||
/* Change the msgid_plural (untranslated English plural string) of a message.
|
||||
NULL means a message without plural. */
|
||||
extern void po_message_set_msgid_plural (po_message_t message, const char *msgid_plural);
|
||||
|
||||
/* Return the msgstr (translation) of a message.
|
||||
Return the empty string for an untranslated message. */
|
||||
extern const char * po_message_msgstr (po_message_t message);
|
||||
|
||||
/* Change the msgstr (translation) of a message.
|
||||
Use an empty string to denote an untranslated message. */
|
||||
extern void po_message_set_msgstr (po_message_t message, const char *msgstr);
|
||||
|
||||
/* Return the msgstr[index] for a message with plural handling, or
|
||||
NULL when the index is out of range or for a message without plural. */
|
||||
extern const char * po_message_msgstr_plural (po_message_t message, int index);
|
||||
|
||||
/* Change the msgstr[index] for a message with plural handling.
|
||||
Use a NULL value at the end to reduce the number of plural forms. */
|
||||
extern void po_message_set_msgstr_plural (po_message_t message, int index, const char *msgstr);
|
||||
|
||||
/* Return the comments for a message. */
|
||||
extern const char * po_message_comments (po_message_t message);
|
||||
|
||||
/* Change the comments for a message.
|
||||
comments should be a multiline string, ending in a newline, or empty. */
|
||||
extern void po_message_set_comments (po_message_t message, const char *comments);
|
||||
|
||||
/* Return the extracted comments for a message. */
|
||||
extern const char * po_message_extracted_comments (po_message_t message);
|
||||
|
||||
/* Change the extracted comments for a message.
|
||||
comments should be a multiline string, ending in a newline, or empty. */
|
||||
extern void po_message_set_extracted_comments (po_message_t message, const char *comments);
|
||||
|
||||
/* Return the i-th file position for a message, or NULL if i is out of
|
||||
range. */
|
||||
extern po_filepos_t po_message_filepos (po_message_t message, int i);
|
||||
|
||||
/* Remove the i-th file position from a message.
|
||||
The indices of all following file positions for the message are decremented
|
||||
by one. */
|
||||
extern void po_message_remove_filepos (po_message_t message, int i);
|
||||
|
||||
/* Add a file position to a message, if it is not already present for the
|
||||
message.
|
||||
file is the file name.
|
||||
start_line is the line number where the string starts, or (size_t)(-1) if no
|
||||
line number is available. */
|
||||
extern void po_message_add_filepos (po_message_t message, const char *file, size_t start_line);
|
||||
|
||||
/* Return the previous context of a message, or NULL for none. */
|
||||
extern const char * po_message_prev_msgctxt (po_message_t message);
|
||||
|
||||
/* Change the previous context of a message. NULL is allowed. */
|
||||
extern void po_message_set_prev_msgctxt (po_message_t message, const char *prev_msgctxt);
|
||||
|
||||
/* Return the previous msgid (untranslated English string) of a message, or
|
||||
NULL for none. */
|
||||
extern const char * po_message_prev_msgid (po_message_t message);
|
||||
|
||||
/* Change the previous msgid (untranslated English string) of a message.
|
||||
NULL is allowed. */
|
||||
extern void po_message_set_prev_msgid (po_message_t message, const char *prev_msgid);
|
||||
|
||||
/* Return the previous msgid_plural (untranslated English plural string) of a
|
||||
message, or NULL for none. */
|
||||
extern const char * po_message_prev_msgid_plural (po_message_t message);
|
||||
|
||||
/* Change the previous msgid_plural (untranslated English plural string) of a
|
||||
message. NULL is allowed. */
|
||||
extern void po_message_set_prev_msgid_plural (po_message_t message, const char *prev_msgid_plural);
|
||||
|
||||
/* Return true if the message is marked obsolete. */
|
||||
extern int po_message_is_obsolete (po_message_t message);
|
||||
|
||||
/* Change the obsolete mark of a message. */
|
||||
extern void po_message_set_obsolete (po_message_t message, int obsolete);
|
||||
|
||||
/* Return true if the message is marked fuzzy. */
|
||||
extern int po_message_is_fuzzy (po_message_t message);
|
||||
|
||||
/* Change the fuzzy mark of a message. */
|
||||
extern void po_message_set_fuzzy (po_message_t message, int fuzzy);
|
||||
|
||||
/* Return true if the message is marked as being a format string of the given
|
||||
type (e.g. "c-format"). */
|
||||
extern int po_message_is_format (po_message_t message, const char *format_type);
|
||||
|
||||
/* Change the format string mark for a given type of a message. */
|
||||
extern void po_message_set_format (po_message_t message, const char *format_type, /*bool*/int value);
|
||||
|
||||
/* If a numeric range of a message is set, return true and store the minimum
|
||||
and maximum value in *MINP and *MAXP. */
|
||||
extern int po_message_is_range (po_message_t message, int *minp, int *maxp);
|
||||
|
||||
/* Change the numeric range of a message. MIN and MAX must be non-negative,
|
||||
with MIN < MAX. Use MIN = MAX = -1 to remove the numeric range of a
|
||||
message. */
|
||||
extern void po_message_set_range (po_message_t message, int min, int max);
|
||||
|
||||
|
||||
/* =========================== po_filepos_t API ============================ */
|
||||
|
||||
/* Return the file name. */
|
||||
extern const char * po_filepos_file (po_filepos_t filepos);
|
||||
|
||||
/* Return the line number where the string starts, or (size_t)(-1) if no line
|
||||
number is available. */
|
||||
extern size_t po_filepos_start_line (po_filepos_t filepos);
|
||||
|
||||
|
||||
/* ============================ Format type API ============================= */
|
||||
|
||||
/* Return a NULL terminated array of the supported format types. */
|
||||
extern const char * const * po_format_list (void);
|
||||
|
||||
/* Return the pretty name associated with a format type.
|
||||
For example, for "csharp-format", return "C#".
|
||||
Return NULL if the argument is not a supported format type. */
|
||||
extern const char * po_format_pretty_name (const char *format_type);
|
||||
|
||||
|
||||
/* ============================= Checking API ============================== */
|
||||
|
||||
/* Test whether an entire file PO file is valid, like msgfmt does it.
|
||||
If it is invalid, pass the reasons to the handler. */
|
||||
extern void po_file_check_all (po_file_t file, po_xerror_handler_t handler);
|
||||
|
||||
/* Test a single message, to be inserted in a PO file in memory, like msgfmt
|
||||
does it. If it is invalid, pass the reasons to the handler. The iterator
|
||||
is not modified by this call; it only specifies the file and the domain. */
|
||||
extern void po_message_check_all (po_message_t message, po_message_iterator_t iterator, po_xerror_handler_t handler);
|
||||
|
||||
/* Test whether the message translation is a valid format string if the message
|
||||
is marked as being a format string. If it is invalid, pass the reasons to
|
||||
the handler. */
|
||||
#define po_message_check_format po_message_check_format_v2
|
||||
extern void po_message_check_format (po_message_t message, po_xerror_handler_t handler);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _GETTEXT_PO_H */
|
||||
@@ -1,464 +0,0 @@
|
||||
/* Message catalogs for internationalization.
|
||||
Copyright (C) 1995-1997, 2000-2010 Free Software Foundation, Inc.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU Library General Public License as published
|
||||
by the Free Software Foundation; either version 2, 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
|
||||
USA. */
|
||||
|
||||
#ifndef _LIBINTL_H
|
||||
#define _LIBINTL_H 1
|
||||
|
||||
#include <locale.h>
|
||||
#if (defined __APPLE__ && defined __MACH__) && 0
|
||||
# include <xlocale.h>
|
||||
#endif
|
||||
|
||||
/* The LC_MESSAGES locale category is the category used by the functions
|
||||
gettext() and dgettext(). It is specified in POSIX, but not in ANSI C.
|
||||
On systems that don't define it, use an arbitrary value instead.
|
||||
On Solaris, <locale.h> defines __LOCALE_H (or _LOCALE_H in Solaris 2.5)
|
||||
then includes <libintl.h> (i.e. this file!) and then only defines
|
||||
LC_MESSAGES. To avoid a redefinition warning, don't define LC_MESSAGES
|
||||
in this case. */
|
||||
#if !defined LC_MESSAGES && !(defined __LOCALE_H || (defined _LOCALE_H && defined __sun))
|
||||
# define LC_MESSAGES 1729
|
||||
#endif
|
||||
|
||||
/* We define an additional symbol to signal that we use the GNU
|
||||
implementation of gettext. */
|
||||
#define __USE_GNU_GETTEXT 1
|
||||
|
||||
/* Provide information about the supported file formats. Returns the
|
||||
maximum minor revision number supported for a given major revision. */
|
||||
#define __GNU_GETTEXT_SUPPORTED_REVISION(major) \
|
||||
((major) == 0 || (major) == 1 ? 1 : -1)
|
||||
|
||||
/* Resolve a platform specific conflict on DJGPP. GNU gettext takes
|
||||
precedence over _conio_gettext. */
|
||||
#ifdef __DJGPP__
|
||||
# undef gettext
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
/* Version number: (major<<16) + (minor<<8) + subminor */
|
||||
#define LIBINTL_VERSION 0x001201
|
||||
extern int libintl_version;
|
||||
|
||||
|
||||
/* We redirect the functions to those prefixed with "libintl_". This is
|
||||
necessary, because some systems define gettext/textdomain/... in the C
|
||||
library (namely, Solaris 2.4 and newer, and GNU libc 2.0 and newer).
|
||||
If we used the unprefixed names, there would be cases where the
|
||||
definition in the C library would override the one in the libintl.so
|
||||
shared library. Recall that on ELF systems, the symbols are looked
|
||||
up in the following order:
|
||||
1. in the executable,
|
||||
2. in the shared libraries specified on the link command line, in order,
|
||||
3. in the dependencies of the shared libraries specified on the link
|
||||
command line,
|
||||
4. in the dlopen()ed shared libraries, in the order in which they were
|
||||
dlopen()ed.
|
||||
The definition in the C library would override the one in libintl.so if
|
||||
either
|
||||
* -lc is given on the link command line and -lintl isn't, or
|
||||
* -lc is given on the link command line before -lintl, or
|
||||
* libintl.so is a dependency of a dlopen()ed shared library but not
|
||||
linked to the executable at link time.
|
||||
Since Solaris gettext() behaves differently than GNU gettext(), this
|
||||
would be unacceptable.
|
||||
|
||||
The redirection happens by default through macros in C, so that &gettext
|
||||
is independent of the compilation unit, but through inline functions in
|
||||
C++, in order not to interfere with the name mangling of class fields or
|
||||
class methods called 'gettext'. */
|
||||
|
||||
/* The user can define _INTL_REDIRECT_INLINE or _INTL_REDIRECT_MACROS.
|
||||
If he doesn't, we choose the method. A third possible method is
|
||||
_INTL_REDIRECT_ASM, supported only by GCC. */
|
||||
#if !(defined _INTL_REDIRECT_INLINE || defined _INTL_REDIRECT_MACROS)
|
||||
# if defined __GNUC__ && __GNUC__ >= 2 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1) && !defined __MINGW32__ && !(__GNUC__ == 2 && defined _AIX) && (defined __STDC__ || defined __cplusplus)
|
||||
# define _INTL_REDIRECT_ASM
|
||||
# else
|
||||
# ifdef __cplusplus
|
||||
# define _INTL_REDIRECT_INLINE
|
||||
# else
|
||||
# define _INTL_REDIRECT_MACROS
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
/* Auxiliary macros. */
|
||||
#ifdef _INTL_REDIRECT_ASM
|
||||
# define _INTL_ASM(cname) __asm__ (_INTL_ASMNAME (__USER_LABEL_PREFIX__, #cname))
|
||||
# define _INTL_ASMNAME(prefix,cnamestring) _INTL_STRINGIFY (prefix) cnamestring
|
||||
# define _INTL_STRINGIFY(prefix) #prefix
|
||||
#else
|
||||
# define _INTL_ASM(cname)
|
||||
#endif
|
||||
|
||||
/* _INTL_MAY_RETURN_STRING_ARG(n) declares that the given function may return
|
||||
its n-th argument literally. This enables GCC to warn for example about
|
||||
printf (gettext ("foo %y")). */
|
||||
#if defined __GNUC__ && __GNUC__ >= 3 && !(defined __APPLE_CC__ && __APPLE_CC__ > 1 && defined __cplusplus)
|
||||
# define _INTL_MAY_RETURN_STRING_ARG(n) __attribute__ ((__format_arg__ (n)))
|
||||
#else
|
||||
# define _INTL_MAY_RETURN_STRING_ARG(n)
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the current default message catalog for the current
|
||||
LC_MESSAGES locale. If not found, returns MSGID itself (the default
|
||||
text). */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_gettext (const char *__msgid)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1);
|
||||
static inline char *gettext (const char *__msgid)
|
||||
{
|
||||
return libintl_gettext (__msgid);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define gettext libintl_gettext
|
||||
#endif
|
||||
extern char *gettext (const char *__msgid)
|
||||
_INTL_ASM (libintl_gettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1);
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current
|
||||
LC_MESSAGES locale. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dgettext (const char *__domainname, const char *__msgid)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *dgettext (const char *__domainname, const char *__msgid)
|
||||
{
|
||||
return libintl_dgettext (__domainname, __msgid);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dgettext libintl_dgettext
|
||||
#endif
|
||||
extern char *dgettext (const char *__domainname, const char *__msgid)
|
||||
_INTL_ASM (libintl_dgettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
|
||||
locale. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
{
|
||||
return libintl_dcgettext (__domainname, __msgid, __category);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dcgettext libintl_dcgettext
|
||||
#endif
|
||||
extern char *dcgettext (const char *__domainname, const char *__msgid,
|
||||
int __category)
|
||||
_INTL_ASM (libintl_dcgettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
|
||||
/* Similar to `gettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
|
||||
static inline char *ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
{
|
||||
return libintl_ngettext (__msgid1, __msgid2, __n);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define ngettext libintl_ngettext
|
||||
#endif
|
||||
extern char *ngettext (const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_ASM (libintl_ngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (1) _INTL_MAY_RETURN_STRING_ARG (2);
|
||||
#endif
|
||||
|
||||
/* Similar to `dgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
static inline char *dngettext (const char *__domainname, const char *__msgid1,
|
||||
const char *__msgid2, unsigned long int __n)
|
||||
{
|
||||
return libintl_dngettext (__domainname, __msgid1, __msgid2, __n);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dngettext libintl_dngettext
|
||||
#endif
|
||||
extern char *dngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n)
|
||||
_INTL_ASM (libintl_dngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
#endif
|
||||
|
||||
/* Similar to `dcgettext' but select the plural form corresponding to the
|
||||
number N. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
static inline char *dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
{
|
||||
return libintl_dcngettext (__domainname, __msgid1, __msgid2, __n, __category);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define dcngettext libintl_dcngettext
|
||||
#endif
|
||||
extern char *dcngettext (const char *__domainname,
|
||||
const char *__msgid1, const char *__msgid2,
|
||||
unsigned long int __n, int __category)
|
||||
_INTL_ASM (libintl_dcngettext)
|
||||
_INTL_MAY_RETURN_STRING_ARG (2) _INTL_MAY_RETURN_STRING_ARG (3);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Set the current default message catalog to DOMAINNAME.
|
||||
If DOMAINNAME is null, return the current default.
|
||||
If DOMAINNAME is "", reset to the default of "messages". */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_textdomain (const char *__domainname);
|
||||
static inline char *textdomain (const char *__domainname)
|
||||
{
|
||||
return libintl_textdomain (__domainname);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define textdomain libintl_textdomain
|
||||
#endif
|
||||
extern char *textdomain (const char *__domainname)
|
||||
_INTL_ASM (libintl_textdomain);
|
||||
#endif
|
||||
|
||||
/* Specify that the DOMAINNAME message catalog will be found
|
||||
in DIRNAME rather than in the system locale data base. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_bindtextdomain (const char *__domainname,
|
||||
const char *__dirname);
|
||||
static inline char *bindtextdomain (const char *__domainname,
|
||||
const char *__dirname)
|
||||
{
|
||||
return libintl_bindtextdomain (__domainname, __dirname);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define bindtextdomain libintl_bindtextdomain
|
||||
#endif
|
||||
extern char *bindtextdomain (const char *__domainname, const char *__dirname)
|
||||
_INTL_ASM (libintl_bindtextdomain);
|
||||
#endif
|
||||
|
||||
/* Specify the character encoding in which the messages from the
|
||||
DOMAINNAME message catalog will be returned. */
|
||||
#ifdef _INTL_REDIRECT_INLINE
|
||||
extern char *libintl_bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset);
|
||||
static inline char *bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset)
|
||||
{
|
||||
return libintl_bind_textdomain_codeset (__domainname, __codeset);
|
||||
}
|
||||
#else
|
||||
#ifdef _INTL_REDIRECT_MACROS
|
||||
# define bind_textdomain_codeset libintl_bind_textdomain_codeset
|
||||
#endif
|
||||
extern char *bind_textdomain_codeset (const char *__domainname,
|
||||
const char *__codeset)
|
||||
_INTL_ASM (libintl_bind_textdomain_codeset);
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Support for format strings with positions in *printf(), following the
|
||||
POSIX/XSI specification.
|
||||
Note: These replacements for the *printf() functions are visible only
|
||||
in source files that #include <libintl.h> or #include "gettext.h".
|
||||
Packages that use *printf() in source files that don't refer to _()
|
||||
or gettext() but for which the format string could be the return value
|
||||
of _() or gettext() need to add this #include. Oh well. */
|
||||
|
||||
#if !0
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
|
||||
/* Get va_list. */
|
||||
#if (defined __STDC__ && __STDC__) || defined __cplusplus || defined _MSC_VER
|
||||
# include <stdarg.h>
|
||||
#else
|
||||
# include <varargs.h>
|
||||
#endif
|
||||
|
||||
#if !(defined fprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef fprintf
|
||||
#define fprintf libintl_fprintf
|
||||
extern int fprintf (FILE *, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vfprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vfprintf
|
||||
#define vfprintf libintl_vfprintf
|
||||
extern int vfprintf (FILE *, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if !(defined printf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef printf
|
||||
#if defined __NetBSD__ || defined __BEOS__ || defined __CYGWIN__ || defined __MINGW32__
|
||||
/* Don't break __attribute__((format(printf,M,N))).
|
||||
This redefinition is only possible because the libc in NetBSD, Cygwin,
|
||||
mingw does not have a function __printf__.
|
||||
Alternatively, we could have done this redirection only when compiling with
|
||||
__GNUC__, together with a symbol redirection:
|
||||
extern int printf (const char *, ...)
|
||||
__asm__ (#__USER_LABEL_PREFIX__ "libintl_printf");
|
||||
But doing it now would introduce a binary incompatibility with already
|
||||
distributed versions of libintl on these systems. */
|
||||
# define libintl_printf __printf__
|
||||
#endif
|
||||
#define printf libintl_printf
|
||||
extern int printf (const char *, ...);
|
||||
#endif
|
||||
#if !(defined vprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vprintf
|
||||
#define vprintf libintl_vprintf
|
||||
extern int vprintf (const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if !(defined sprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef sprintf
|
||||
#define sprintf libintl_sprintf
|
||||
extern int sprintf (char *, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vsprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vsprintf
|
||||
#define vsprintf libintl_vsprintf
|
||||
extern int vsprintf (char *, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
|
||||
#if !(defined snprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef snprintf
|
||||
#define snprintf libintl_snprintf
|
||||
extern int snprintf (char *, size_t, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vsnprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vsnprintf
|
||||
#define vsnprintf libintl_vsnprintf
|
||||
extern int vsnprintf (char *, size_t, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
#if !(defined asprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef asprintf
|
||||
#define asprintf libintl_asprintf
|
||||
extern int asprintf (char **, const char *, ...);
|
||||
#endif
|
||||
#if !(defined vasprintf && defined _GL_STDIO_H) /* don't override gnulib */
|
||||
#undef vasprintf
|
||||
#define vasprintf libintl_vasprintf
|
||||
extern int vasprintf (char **, const char *, va_list);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
#undef fwprintf
|
||||
#define fwprintf libintl_fwprintf
|
||||
extern int fwprintf (FILE *, const wchar_t *, ...);
|
||||
#undef vfwprintf
|
||||
#define vfwprintf libintl_vfwprintf
|
||||
extern int vfwprintf (FILE *, const wchar_t *, va_list);
|
||||
|
||||
#undef wprintf
|
||||
#define wprintf libintl_wprintf
|
||||
extern int wprintf (const wchar_t *, ...);
|
||||
#undef vwprintf
|
||||
#define vwprintf libintl_vwprintf
|
||||
extern int vwprintf (const wchar_t *, va_list);
|
||||
|
||||
#undef swprintf
|
||||
#define swprintf libintl_swprintf
|
||||
extern int swprintf (wchar_t *, size_t, const wchar_t *, ...);
|
||||
#undef vswprintf
|
||||
#define vswprintf libintl_vswprintf
|
||||
extern int vswprintf (wchar_t *, size_t, const wchar_t *, va_list);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Support for the locale chosen by the user. */
|
||||
#if (defined __APPLE__ && defined __MACH__) || defined _WIN32 || defined __WIN32__ || defined __CYGWIN__
|
||||
|
||||
#undef setlocale
|
||||
#define setlocale libintl_setlocale
|
||||
extern char *setlocale (int, const char *);
|
||||
|
||||
#if 0
|
||||
|
||||
#undef newlocale
|
||||
#define newlocale libintl_newlocale
|
||||
extern locale_t newlocale (int, const char *, locale_t);
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
/* Support for relocatable packages. */
|
||||
|
||||
/* Sets the original and the current installation prefix of the package.
|
||||
Relocation simply replaces a pathname starting with the original prefix
|
||||
by the corresponding pathname with the current prefix instead. Both
|
||||
prefixes should be directory names without trailing slash (i.e. use ""
|
||||
instead of "/"). */
|
||||
#define libintl_set_relocation_prefix libintl_set_relocation_prefix
|
||||
extern void
|
||||
libintl_set_relocation_prefix (const char *orig_prefix,
|
||||
const char *curr_prefix);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* libintl.h */
|
||||
Binary file not shown.
@@ -1,86 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Prints a package's identification PACKAGE VERSION or PACKAGE.
|
||||
#
|
||||
# Copyright (C) 2001-2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
want_version="$1"
|
||||
|
||||
# NLS nuisances: Letter ranges are different in the Estonian locale.
|
||||
LC_ALL=C
|
||||
|
||||
while true; do
|
||||
if test -f configure; then
|
||||
package=`(grep '^PACKAGE_NAME=' configure; grep '^ *PACKAGE=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"`
|
||||
case "$package" in
|
||||
*[\"\$\`\{\}]*)
|
||||
# Some packages (gcal) retrieve the package name dynamically.
|
||||
package=
|
||||
;;
|
||||
esac
|
||||
if test -n "$package"; then
|
||||
is_gnu=`LC_ALL=C grep "GNU $package" * 2>/dev/null | grep -v '^libtool:'`
|
||||
if test -n "$is_gnu"; then
|
||||
package="GNU $package"
|
||||
fi
|
||||
if test -n "$want_version"; then
|
||||
version=`(grep '^PACKAGE_VERSION=' configure; grep '^ *VERSION=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"`
|
||||
case "$version" in
|
||||
*[\"\$\`\{\}]*)
|
||||
# Some packages (gcal, gcc, clisp) retrieve the version dynamically.
|
||||
version=
|
||||
;;
|
||||
esac
|
||||
if test -n "$version"; then
|
||||
echo "$package $version"
|
||||
else
|
||||
echo "$package"
|
||||
fi
|
||||
else
|
||||
echo "$package"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
dir=`basename \`pwd\``
|
||||
case "$dir" in
|
||||
i18n)
|
||||
# This directory name, used in GNU make, is not the top level directory.
|
||||
;;
|
||||
*[A-Za-z]*[0-9]*)
|
||||
package=`echo "$dir" | sed -e 's/^\([^0-9]*\)[0-9].*$/\1/' -e 's/[-_]$//'`
|
||||
if test -n "$want_version"; then
|
||||
version=`echo "$dir" | sed -e 's/^[^0-9]*\([0-9].*\)$/\1/'`
|
||||
echo "$package $version"
|
||||
else
|
||||
echo "$package"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
# Go to parent directory
|
||||
last=`/bin/pwd`
|
||||
cd ..
|
||||
curr=`/bin/pwd`
|
||||
if test "$last" = "$curr"; then
|
||||
# Oops, didn't find the package name.
|
||||
if test -n "$want_version"; then
|
||||
echo "PACKAGE VERSION"
|
||||
else
|
||||
echo "PACKAGE"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
Binary file not shown.
@@ -1,436 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Prints the user's email address, with confirmation from the user.
|
||||
#
|
||||
# Copyright (C) 2001-2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
# Prerequisites for using ${exec_prefix}/lib and ${datarootdir}/locale.
|
||||
prefix="/usr/local/i686-w64-mingw32/stow/gettext-0.18.1.1"
|
||||
exec_prefix="${prefix}"
|
||||
datarootdir="${prefix}/share"
|
||||
datadir="${datarootdir}"
|
||||
# Set variables libdir, localedir.
|
||||
libdir="${exec_prefix}/lib"
|
||||
localedir="${datarootdir}/locale"
|
||||
|
||||
# Support for relocatability.
|
||||
if test "no" = yes; then
|
||||
orig_installdir="$libdir"/gettext # see Makefile.am's install rule
|
||||
# Determine curr_installdir without caring for symlinked callers.
|
||||
curr_installdir=`echo "$0" | sed -e 's,/[^/]*$,,'`
|
||||
curr_installdir=`cd "$curr_installdir" && pwd`
|
||||
# Compute the original/current installation prefixes by stripping the
|
||||
# trailing directories off the original/current installation directories.
|
||||
while true; do
|
||||
orig_last=`echo "$orig_installdir" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
curr_last=`echo "$curr_installdir" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
if test -z "$orig_last" || test -z "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
if test "$orig_last" != "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
orig_installdir=`echo "$orig_installdir" | sed -e 's,/[^/]*$,,'`
|
||||
curr_installdir=`echo "$curr_installdir" | sed -e 's,/[^/]*$,,'`
|
||||
done
|
||||
# Now relocate the directory variables that we use.
|
||||
libdir=`echo "$libdir/" | sed -e "s%^${orig_installdir}/%${curr_installdir}/%" | sed -e 's,/$,,'`
|
||||
localedir=`echo "$localedir/" | sed -e "s%^${orig_installdir}/%${curr_installdir}/%" | sed -e 's,/$,,'`
|
||||
fi
|
||||
|
||||
# Internationalization.
|
||||
. gettext.sh
|
||||
TEXTDOMAIN=gettext-tools
|
||||
export TEXTDOMAIN
|
||||
TEXTDOMAINDIR="$localedir"
|
||||
export TEXTDOMAINDIR
|
||||
|
||||
# Redirect fileno 3 to interactive I/O.
|
||||
exec 3>/dev/tty
|
||||
|
||||
# Output a prompt.
|
||||
if test $# != 0; then
|
||||
echo "$1" 1>&3
|
||||
fi
|
||||
|
||||
# Find the user name on the local machine.
|
||||
user=`id -u -n 2>/dev/null`
|
||||
if test -z "$user"; then
|
||||
user="$USER"
|
||||
if test -z "$user"; then
|
||||
user="$LOGNAME"
|
||||
if test -z "$user"; then
|
||||
user=unknown
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find the hostname.
|
||||
# hostname on some systems (SVR3.2, old Linux) returns a bogus exit status,
|
||||
# so uname gets run too, so we keep only the first line of output.
|
||||
#host=`(hostname || uname -n) 2>/dev/null | sed 1q`
|
||||
host=`"$libdir"/gettext/hostname --short 2>/dev/null | sed 1q`
|
||||
|
||||
# Find the hostname.
|
||||
hostfqdn=`"$libdir"/gettext/hostname --fqdn 2>/dev/null | sed 1q`
|
||||
|
||||
# Find a list of email addresses from various mailer configuration files.
|
||||
# All mailers use configuration files under $HOME. We handle them in a
|
||||
# last-modified - first-priority order.
|
||||
cd $HOME
|
||||
files=""
|
||||
|
||||
# ----------------------- BEGIN MAILER SPECIFIC CODE -----------------------
|
||||
|
||||
# Mozilla Thunderbird addresses
|
||||
files="$files .thunderbird/*/prefs.js"
|
||||
|
||||
# Mozilla addresses
|
||||
files="$files .mozilla/*/prefs.js"
|
||||
|
||||
# Netscape 4 addresses
|
||||
files="$files .netscape/liprefs.js .netscape/preferences.js"
|
||||
|
||||
# Netscape 3 addresses
|
||||
files="$files .netscape/preferences"
|
||||
|
||||
# Emacs/XEmacs rmail, Emacs/XEmacs gnus, XEmacs vm addresses
|
||||
# XEmacs mew addresses
|
||||
files="$files .emacs .emacs.el"
|
||||
|
||||
# KDE2 addresses
|
||||
files="$files .kde2/share/config/emaildefaults"
|
||||
|
||||
# KDE kmail addresses
|
||||
files="$files .kde2/share/config/kmailrc"
|
||||
|
||||
# GNOME evolution 2 addresses
|
||||
files="$files .gconf/apps/evolution/mail/%gconf.xml"
|
||||
|
||||
# GNOME evolution 1 addresses
|
||||
files="$files evolution/config.xmldb"
|
||||
|
||||
# GNOME balsa addresses
|
||||
files="$files .gnome/balsa"
|
||||
|
||||
# StarOffice and OpenOffice addresses
|
||||
sed_dos2unix='s/\r$//'
|
||||
sed_soffice51='s,StarOffice 5\.1=\(.*\)$,\1/sofficerc,p'
|
||||
sed_soffice52='s,StarOffice 5\.2=\(.*\)$,\1/user/sofficerc,p'
|
||||
sed_ooffice='s,^OpenOffice[^=]*=\(.*\)$,\1/user/config/registry/instance/org/openoffice/UserProfile.xml,p'
|
||||
files="$files Office51/sofficerc Office52/user/sofficerc "`sed -n -e "$sed_dos2unix" -e "$sed_soffice51" -e "$sed_soffice52" -e "$sed_ooffice" .sversionrc 2>/dev/null | sed -e 's,^file://*,/,'`
|
||||
|
||||
# mutt addresses
|
||||
files="$files .muttrc"
|
||||
|
||||
# pine addresses
|
||||
files="$files .pinerc"
|
||||
|
||||
# xfmail addresses
|
||||
files="$files .xfmail/.xfmailrc"
|
||||
|
||||
# tkrat addresses
|
||||
files="$files .ratatosk/ratatoskrc"
|
||||
|
||||
# ----------------------- END MAILER SPECIFIC CODE -----------------------
|
||||
|
||||
# Expand wildcards and remove nonexistent files from the list.
|
||||
nfiles=""
|
||||
for file in $files; do
|
||||
if test -r "$file" && test ! -d "$file"; then
|
||||
nfiles="$nfiles $file"
|
||||
fi
|
||||
done
|
||||
files="$nfiles"
|
||||
|
||||
addresses=""
|
||||
|
||||
if test -n "$files"; then
|
||||
|
||||
for file in `ls -t $files`; do
|
||||
|
||||
case "$file" in
|
||||
|
||||
# ----------------------- BEGIN MAILER SPECIFIC CODE -----------------------
|
||||
|
||||
# Mozilla and Mozilla Thunderbird addresses
|
||||
.mozilla/*/prefs.js | .thunderbird/*/prefs.js)
|
||||
addresses="$addresses "`grep -h '^user_pref("mail\.identity\..*\.useremail", ".*");$' $file 2>/dev/null | sed -e 's/^user_pref("mail\.identity\..*\.useremail", "\(.*\)");$/\1/'`
|
||||
;;
|
||||
|
||||
# Netscape 4 addresses
|
||||
.netscape/liprefs.js | .netscape/preferences.js)
|
||||
addresses="$addresses "`grep -h '^user_pref("mail\.identity\.useremail", ".*");$' $file 2>/dev/null | sed -e 's/^user_pref("mail\.identity\.useremail", "\(.*\)");$/\1/'`
|
||||
;;
|
||||
|
||||
# Netscape 3 addresses
|
||||
.netscape/preferences)
|
||||
addresses="$addresses "`grep -h '^EMAIL_ADDRESS:' $file 2>/dev/null | sed -e 's/^EMAIL_ADDRESS:[ ]*//'`
|
||||
;;
|
||||
|
||||
.emacs | .emacs.el)
|
||||
# Emacs/XEmacs rmail, Emacs/XEmacs gnus, XEmacs vm addresses
|
||||
addresses="$addresses "`grep -h '[ (]user-mail-address "[^"]*"' $file 2>/dev/null | sed -e 's/^.*[ (]user-mail-address "\([^"]*\)".*$/\1/'`
|
||||
# XEmacs mew addresses
|
||||
domains=`grep -h '[ (]mew-mail-domain "[^"]*"' $file 2>/dev/null | sed -e 's/^.*[ (]mew-mail-domain "\([^"]*\)".*$/\1/'`
|
||||
if test -n "$domains"; then
|
||||
for domain in $domains; do
|
||||
addresses="$addresses ${user}@$domain"
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
||||
# KDE2 addresses
|
||||
.kde2/share/config/emaildefaults)
|
||||
addresses="$addresses "`grep -h '^EmailAddress=' $file 2>/dev/null | sed -e 's/^EmailAddress=//'`
|
||||
;;
|
||||
|
||||
# KDE kmail addresses
|
||||
.kde2/share/config/kmailrc)
|
||||
addresses="$addresses "`grep -h '^Email Address=' $file 2>/dev/null | sed -e 's/^Email Address=//'`
|
||||
;;
|
||||
|
||||
# GNOME evolution 2 addresses
|
||||
.gconf/apps/evolution/mail/%gconf.xml)
|
||||
sedexpr0='s,^.*<addr-spec>\(.*\)</addr-spec>.*$,\1,p'
|
||||
addresses="$addresses "`sed -n -e "$sedexpr0" < $file`
|
||||
;;
|
||||
|
||||
# GNOME evolution 1 addresses
|
||||
evolution/config.xmldb)
|
||||
sedexpr0='s/^.*<entry name="identity_address_[0-9]*" type="string" value="\([^"]*\)".*$/\1/p'
|
||||
sedexpr1='s/\(..\)/\\x\1/g'
|
||||
sedexpr2='s,$,\\n,'
|
||||
addresses="$addresses "`sed -n -e "$sedexpr0" < $file | while read hexstring; do printf \`echo "$hexstring" | sed -e "$sedexpr1" -e "$sedexpr2"\`; done`
|
||||
;;
|
||||
|
||||
# GNOME balsa addresses
|
||||
.gnome/balsa)
|
||||
addresses="$addresses "`grep -h '^Address=' $file 2>/dev/null | sed -e 's/^Address=//'`
|
||||
;;
|
||||
|
||||
# OpenOffice addresses
|
||||
*/UserProfile.xml)
|
||||
addresses="$addresses "`sed -n -e 's,^.*<mail cfg:type="string">\(.*\)</mail>.*$,\1,p' $file 2>/dev/null`
|
||||
;;
|
||||
|
||||
# StarOffice addresses
|
||||
# Not a typo. They really write "Adress" with a single d.
|
||||
# German orthography...
|
||||
*/sofficerc)
|
||||
addresses="$addresses "`grep -h '^User-Adress=' $file 2>/dev/null | sed -e 's/#[^#]*$//' -e 's/^.*#//'`
|
||||
;;
|
||||
|
||||
# mutt addresses
|
||||
.muttrc)
|
||||
mutt_addresses=`grep -h '^set from="[^"]*"[ ]*$' $file 2>/dev/null | sed -e 's/^set from="\([^"]*\)"[ ]*$/\1/'`
|
||||
if test -n "$mutt_addresses"; then
|
||||
addresses="$addresses $mutt_addresses"
|
||||
else
|
||||
# mutt uses $EMAIL as fallback.
|
||||
if test -n "$EMAIL"; then
|
||||
addresses="$addresses $EMAIL"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
# pine addresses
|
||||
.pinerc)
|
||||
domains=`grep -h '^user-domain=' $file 2>/dev/null | sed -e 's/^user-domain=//'`
|
||||
if test -n "$domains"; then
|
||||
for domain in $domains; do
|
||||
addresses="$addresses ${user}@$domain"
|
||||
done
|
||||
else
|
||||
# The use-only-domain-name option is only used if the user-domain option is not present.
|
||||
domains=`grep -h '^use-only-domain-name=' $file 2>/dev/null | sed -e 's/^use-only-domain-name=//'`
|
||||
if test "Yes" = "$domains"; then
|
||||
addresses="$addresses ${user}@"`echo "$hostfqdn" | sed -e 's/^[^.]*\.//'`
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
# xfmail addresses
|
||||
.xfmail/.xfmailrc)
|
||||
addresses="$addresses "`grep -h '^from=.*<.*>' $file 2>/dev/null | sed -e 's/^.*<\([^<>]*\)>.*$/\1/'`
|
||||
;;
|
||||
|
||||
# tkrat addresses
|
||||
.ratatosk/ratatoskrc)
|
||||
domains=`grep -h '^set option(masquerade_as) ' $file 2>/dev/null | sed -e 's/^set option(masquerade_as) //'`
|
||||
if test -n "$domains"; then
|
||||
for domain in $domains; do
|
||||
addresses="$addresses ${user}@$domain"
|
||||
done
|
||||
else
|
||||
# The domain option is used only if the masquerade_as option is not present.
|
||||
domains=`grep -h '^set option(domain) ' $file 2>/dev/null | sed -e 's/^set option(domain) //'`
|
||||
if test -n "$domains"; then
|
||||
for domain in $domains; do
|
||||
addresses="$addresses ${user}@${host}.$domain"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
# ----------------------- END MAILER SPECIFIC CODE -----------------------
|
||||
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
# Some Debian systems have a file /etc/mailname.
|
||||
if test -r /etc/mailname; then
|
||||
hostmailname=`cat /etc/mailname`
|
||||
if test -n "$hostmailname"; then
|
||||
addresses="$addresses ${user}@$hostmailname"
|
||||
fi
|
||||
fi
|
||||
|
||||
# SuSE Linux >= 8.0 systems have a file /etc/sysconfig/mail.
|
||||
if test -r /etc/sysconfig/mail; then
|
||||
hostmailname=`. /etc/sysconfig/mail && echo "$FROM_HEADER"`
|
||||
if test -n "$hostmailname"; then
|
||||
addresses="$addresses ${user}@$hostmailname"
|
||||
fi
|
||||
fi
|
||||
|
||||
# elm has no user-defined addresses.
|
||||
# mailx has no user-defined addresses.
|
||||
# mh has no user-defined addresses.
|
||||
# They use the system default.
|
||||
addresses="$addresses ${user}@$hostfqdn"
|
||||
|
||||
# Normalize addresses: remove addresses without @, lowercase the part after @,
|
||||
# and remove duplicates.
|
||||
lowercase_sed='{
|
||||
h
|
||||
s/^[^@]*@\(.*\)$/\1/
|
||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
x
|
||||
s/^\([^@]*\)@.*/\1@/
|
||||
G
|
||||
s/\
|
||||
//
|
||||
p
|
||||
}'
|
||||
naddresses=""
|
||||
for addr in $addresses; do
|
||||
case "$addr" in
|
||||
"<"*">") addr=`echo "$addr" | sed -e 's/^<//' -e 's/>$//'` ;;
|
||||
esac
|
||||
case "$addr" in
|
||||
*@*)
|
||||
addr=`echo "$addr" | sed -n -e "$lowercase_sed"`
|
||||
case " $naddresses " in
|
||||
*" $addr "*) ;;
|
||||
*) naddresses="$naddresses $addr" ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done
|
||||
addresses="$naddresses"
|
||||
|
||||
# Now it's time to ask the user.
|
||||
case "$addresses" in
|
||||
" "*" "*)
|
||||
# At least two addresses.
|
||||
lines=""
|
||||
i=0
|
||||
for addr in $addresses; do
|
||||
i=`expr $i + 1`
|
||||
lines="${lines}${i} ${addr}
|
||||
"
|
||||
done
|
||||
while true; do
|
||||
{ gettext "Which is your email address?"; echo; } 1>&3
|
||||
echo "$lines" 1>&3
|
||||
{ gettext "Please choose the number, or enter your email address."; echo; } 1>&3
|
||||
read answer < /dev/tty
|
||||
case "$answer" in
|
||||
*@*) ;;
|
||||
[0-9]*)
|
||||
i=0
|
||||
for addr in $addresses; do
|
||||
i=`expr $i + 1`
|
||||
if test "$i" = "$answer"; then
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
case "$answer" in
|
||||
"<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
||||
esac
|
||||
case "$answer" in
|
||||
*" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
||||
*@*.*) ;;
|
||||
*@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
||||
*) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
||||
esac
|
||||
addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
||||
break
|
||||
done
|
||||
;;
|
||||
" "*)
|
||||
# One address.
|
||||
while true; do
|
||||
{ gettext "Is the following your email address?"; echo; } 1>&3
|
||||
echo " $addresses" 1>&3
|
||||
{ gettext "Please confirm by pressing Return, or enter your email address."; echo; } 1>&3
|
||||
read answer < /dev/tty
|
||||
if test -z "$answer"; then
|
||||
addr=`echo "$addresses" | sed -e 's/^ //'`
|
||||
break
|
||||
fi
|
||||
case "$answer" in
|
||||
"<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
||||
esac
|
||||
case "$answer" in
|
||||
*" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
||||
*@*.*) ;;
|
||||
*@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
||||
*) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
||||
esac
|
||||
addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
||||
break
|
||||
done
|
||||
;;
|
||||
"")
|
||||
# No address.
|
||||
{ gettext "Couldn't find out about your email address."; echo; } 1>&3
|
||||
while true; do
|
||||
{ gettext "Please enter your email address."; echo; } 1>&3
|
||||
read answer < /dev/tty
|
||||
case "$answer" in
|
||||
"<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
||||
esac
|
||||
case "$answer" in
|
||||
*" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
||||
*@*.*) ;;
|
||||
*@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
||||
*) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
||||
esac
|
||||
addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
||||
break
|
||||
done
|
||||
;;
|
||||
*) echo "internal error" 1>&3 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Print to standard output.
|
||||
echo "$addr"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,86 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Prints a package's identification PACKAGE VERSION or PACKAGE.
|
||||
#
|
||||
# Copyright (C) 2001-2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
want_version="$1"
|
||||
|
||||
# NLS nuisances: Letter ranges are different in the Estonian locale.
|
||||
LC_ALL=C
|
||||
|
||||
while true; do
|
||||
if test -f configure; then
|
||||
package=`(grep '^PACKAGE_NAME=' configure; grep '^ *PACKAGE=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"`
|
||||
case "$package" in
|
||||
*[\"\$\`\{\}]*)
|
||||
# Some packages (gcal) retrieve the package name dynamically.
|
||||
package=
|
||||
;;
|
||||
esac
|
||||
if test -n "$package"; then
|
||||
is_gnu=`LC_ALL=C grep "GNU $package" * 2>/dev/null | grep -v '^libtool:'`
|
||||
if test -n "$is_gnu"; then
|
||||
package="GNU $package"
|
||||
fi
|
||||
if test -n "$want_version"; then
|
||||
version=`(grep '^PACKAGE_VERSION=' configure; grep '^ *VERSION=' configure) | grep -v '=[ ]*$' | sed -e '1q' | sed -e 's/^[^=]*=//' | sed -e "s/^'//" -e "s/'$//"`
|
||||
case "$version" in
|
||||
*[\"\$\`\{\}]*)
|
||||
# Some packages (gcal, gcc, clisp) retrieve the version dynamically.
|
||||
version=
|
||||
;;
|
||||
esac
|
||||
if test -n "$version"; then
|
||||
echo "$package $version"
|
||||
else
|
||||
echo "$package"
|
||||
fi
|
||||
else
|
||||
echo "$package"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
dir=`basename \`pwd\``
|
||||
case "$dir" in
|
||||
i18n)
|
||||
# This directory name, used in GNU make, is not the top level directory.
|
||||
;;
|
||||
*[A-Za-z]*[0-9]*)
|
||||
package=`echo "$dir" | sed -e 's/^\([^0-9]*\)[0-9].*$/\1/' -e 's/[-_]$//'`
|
||||
if test -n "$want_version"; then
|
||||
version=`echo "$dir" | sed -e 's/^[^0-9]*\([0-9].*\)$/\1/'`
|
||||
echo "$package $version"
|
||||
else
|
||||
echo "$package"
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
# Go to parent directory
|
||||
last=`/bin/pwd`
|
||||
cd ..
|
||||
curr=`/bin/pwd`
|
||||
if test "$last" = "$curr"; then
|
||||
# Oops, didn't find the package name.
|
||||
if test -n "$want_version"; then
|
||||
echo "PACKAGE VERSION"
|
||||
else
|
||||
echo "PACKAGE"
|
||||
fi
|
||||
exit 0
|
||||
fi
|
||||
done
|
||||
Binary file not shown.
@@ -1,436 +0,0 @@
|
||||
#!/bin/sh
|
||||
# Prints the user's email address, with confirmation from the user.
|
||||
#
|
||||
# Copyright (C) 2001-2003, 2005 Free Software Foundation, Inc.
|
||||
#
|
||||
# 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/>.
|
||||
|
||||
# Prerequisites for using ${exec_prefix}/lib and ${datarootdir}/locale.
|
||||
prefix="/usr/local/x86_64-w64-mingw32/stow/gettext-0.18.1.1"
|
||||
exec_prefix="${prefix}"
|
||||
datarootdir="${prefix}/share"
|
||||
datadir="${datarootdir}"
|
||||
# Set variables libdir, localedir.
|
||||
libdir="${exec_prefix}/lib"
|
||||
localedir="${datarootdir}/locale"
|
||||
|
||||
# Support for relocatability.
|
||||
if test "no" = yes; then
|
||||
orig_installdir="$libdir"/gettext # see Makefile.am's install rule
|
||||
# Determine curr_installdir without caring for symlinked callers.
|
||||
curr_installdir=`echo "$0" | sed -e 's,/[^/]*$,,'`
|
||||
curr_installdir=`cd "$curr_installdir" && pwd`
|
||||
# Compute the original/current installation prefixes by stripping the
|
||||
# trailing directories off the original/current installation directories.
|
||||
while true; do
|
||||
orig_last=`echo "$orig_installdir" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
curr_last=`echo "$curr_installdir" | sed -n -e 's,^.*/\([^/]*\)$,\1,p'`
|
||||
if test -z "$orig_last" || test -z "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
if test "$orig_last" != "$curr_last"; then
|
||||
break
|
||||
fi
|
||||
orig_installdir=`echo "$orig_installdir" | sed -e 's,/[^/]*$,,'`
|
||||
curr_installdir=`echo "$curr_installdir" | sed -e 's,/[^/]*$,,'`
|
||||
done
|
||||
# Now relocate the directory variables that we use.
|
||||
libdir=`echo "$libdir/" | sed -e "s%^${orig_installdir}/%${curr_installdir}/%" | sed -e 's,/$,,'`
|
||||
localedir=`echo "$localedir/" | sed -e "s%^${orig_installdir}/%${curr_installdir}/%" | sed -e 's,/$,,'`
|
||||
fi
|
||||
|
||||
# Internationalization.
|
||||
. gettext.sh
|
||||
TEXTDOMAIN=gettext-tools
|
||||
export TEXTDOMAIN
|
||||
TEXTDOMAINDIR="$localedir"
|
||||
export TEXTDOMAINDIR
|
||||
|
||||
# Redirect fileno 3 to interactive I/O.
|
||||
exec 3>/dev/tty
|
||||
|
||||
# Output a prompt.
|
||||
if test $# != 0; then
|
||||
echo "$1" 1>&3
|
||||
fi
|
||||
|
||||
# Find the user name on the local machine.
|
||||
user=`id -u -n 2>/dev/null`
|
||||
if test -z "$user"; then
|
||||
user="$USER"
|
||||
if test -z "$user"; then
|
||||
user="$LOGNAME"
|
||||
if test -z "$user"; then
|
||||
user=unknown
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Find the hostname.
|
||||
# hostname on some systems (SVR3.2, old Linux) returns a bogus exit status,
|
||||
# so uname gets run too, so we keep only the first line of output.
|
||||
#host=`(hostname || uname -n) 2>/dev/null | sed 1q`
|
||||
host=`"$libdir"/gettext/hostname --short 2>/dev/null | sed 1q`
|
||||
|
||||
# Find the hostname.
|
||||
hostfqdn=`"$libdir"/gettext/hostname --fqdn 2>/dev/null | sed 1q`
|
||||
|
||||
# Find a list of email addresses from various mailer configuration files.
|
||||
# All mailers use configuration files under $HOME. We handle them in a
|
||||
# last-modified - first-priority order.
|
||||
cd $HOME
|
||||
files=""
|
||||
|
||||
# ----------------------- BEGIN MAILER SPECIFIC CODE -----------------------
|
||||
|
||||
# Mozilla Thunderbird addresses
|
||||
files="$files .thunderbird/*/prefs.js"
|
||||
|
||||
# Mozilla addresses
|
||||
files="$files .mozilla/*/prefs.js"
|
||||
|
||||
# Netscape 4 addresses
|
||||
files="$files .netscape/liprefs.js .netscape/preferences.js"
|
||||
|
||||
# Netscape 3 addresses
|
||||
files="$files .netscape/preferences"
|
||||
|
||||
# Emacs/XEmacs rmail, Emacs/XEmacs gnus, XEmacs vm addresses
|
||||
# XEmacs mew addresses
|
||||
files="$files .emacs .emacs.el"
|
||||
|
||||
# KDE2 addresses
|
||||
files="$files .kde2/share/config/emaildefaults"
|
||||
|
||||
# KDE kmail addresses
|
||||
files="$files .kde2/share/config/kmailrc"
|
||||
|
||||
# GNOME evolution 2 addresses
|
||||
files="$files .gconf/apps/evolution/mail/%gconf.xml"
|
||||
|
||||
# GNOME evolution 1 addresses
|
||||
files="$files evolution/config.xmldb"
|
||||
|
||||
# GNOME balsa addresses
|
||||
files="$files .gnome/balsa"
|
||||
|
||||
# StarOffice and OpenOffice addresses
|
||||
sed_dos2unix='s/\r$//'
|
||||
sed_soffice51='s,StarOffice 5\.1=\(.*\)$,\1/sofficerc,p'
|
||||
sed_soffice52='s,StarOffice 5\.2=\(.*\)$,\1/user/sofficerc,p'
|
||||
sed_ooffice='s,^OpenOffice[^=]*=\(.*\)$,\1/user/config/registry/instance/org/openoffice/UserProfile.xml,p'
|
||||
files="$files Office51/sofficerc Office52/user/sofficerc "`sed -n -e "$sed_dos2unix" -e "$sed_soffice51" -e "$sed_soffice52" -e "$sed_ooffice" .sversionrc 2>/dev/null | sed -e 's,^file://*,/,'`
|
||||
|
||||
# mutt addresses
|
||||
files="$files .muttrc"
|
||||
|
||||
# pine addresses
|
||||
files="$files .pinerc"
|
||||
|
||||
# xfmail addresses
|
||||
files="$files .xfmail/.xfmailrc"
|
||||
|
||||
# tkrat addresses
|
||||
files="$files .ratatosk/ratatoskrc"
|
||||
|
||||
# ----------------------- END MAILER SPECIFIC CODE -----------------------
|
||||
|
||||
# Expand wildcards and remove nonexistent files from the list.
|
||||
nfiles=""
|
||||
for file in $files; do
|
||||
if test -r "$file" && test ! -d "$file"; then
|
||||
nfiles="$nfiles $file"
|
||||
fi
|
||||
done
|
||||
files="$nfiles"
|
||||
|
||||
addresses=""
|
||||
|
||||
if test -n "$files"; then
|
||||
|
||||
for file in `ls -t $files`; do
|
||||
|
||||
case "$file" in
|
||||
|
||||
# ----------------------- BEGIN MAILER SPECIFIC CODE -----------------------
|
||||
|
||||
# Mozilla and Mozilla Thunderbird addresses
|
||||
.mozilla/*/prefs.js | .thunderbird/*/prefs.js)
|
||||
addresses="$addresses "`grep -h '^user_pref("mail\.identity\..*\.useremail", ".*");$' $file 2>/dev/null | sed -e 's/^user_pref("mail\.identity\..*\.useremail", "\(.*\)");$/\1/'`
|
||||
;;
|
||||
|
||||
# Netscape 4 addresses
|
||||
.netscape/liprefs.js | .netscape/preferences.js)
|
||||
addresses="$addresses "`grep -h '^user_pref("mail\.identity\.useremail", ".*");$' $file 2>/dev/null | sed -e 's/^user_pref("mail\.identity\.useremail", "\(.*\)");$/\1/'`
|
||||
;;
|
||||
|
||||
# Netscape 3 addresses
|
||||
.netscape/preferences)
|
||||
addresses="$addresses "`grep -h '^EMAIL_ADDRESS:' $file 2>/dev/null | sed -e 's/^EMAIL_ADDRESS:[ ]*//'`
|
||||
;;
|
||||
|
||||
.emacs | .emacs.el)
|
||||
# Emacs/XEmacs rmail, Emacs/XEmacs gnus, XEmacs vm addresses
|
||||
addresses="$addresses "`grep -h '[ (]user-mail-address "[^"]*"' $file 2>/dev/null | sed -e 's/^.*[ (]user-mail-address "\([^"]*\)".*$/\1/'`
|
||||
# XEmacs mew addresses
|
||||
domains=`grep -h '[ (]mew-mail-domain "[^"]*"' $file 2>/dev/null | sed -e 's/^.*[ (]mew-mail-domain "\([^"]*\)".*$/\1/'`
|
||||
if test -n "$domains"; then
|
||||
for domain in $domains; do
|
||||
addresses="$addresses ${user}@$domain"
|
||||
done
|
||||
fi
|
||||
;;
|
||||
|
||||
# KDE2 addresses
|
||||
.kde2/share/config/emaildefaults)
|
||||
addresses="$addresses "`grep -h '^EmailAddress=' $file 2>/dev/null | sed -e 's/^EmailAddress=//'`
|
||||
;;
|
||||
|
||||
# KDE kmail addresses
|
||||
.kde2/share/config/kmailrc)
|
||||
addresses="$addresses "`grep -h '^Email Address=' $file 2>/dev/null | sed -e 's/^Email Address=//'`
|
||||
;;
|
||||
|
||||
# GNOME evolution 2 addresses
|
||||
.gconf/apps/evolution/mail/%gconf.xml)
|
||||
sedexpr0='s,^.*<addr-spec>\(.*\)</addr-spec>.*$,\1,p'
|
||||
addresses="$addresses "`sed -n -e "$sedexpr0" < $file`
|
||||
;;
|
||||
|
||||
# GNOME evolution 1 addresses
|
||||
evolution/config.xmldb)
|
||||
sedexpr0='s/^.*<entry name="identity_address_[0-9]*" type="string" value="\([^"]*\)".*$/\1/p'
|
||||
sedexpr1='s/\(..\)/\\x\1/g'
|
||||
sedexpr2='s,$,\\n,'
|
||||
addresses="$addresses "`sed -n -e "$sedexpr0" < $file | while read hexstring; do printf \`echo "$hexstring" | sed -e "$sedexpr1" -e "$sedexpr2"\`; done`
|
||||
;;
|
||||
|
||||
# GNOME balsa addresses
|
||||
.gnome/balsa)
|
||||
addresses="$addresses "`grep -h '^Address=' $file 2>/dev/null | sed -e 's/^Address=//'`
|
||||
;;
|
||||
|
||||
# OpenOffice addresses
|
||||
*/UserProfile.xml)
|
||||
addresses="$addresses "`sed -n -e 's,^.*<mail cfg:type="string">\(.*\)</mail>.*$,\1,p' $file 2>/dev/null`
|
||||
;;
|
||||
|
||||
# StarOffice addresses
|
||||
# Not a typo. They really write "Adress" with a single d.
|
||||
# German orthography...
|
||||
*/sofficerc)
|
||||
addresses="$addresses "`grep -h '^User-Adress=' $file 2>/dev/null | sed -e 's/#[^#]*$//' -e 's/^.*#//'`
|
||||
;;
|
||||
|
||||
# mutt addresses
|
||||
.muttrc)
|
||||
mutt_addresses=`grep -h '^set from="[^"]*"[ ]*$' $file 2>/dev/null | sed -e 's/^set from="\([^"]*\)"[ ]*$/\1/'`
|
||||
if test -n "$mutt_addresses"; then
|
||||
addresses="$addresses $mutt_addresses"
|
||||
else
|
||||
# mutt uses $EMAIL as fallback.
|
||||
if test -n "$EMAIL"; then
|
||||
addresses="$addresses $EMAIL"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
# pine addresses
|
||||
.pinerc)
|
||||
domains=`grep -h '^user-domain=' $file 2>/dev/null | sed -e 's/^user-domain=//'`
|
||||
if test -n "$domains"; then
|
||||
for domain in $domains; do
|
||||
addresses="$addresses ${user}@$domain"
|
||||
done
|
||||
else
|
||||
# The use-only-domain-name option is only used if the user-domain option is not present.
|
||||
domains=`grep -h '^use-only-domain-name=' $file 2>/dev/null | sed -e 's/^use-only-domain-name=//'`
|
||||
if test "Yes" = "$domains"; then
|
||||
addresses="$addresses ${user}@"`echo "$hostfqdn" | sed -e 's/^[^.]*\.//'`
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
# xfmail addresses
|
||||
.xfmail/.xfmailrc)
|
||||
addresses="$addresses "`grep -h '^from=.*<.*>' $file 2>/dev/null | sed -e 's/^.*<\([^<>]*\)>.*$/\1/'`
|
||||
;;
|
||||
|
||||
# tkrat addresses
|
||||
.ratatosk/ratatoskrc)
|
||||
domains=`grep -h '^set option(masquerade_as) ' $file 2>/dev/null | sed -e 's/^set option(masquerade_as) //'`
|
||||
if test -n "$domains"; then
|
||||
for domain in $domains; do
|
||||
addresses="$addresses ${user}@$domain"
|
||||
done
|
||||
else
|
||||
# The domain option is used only if the masquerade_as option is not present.
|
||||
domains=`grep -h '^set option(domain) ' $file 2>/dev/null | sed -e 's/^set option(domain) //'`
|
||||
if test -n "$domains"; then
|
||||
for domain in $domains; do
|
||||
addresses="$addresses ${user}@${host}.$domain"
|
||||
done
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
|
||||
# ----------------------- END MAILER SPECIFIC CODE -----------------------
|
||||
|
||||
esac
|
||||
|
||||
done
|
||||
|
||||
fi
|
||||
|
||||
# Some Debian systems have a file /etc/mailname.
|
||||
if test -r /etc/mailname; then
|
||||
hostmailname=`cat /etc/mailname`
|
||||
if test -n "$hostmailname"; then
|
||||
addresses="$addresses ${user}@$hostmailname"
|
||||
fi
|
||||
fi
|
||||
|
||||
# SuSE Linux >= 8.0 systems have a file /etc/sysconfig/mail.
|
||||
if test -r /etc/sysconfig/mail; then
|
||||
hostmailname=`. /etc/sysconfig/mail && echo "$FROM_HEADER"`
|
||||
if test -n "$hostmailname"; then
|
||||
addresses="$addresses ${user}@$hostmailname"
|
||||
fi
|
||||
fi
|
||||
|
||||
# elm has no user-defined addresses.
|
||||
# mailx has no user-defined addresses.
|
||||
# mh has no user-defined addresses.
|
||||
# They use the system default.
|
||||
addresses="$addresses ${user}@$hostfqdn"
|
||||
|
||||
# Normalize addresses: remove addresses without @, lowercase the part after @,
|
||||
# and remove duplicates.
|
||||
lowercase_sed='{
|
||||
h
|
||||
s/^[^@]*@\(.*\)$/\1/
|
||||
y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/
|
||||
x
|
||||
s/^\([^@]*\)@.*/\1@/
|
||||
G
|
||||
s/\
|
||||
//
|
||||
p
|
||||
}'
|
||||
naddresses=""
|
||||
for addr in $addresses; do
|
||||
case "$addr" in
|
||||
"<"*">") addr=`echo "$addr" | sed -e 's/^<//' -e 's/>$//'` ;;
|
||||
esac
|
||||
case "$addr" in
|
||||
*@*)
|
||||
addr=`echo "$addr" | sed -n -e "$lowercase_sed"`
|
||||
case " $naddresses " in
|
||||
*" $addr "*) ;;
|
||||
*) naddresses="$naddresses $addr" ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
done
|
||||
addresses="$naddresses"
|
||||
|
||||
# Now it's time to ask the user.
|
||||
case "$addresses" in
|
||||
" "*" "*)
|
||||
# At least two addresses.
|
||||
lines=""
|
||||
i=0
|
||||
for addr in $addresses; do
|
||||
i=`expr $i + 1`
|
||||
lines="${lines}${i} ${addr}
|
||||
"
|
||||
done
|
||||
while true; do
|
||||
{ gettext "Which is your email address?"; echo; } 1>&3
|
||||
echo "$lines" 1>&3
|
||||
{ gettext "Please choose the number, or enter your email address."; echo; } 1>&3
|
||||
read answer < /dev/tty
|
||||
case "$answer" in
|
||||
*@*) ;;
|
||||
[0-9]*)
|
||||
i=0
|
||||
for addr in $addresses; do
|
||||
i=`expr $i + 1`
|
||||
if test "$i" = "$answer"; then
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
;;
|
||||
esac
|
||||
case "$answer" in
|
||||
"<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
||||
esac
|
||||
case "$answer" in
|
||||
*" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
||||
*@*.*) ;;
|
||||
*@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
||||
*) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
||||
esac
|
||||
addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
||||
break
|
||||
done
|
||||
;;
|
||||
" "*)
|
||||
# One address.
|
||||
while true; do
|
||||
{ gettext "Is the following your email address?"; echo; } 1>&3
|
||||
echo " $addresses" 1>&3
|
||||
{ gettext "Please confirm by pressing Return, or enter your email address."; echo; } 1>&3
|
||||
read answer < /dev/tty
|
||||
if test -z "$answer"; then
|
||||
addr=`echo "$addresses" | sed -e 's/^ //'`
|
||||
break
|
||||
fi
|
||||
case "$answer" in
|
||||
"<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
||||
esac
|
||||
case "$answer" in
|
||||
*" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
||||
*@*.*) ;;
|
||||
*@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
||||
*) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
||||
esac
|
||||
addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
||||
break
|
||||
done
|
||||
;;
|
||||
"")
|
||||
# No address.
|
||||
{ gettext "Couldn't find out about your email address."; echo; } 1>&3
|
||||
while true; do
|
||||
{ gettext "Please enter your email address."; echo; } 1>&3
|
||||
read answer < /dev/tty
|
||||
case "$answer" in
|
||||
"<"*">") answer=`echo "$answer" | sed -e 's/^<//' -e 's/>$//'` ;;
|
||||
esac
|
||||
case "$answer" in
|
||||
*" "*) { gettext "Invalid email address: invalid character."; echo; echo; } 1>&3 ; continue ;;
|
||||
*@*.*) ;;
|
||||
*@*) { gettext "Invalid email address: need a fully qualified host name or domain name."; echo; echo; } 1>&3 ; continue ;;
|
||||
*) { gettext "Invalid email address: missing @"; echo; echo; } 1>&3 ; continue ;;
|
||||
esac
|
||||
addr=`echo "$answer" | sed -n -e "$lowercase_sed"`
|
||||
break
|
||||
done
|
||||
;;
|
||||
*) echo "internal error" 1>&3 ; exit 1 ;;
|
||||
esac
|
||||
|
||||
# Print to standard output.
|
||||
echo "$addr"
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,589 +0,0 @@
|
||||
# vim: ft=make
|
||||
#
|
||||
# Makefile.cfg for SRB2
|
||||
#
|
||||
|
||||
#
|
||||
# GNU compiler & tools' flags
|
||||
# and other things
|
||||
#
|
||||
|
||||
# See the following variable don't start with 'GCC'. This is
|
||||
# to avoid a false positive with the version detection...
|
||||
|
||||
SUPPORTED_GCC_VERSIONS:=\
|
||||
151 150 15\
|
||||
142 141 140 14\
|
||||
132 131 130 13\
|
||||
123 122 121 120 12\
|
||||
114 113 112 111 110 11\
|
||||
105 104 103 102 101 100 10\
|
||||
95 94 93 92 91 90\
|
||||
85 84 83 82 81 80\
|
||||
75 74 73 72 71 70\
|
||||
64 63 62 61 60\
|
||||
55 54 53 52 51 50\
|
||||
49 48 47 46 45 44 43 42 41 40
|
||||
|
||||
LATEST_GCC_VERSION=14.2.1
|
||||
|
||||
# gcc or g++
|
||||
ifdef PREFIX
|
||||
CC:=$(PREFIX)-gcc
|
||||
CXX:=$(PREFIX)-g++
|
||||
OBJCOPY?=$(PREFIX)-objcopy
|
||||
OBJDUMP?=$(PREFIX)-objdump
|
||||
STRIP?=$(PREFIX)-strip
|
||||
WINDRES?=$(PREFIX)-windres
|
||||
else
|
||||
OBJCOPY?=objcopy
|
||||
OBJDUMP?=objdump
|
||||
STRIP?=strip
|
||||
WINDRES?=windres
|
||||
endif
|
||||
|
||||
# because Apple screws with us on this
|
||||
# need to get bintools from homebrew
|
||||
ifdef MACOSX
|
||||
CC=clang
|
||||
CXX=clang
|
||||
OBJCOPY=gobjcopy
|
||||
OBJDUMP=gobjdump
|
||||
endif
|
||||
|
||||
# Automatically set version flag, but not if one was manually set
|
||||
ifeq (,$(filter GCC%,$(.VARIABLES)))
|
||||
version:=$(shell $(CC) --version)
|
||||
# check if this is in fact GCC
|
||||
ifneq (,$(or $(findstring gcc,$(version)),$(findstring GCC,$(version))))
|
||||
shellversion:=$(shell $(CC) -dumpversion)
|
||||
|
||||
# Try to remove "-win32"
|
||||
version:=$(subst -win32,.0,$(shellversion))
|
||||
|
||||
# Turn version into words of major, minor
|
||||
v:=$(subst ., ,$(version))
|
||||
# concat. major minor
|
||||
v:=$(word 1,$(v))$(word 2,$(v))
|
||||
|
||||
# If this version is not in the list, default to the latest supported
|
||||
ifeq (,$(filter $(v),$(SUPPORTED_GCC_VERSIONS)))
|
||||
$(info\
|
||||
Your compiler version, GCC $(version), is not supported by the Makefile.\
|
||||
The Makefile will assume GCC $(LATEST_GCC_VERSION).)
|
||||
GCC$(subst .,,$(LATEST_GCC_VERSION))=1
|
||||
else
|
||||
$(info Detected GCC $(version) (GCC$(v)))
|
||||
GCC$(v)=1
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef GCC151
|
||||
GCC150=1
|
||||
endif
|
||||
|
||||
ifdef GCC15
|
||||
GCC150=1
|
||||
endif
|
||||
|
||||
ifdef GCC150
|
||||
GCC142=1
|
||||
endif
|
||||
|
||||
ifdef GCC142
|
||||
GCC141=1
|
||||
endif
|
||||
|
||||
ifdef GCC141
|
||||
GCC140=1
|
||||
endif
|
||||
|
||||
ifdef GCC14
|
||||
GCC140=1
|
||||
endif
|
||||
|
||||
ifdef GCC140
|
||||
GCC132=1
|
||||
endif
|
||||
|
||||
ifdef GCC132
|
||||
GCC131=1
|
||||
endif
|
||||
|
||||
ifdef GCC131
|
||||
GCC130=1
|
||||
endif
|
||||
|
||||
ifdef GCC13
|
||||
GCC130=1
|
||||
endif
|
||||
|
||||
ifdef GCC130
|
||||
GCC123=1
|
||||
endif
|
||||
|
||||
ifdef GCC123
|
||||
GCC122=1
|
||||
endif
|
||||
|
||||
ifdef GCC122
|
||||
GCC121=1
|
||||
endif
|
||||
|
||||
ifdef GCC121
|
||||
GCC120=1
|
||||
endif
|
||||
|
||||
ifdef GCC12
|
||||
GCC120=1
|
||||
endif
|
||||
|
||||
ifdef GCC120
|
||||
GCC114=1
|
||||
endif
|
||||
|
||||
ifdef GCC114
|
||||
GCC113=1
|
||||
endif
|
||||
|
||||
ifdef GCC113
|
||||
GCC112=1
|
||||
endif
|
||||
|
||||
ifdef GCC112
|
||||
GCC111=1
|
||||
endif
|
||||
|
||||
ifdef GCC111
|
||||
GCC110=1
|
||||
endif
|
||||
|
||||
ifdef GCC11
|
||||
GCC110=1
|
||||
endif
|
||||
|
||||
ifdef GCC110
|
||||
GCC105=1
|
||||
endif
|
||||
|
||||
ifdef GCC105
|
||||
GCC104=1
|
||||
endif
|
||||
|
||||
ifdef GCC104
|
||||
GCC103=1
|
||||
endif
|
||||
|
||||
ifdef GCC103
|
||||
GCC102=1
|
||||
endif
|
||||
|
||||
ifdef GCC102
|
||||
GCC101=1
|
||||
endif
|
||||
|
||||
ifdef GCC101
|
||||
GCC100=1
|
||||
endif
|
||||
|
||||
ifdef GCC10
|
||||
GCC100=1
|
||||
endif
|
||||
|
||||
ifdef GCC100
|
||||
GCC93=1
|
||||
endif
|
||||
|
||||
ifdef GCC95
|
||||
GCC94=1
|
||||
endif
|
||||
|
||||
ifdef GCC94
|
||||
GCC93=1
|
||||
endif
|
||||
|
||||
ifdef GCC93
|
||||
GCC92=1
|
||||
endif
|
||||
|
||||
ifdef GCC92
|
||||
GCC91=1
|
||||
endif
|
||||
|
||||
ifdef GCC91
|
||||
GCC90=1
|
||||
endif
|
||||
|
||||
ifdef GCC90
|
||||
GCC85=1
|
||||
endif
|
||||
|
||||
ifdef GCC85
|
||||
GCC84=1
|
||||
endif
|
||||
|
||||
ifdef GCC84
|
||||
GCC83=1
|
||||
endif
|
||||
|
||||
ifdef GCC83
|
||||
GCC82=1
|
||||
endif
|
||||
|
||||
ifdef GCC82
|
||||
GCC81=1
|
||||
endif
|
||||
|
||||
ifdef GCC81
|
||||
GCC80=1
|
||||
endif
|
||||
|
||||
ifdef GCC80
|
||||
GCC75=1
|
||||
endif
|
||||
|
||||
ifdef GCC75
|
||||
GCC74=1
|
||||
endif
|
||||
|
||||
ifdef GCC74
|
||||
GCC73=1
|
||||
endif
|
||||
|
||||
ifdef GCC73
|
||||
GCC72=1
|
||||
endif
|
||||
|
||||
ifdef GCC72
|
||||
GCC71=1
|
||||
endif
|
||||
|
||||
ifdef GCC71
|
||||
GCC70=1
|
||||
endif
|
||||
|
||||
ifdef GCC70
|
||||
GCC64=1
|
||||
endif
|
||||
|
||||
ifdef GCC64
|
||||
GCC63=1
|
||||
endif
|
||||
|
||||
ifdef GCC63
|
||||
GCC62=1
|
||||
endif
|
||||
|
||||
ifdef GCC62
|
||||
GCC61=1
|
||||
endif
|
||||
|
||||
ifdef GCC61
|
||||
GCC60=1
|
||||
endif
|
||||
|
||||
ifdef GCC60
|
||||
GCC55=1
|
||||
endif
|
||||
|
||||
ifdef GCC55
|
||||
GCC54=1
|
||||
endif
|
||||
|
||||
ifdef GCC54
|
||||
GCC53=1
|
||||
endif
|
||||
|
||||
ifdef GCC53
|
||||
GCC52=1
|
||||
endif
|
||||
|
||||
ifdef GCC52
|
||||
GCC51=1
|
||||
endif
|
||||
|
||||
ifdef GCC51
|
||||
GCC50=1
|
||||
endif
|
||||
|
||||
ifdef GCC50
|
||||
GCC49=1
|
||||
endif
|
||||
|
||||
ifdef GCC49
|
||||
GCC48=1
|
||||
endif
|
||||
|
||||
ifdef GCC48
|
||||
GCC47=1
|
||||
endif
|
||||
|
||||
ifdef GCC47
|
||||
GCC46=1
|
||||
endif
|
||||
|
||||
ifdef GCC46
|
||||
GCC45=1
|
||||
endif
|
||||
|
||||
ifdef GCC45
|
||||
GCC44=1
|
||||
endif
|
||||
|
||||
ifdef GCC44
|
||||
GCC43=1
|
||||
endif
|
||||
|
||||
ifdef GCC43
|
||||
GCC42=1
|
||||
endif
|
||||
|
||||
ifdef GCC42
|
||||
GCC41=1
|
||||
endif
|
||||
|
||||
ifdef GCC41
|
||||
GCC40=1
|
||||
VCHELP=1
|
||||
endif
|
||||
|
||||
ifdef GCC295
|
||||
GCC29=1
|
||||
endif
|
||||
|
||||
OLDWFLAGS:=$(WFLAGS)
|
||||
# -W -Wno-unused
|
||||
WFLAGS=-Wall
|
||||
ifndef GCC295
|
||||
#WFLAGS+=-Wno-packed
|
||||
endif
|
||||
ifndef RELAXWARNINGS
|
||||
WFLAGS+=-W
|
||||
#WFLAGS+=-Wno-sign-compare
|
||||
ifndef GCC295
|
||||
WFLAGS+=-Wno-div-by-zero
|
||||
endif
|
||||
#WFLAGS+=-Wsystem-headers
|
||||
WFLAGS+=-Wfloat-equal
|
||||
#WFLAGS+=-Wtraditional
|
||||
ifdef VCHELP
|
||||
#WFLAGS+=-Wdeclaration-after-statement
|
||||
WFLAGS+=-Wno-error=declaration-after-statement
|
||||
endif
|
||||
WFLAGS+=-Wundef
|
||||
ifndef GCC295
|
||||
WFLAGS+=-Wendif-labels
|
||||
endif
|
||||
ifdef GCC41
|
||||
WFLAGS+=-Wshadow
|
||||
endif
|
||||
#WFLAGS+=-Wlarger-than-%len%
|
||||
WFLAGS+=-Wpointer-arith -Wbad-function-cast
|
||||
ifdef GCC45
|
||||
#WFLAGS+=-Wc++-compat
|
||||
endif
|
||||
WFLAGS+=-Wcast-qual
|
||||
ifndef NOCASTALIGNWARN
|
||||
WFLAGS+=-Wcast-align
|
||||
endif
|
||||
WFLAGS+=-Wwrite-strings
|
||||
ifndef ERRORMODE
|
||||
#WFLAGS+=-Wconversion
|
||||
ifdef GCC43
|
||||
#WFLAGS+=-Wno-sign-conversion
|
||||
endif
|
||||
endif
|
||||
WFLAGS+=-Wsign-compare
|
||||
ifdef GCC45
|
||||
WFLAGS+=-Wlogical-op
|
||||
endif
|
||||
WFLAGS+=-Waggregate-return
|
||||
ifdef HAIKU
|
||||
ifdef GCC41
|
||||
#WFLAGS+=-Wno-attributes
|
||||
endif
|
||||
endif
|
||||
#WFLAGS+=-Wstrict-prototypes
|
||||
ifdef GCC40
|
||||
WFLAGS+=-Wold-style-definition
|
||||
endif
|
||||
WFLAGS+=-Wmissing-prototypes -Wmissing-declarations
|
||||
ifdef GCC40
|
||||
WFLAGS+=-Wmissing-field-initializers
|
||||
endif
|
||||
WFLAGS+=-Wmissing-noreturn
|
||||
#WFLAGS+=-Wmissing-format-attribute
|
||||
#WFLAGS+=-Wno-multichar
|
||||
#WFLAGS+=-Wno-deprecated-declarations
|
||||
#WFLAGS+=-Wpacked
|
||||
#WFLAGS+=-Wpadded
|
||||
#WFLAGS+=-Wredundant-decls
|
||||
WFLAGS+=-Wnested-externs
|
||||
#WFLAGS+=-Wunreachable-code
|
||||
WFLAGS+=-Winline
|
||||
ifdef GCC43
|
||||
WFLAGS+=-funit-at-a-time
|
||||
WFLAGS+=-Wlogical-op
|
||||
endif
|
||||
ifndef GCC295
|
||||
WFLAGS+=-Wdisabled-optimization
|
||||
endif
|
||||
endif
|
||||
WFLAGS+=-Wformat-y2k
|
||||
ifdef GCC71
|
||||
WFLAGS+=-Wno-error=format-overflow=2
|
||||
endif
|
||||
WFLAGS+=-Wformat-security
|
||||
ifndef GCC29
|
||||
#WFLAGS+=-Winit-self
|
||||
endif
|
||||
ifdef GCC46
|
||||
WFLAGS+=-Wno-suggest-attribute=noreturn
|
||||
endif
|
||||
|
||||
ifdef NOLDWARNING
|
||||
LDFLAGS+=-Wl,--as-needed
|
||||
endif
|
||||
|
||||
ifdef ERRORMODE
|
||||
WFLAGS+=-Werror
|
||||
endif
|
||||
|
||||
WFLAGS+=$(OLDWFLAGS)
|
||||
|
||||
ifdef GCC43
|
||||
#WFLAGS+=-Wno-error=clobbered
|
||||
endif
|
||||
ifdef GCC44
|
||||
WFLAGS+=-Wno-error=array-bounds
|
||||
endif
|
||||
ifdef GCC46
|
||||
WFLAGS+=-Wno-error=suggest-attribute=noreturn
|
||||
endif
|
||||
ifdef GCC54
|
||||
WFLAGS+=-Wno-logical-op -Wno-error=logical-op
|
||||
endif
|
||||
ifdef GCC61
|
||||
WFLAGS+=-Wno-tautological-compare -Wno-error=tautological-compare
|
||||
endif
|
||||
ifdef GCC71
|
||||
WFLAGS+=-Wno-error=implicit-fallthrough
|
||||
WFLAGS+=-Wno-implicit-fallthrough
|
||||
WFLAGS+=-Wno-format-truncation
|
||||
endif
|
||||
ifdef GCC81
|
||||
WFLAGS+=-Wno-error=format-overflow
|
||||
WFLAGS+=-Wno-error=stringop-truncation
|
||||
WFLAGS+=-Wno-error=stringop-overflow
|
||||
WFLAGS+=-Wno-format-overflow
|
||||
WFLAGS+=-Wno-stringop-truncation
|
||||
WFLAGS+=-Wno-stringop-overflow
|
||||
WFLAGS+=-Wno-error=multistatement-macros
|
||||
endif
|
||||
|
||||
#indicate platform and what interface use with
|
||||
ifndef LINUX
|
||||
ifndef FREEBSD
|
||||
ifndef CYGWIN32
|
||||
ifndef MINGW
|
||||
ifndef MINGW64
|
||||
ifndef SDL
|
||||
$(error No interface or platform flag defined)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
#determine the interface directory (where you put all i_*.c)
|
||||
i_net_o=$(OBJDIR)/i_net.o
|
||||
i_system_o=$(OBJDIR)/i_system.o
|
||||
i_sound_o=$(OBJDIR)/i_sound.o
|
||||
i_main_o=$(OBJDIR)/i_main.o
|
||||
#set OBJDIR and BIN's starting place
|
||||
OBJDIR=../objs
|
||||
BIN=../bin
|
||||
REMOVE?=rm -f
|
||||
CP?=cp
|
||||
MKDIR?=mkdir -p
|
||||
MKISOFS?=mkisofs
|
||||
DD?=dd
|
||||
GZIP?=gzip
|
||||
GZIP_OPTS?=-9 -f -n
|
||||
GZIP_OPT2=$(GZIP_OPTS) --rsyncable
|
||||
UPX?=upx
|
||||
UPX_OPTS?=--best --preserve-build-id
|
||||
ifndef ECHO
|
||||
UPX_OPTS+=-q
|
||||
endif
|
||||
|
||||
#Interface Setup
|
||||
ifdef LINUX
|
||||
SDL=1
|
||||
ifdef LINUX64
|
||||
OBJDIR:=$(OBJDIR)/Linux64
|
||||
BIN:=$(BIN)/Linux64
|
||||
else
|
||||
OBJDIR:=$(OBJDIR)/Linux
|
||||
BIN:=$(BIN)/Linux
|
||||
endif
|
||||
else
|
||||
ifdef FREEBSD
|
||||
INTERFACE=sdl
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/FreeBSD
|
||||
BIN:=$(BIN)/FreeBSD
|
||||
else
|
||||
ifdef SOLARIS
|
||||
INTERFACE=sdl
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/Solaris
|
||||
BIN:=$(BIN)/Solaris
|
||||
else
|
||||
ifdef CYGWIN32
|
||||
INTERFACE=sdl
|
||||
SDL=1
|
||||
|
||||
OBJDIR:=$(OBJDIR)/cygwin
|
||||
BIN:=$(BIN)/Cygwin
|
||||
else
|
||||
ifdef MINGW64
|
||||
INTERFACE=win32
|
||||
OBJDIR:=$(OBJDIR)/Mingw64
|
||||
BIN:=$(BIN)/Mingw64
|
||||
else
|
||||
ifdef MINGW
|
||||
INTERFACE=win32
|
||||
OBJDIR:=$(OBJDIR)/Mingw
|
||||
BIN:=$(BIN)/Mingw
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef ARCHNAME
|
||||
OBJDIR:=$(OBJDIR)/$(ARCHNAME)
|
||||
BIN:=$(BIN)/$(ARCHNAME)
|
||||
endif
|
||||
|
||||
OBJDUMP_OPTS?=--wide --source --line-numbers
|
||||
LD=$(CC)
|
||||
|
||||
ifdef SDL
|
||||
INTERFACE=sdl
|
||||
OBJDIR:=$(OBJDIR)/SDL
|
||||
endif
|
||||
|
||||
ifdef DEBUGMODE
|
||||
OBJDIR:=$(OBJDIR)/Debug
|
||||
BIN:=$(BIN)/Debug
|
||||
else
|
||||
OBJDIR:=$(OBJDIR)/Release
|
||||
BIN:=$(BIN)/Release
|
||||
endif
|
||||
@@ -324,6 +324,7 @@ static void AM_initVariables(void)
|
||||
m_x = (plr->mo->x >> FRACTOMAPBITS) - m_w/2;
|
||||
m_y = (plr->mo->y >> FRACTOMAPBITS) - m_h/2;
|
||||
}
|
||||
|
||||
AM_changeWindowLoc();
|
||||
|
||||
// for saving & restoring
|
||||
|
||||
+5
-5
@@ -133,26 +133,26 @@ LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) {
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) {
|
||||
if (!lua_checkstack(L, space))
|
||||
if (l_unlikely(!lua_checkstack(L, space)))
|
||||
luaL_error(L, "stack overflow (%s)", mes);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) {
|
||||
if (lua_type(L, narg) != t)
|
||||
if (l_unlikely(lua_type(L, narg) != t))
|
||||
tag_error(L, narg, t);
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API void luaL_checkany (lua_State *L, int narg) {
|
||||
if (lua_type(L, narg) == LUA_TNONE)
|
||||
if (l_unlikely(lua_type(L, narg) == LUA_TNONE))
|
||||
luaL_argerror(L, narg, "value expected");
|
||||
}
|
||||
|
||||
|
||||
LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) {
|
||||
const char *s = lua_tolstring(L, narg, len);
|
||||
if (!s) tag_error(L, narg, LUA_TSTRING);
|
||||
if (l_unlikely(!s)) tag_error(L, narg, LUA_TSTRING);
|
||||
return s;
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ LUALIB_API const char *luaL_optlstring (lua_State *L, int narg,
|
||||
|
||||
LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) {
|
||||
lua_Number d = lua_tonumber(L, narg);
|
||||
if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */
|
||||
if (l_unlikely(d == 0 && !lua_isnumber(L, narg))) /* avoid extra test when d is not 0 */
|
||||
tag_error(L, narg, LUA_TNUMBER);
|
||||
return d;
|
||||
}
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ LUALIB_API const char *(luaL_findtable) (lua_State *L, int idx,
|
||||
*/
|
||||
|
||||
#define luaL_argcheck(L, cond,numarg,extramsg) \
|
||||
((void)((cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
((void)(l_likely(cond) || luaL_argerror(L, (numarg), (extramsg))))
|
||||
#define luaL_checkstring(L,n) (luaL_checklstring(L, (n), NULL))
|
||||
#define luaL_optstring(L,n,d) (luaL_optlstring(L, (n), (d), NULL))
|
||||
#define luaL_checkint(L,n) ((int)luaL_checkinteger(L, (n)))
|
||||
|
||||
+9
-9
@@ -106,7 +106,7 @@ static int luaB_setmetatable (lua_State *L) {
|
||||
luaL_checktype(L, 1, LUA_TTABLE);
|
||||
luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2,
|
||||
"nil or table expected");
|
||||
if (luaL_getmetafield(L, 1, "__metatable"))
|
||||
if (l_unlikely(luaL_getmetafield(L, 1, "__metatable")))
|
||||
luaL_error(L, "cannot change a protected metatable");
|
||||
lua_settop(L, 2);
|
||||
lua_setmetatable(L, 1);
|
||||
@@ -120,10 +120,10 @@ static void getfunc (lua_State *L, int opt) {
|
||||
lua_Debug ar;
|
||||
int level = opt ? luaL_optint(L, 1, 1) : luaL_checkint(L, 1);
|
||||
luaL_argcheck(L, level >= 0, 1, "level must be non-negative");
|
||||
if (lua_getstack(L, level, &ar) == 0)
|
||||
if (l_unlikely(lua_getstack(L, level, &ar) == 0))
|
||||
luaL_argerror(L, 1, "invalid level");
|
||||
lua_getinfo(L, "f", &ar);
|
||||
if (lua_isnil(L, -1))
|
||||
if (l_unlikely(lua_isnil(L, -1)))
|
||||
luaL_error(L, "no function environment for tail call at level %d",
|
||||
level);
|
||||
}
|
||||
@@ -151,7 +151,7 @@ static int luaB_setfenv (lua_State *L) {
|
||||
lua_setfenv(L, -2);
|
||||
return 0;
|
||||
}
|
||||
else if (lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0)
|
||||
else if (l_unlikely(lua_iscfunction(L, -2) || lua_setfenv(L, -2) == 0))
|
||||
luaL_error(L,
|
||||
LUA_QL("setfenv") " cannot change environment of given object");
|
||||
return 1;
|
||||
@@ -265,7 +265,7 @@ static int luaB_ipairs (lua_State *L) {
|
||||
|
||||
static int luaB_assert (lua_State *L) {
|
||||
luaL_checkany(L, 1);
|
||||
if (!lua_toboolean(L, 1))
|
||||
if (l_unlikely(!lua_toboolean(L, 1)))
|
||||
return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!"));
|
||||
return lua_gettop(L);
|
||||
}
|
||||
@@ -278,7 +278,7 @@ static int luaB_unpack (lua_State *L) {
|
||||
e = luaL_opt(L, luaL_checkint, 3, luaL_getn(L, 1));
|
||||
if (i > e) return 0; /* empty range */
|
||||
n = e - i + 1; /* number of elements */
|
||||
if (n <= 0 || !lua_checkstack(L, n)) /* n <= 0 means arith. overflow */
|
||||
if (l_unlikely(n <= 0 || !lua_checkstack(L, n))) /* n <= 0 means arith. overflow */
|
||||
return luaL_error(L, "too many results to unpack");
|
||||
lua_rawgeti(L, 1, i); /* push arg[i] (avoiding overflow problems) */
|
||||
while (i++ < e) /* push arg[i + 1...e] */
|
||||
@@ -445,9 +445,9 @@ static int luaB_costatus (lua_State *L) {
|
||||
|
||||
static int auxresume (lua_State *L, lua_State *co, int narg) {
|
||||
int status = costatus(L, co);
|
||||
if (!lua_checkstack(co, narg))
|
||||
if (l_unlikely(!lua_checkstack(co, narg)))
|
||||
luaL_error(L, "too many arguments to resume");
|
||||
if (status != CO_SUS) {
|
||||
if (l_unlikely(status != CO_SUS)) {
|
||||
lua_pushfstring(L, "cannot resume %s coroutine", statnames[status]);
|
||||
return -1; /* error flag */
|
||||
}
|
||||
@@ -456,7 +456,7 @@ static int auxresume (lua_State *L, lua_State *co, int narg) {
|
||||
status = lua_resume(co, narg);
|
||||
if (status == 0 || status == LUA_YIELD) {
|
||||
int nres = lua_gettop(co);
|
||||
if (!lua_checkstack(L, nres + 1))
|
||||
if (l_unlikely(!lua_checkstack(L, nres + 1)))
|
||||
luaL_error(L, "too many results to resume");
|
||||
lua_xmove(co, L, nres); /* move yielded values */
|
||||
return nres;
|
||||
|
||||
+2
-2
@@ -73,7 +73,7 @@ static int db_getinfo (lua_State *L) {
|
||||
}
|
||||
else
|
||||
return luaL_argerror(L, arg+1, "function or level expected");
|
||||
if (!lua_getinfo(L1, options, &ar))
|
||||
if (l_unlikely(!lua_getinfo(L1, options, &ar)))
|
||||
return luaL_argerror(L, arg+2, "invalid option");
|
||||
lua_createtable(L, 0, 2);
|
||||
if (strchr(options, 'S')) {
|
||||
@@ -104,7 +104,7 @@ static int db_getlocal (lua_State *L) {
|
||||
lua_State *L1 = getthread(L, &arg);
|
||||
lua_Debug ar;
|
||||
const char *name;
|
||||
if (!lua_getstack(L1, luaL_checkint(L, arg+1), &ar)) /* out of range? */
|
||||
if (l_unlikely(!lua_getstack(L1, luaL_checkint(L, arg+1), &ar))) /* out of range? */
|
||||
return luaL_argerror(L, arg+1, "level out of range");
|
||||
name = lua_getlocal(L1, &ar, luaL_checkint(L, arg+2));
|
||||
if (name) {
|
||||
|
||||
+13
-13
@@ -172,7 +172,7 @@ void luaD_reallocCI (lua_State *L, int newsize) {
|
||||
|
||||
|
||||
void luaD_growstack (lua_State *L, int n) {
|
||||
if (n <= L->stacksize) /* double size is enough? */
|
||||
if (l_likely(n <= L->stacksize)) /* double size is enough? */
|
||||
luaD_reallocstack(L, 2*L->stacksize);
|
||||
else
|
||||
luaD_reallocstack(L, L->stacksize + n);
|
||||
@@ -180,11 +180,11 @@ void luaD_growstack (lua_State *L, int n) {
|
||||
|
||||
|
||||
static CallInfo *growCI (lua_State *L) {
|
||||
if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */
|
||||
if (l_unlikely(L->size_ci > LUAI_MAXCALLS)) /* overflow while handling overflow? */
|
||||
luaD_throw(L, LUA_ERRERR);
|
||||
else {
|
||||
luaD_reallocCI(L, 2*L->size_ci);
|
||||
if (L->size_ci > LUAI_MAXCALLS)
|
||||
if (l_unlikely(L->size_ci > LUAI_MAXCALLS))
|
||||
luaG_runerror(L, "stack overflow");
|
||||
}
|
||||
return ++L->ci;
|
||||
@@ -257,7 +257,7 @@ static StkId tryfuncTM (lua_State *L, StkId func) {
|
||||
const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL);
|
||||
StkId p;
|
||||
ptrdiff_t funcr = savestack(L, func);
|
||||
if (!ttisfunction(tm))
|
||||
if (l_unlikely(!ttisfunction(tm)))
|
||||
luaG_typeerror(L, func, "call");
|
||||
/* Open a hole inside the stack at `func' */
|
||||
for (p = L->top; p > func; p--) setobjs2s(L, p, p-1);
|
||||
@@ -356,7 +356,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
|
||||
StkId res;
|
||||
int wanted, i;
|
||||
CallInfo *ci;
|
||||
if (L->hookmask & LUA_MASKRET)
|
||||
if (l_unlikely(L->hookmask) & LUA_MASKRET)
|
||||
firstResult = callrethooks(L, firstResult);
|
||||
ci = L->ci--;
|
||||
res = ci->func; /* res == final position of 1st result */
|
||||
@@ -380,7 +380,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) {
|
||||
** function position.
|
||||
*/
|
||||
void luaD_call (lua_State *L, StkId func, int nResults) {
|
||||
if (++L->nCcalls >= LUAI_MAXCCALLS) {
|
||||
if (l_unlikely(++L->nCcalls >= LUAI_MAXCCALLS)) {
|
||||
if (L->nCcalls == LUAI_MAXCCALLS)
|
||||
luaG_runerror(L, "C stack overflow");
|
||||
else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3)))
|
||||
@@ -430,15 +430,15 @@ static int resume_error (lua_State *L, const char *msg) {
|
||||
LUA_API int lua_resume (lua_State *L, int nargs) {
|
||||
int status;
|
||||
lua_lock(L);
|
||||
if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci))
|
||||
if (l_unlikely(L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)))
|
||||
return resume_error(L, "cannot resume non-suspended coroutine");
|
||||
if (L->nCcalls >= LUAI_MAXCCALLS)
|
||||
if (l_unlikely(L->nCcalls >= LUAI_MAXCCALLS))
|
||||
return resume_error(L, "C stack overflow");
|
||||
luai_userstateresume(L, nargs);
|
||||
lua_assert(L->errfunc == 0);
|
||||
L->baseCcalls = ++L->nCcalls;
|
||||
status = luaD_rawrunprotected(L, resume, L->top - nargs);
|
||||
if (status != 0) { /* error? */
|
||||
if (l_unlikely(status != 0)) { /* error? */
|
||||
L->status = cast_byte(status); /* mark thread as `dead' */
|
||||
luaD_seterrorobj(L, status, L->top);
|
||||
L->ci->top = L->top;
|
||||
@@ -456,7 +456,7 @@ LUA_API int lua_resume (lua_State *L, int nargs) {
|
||||
LUA_API int lua_yield (lua_State *L, int nresults) {
|
||||
luai_userstateyield(L, nresults);
|
||||
lua_lock(L);
|
||||
if (L->nCcalls > L->baseCcalls)
|
||||
if (l_unlikely(L->nCcalls > L->baseCcalls))
|
||||
luaG_runerror(L, "attempt to yield across metamethod/C-call boundary");
|
||||
L->base = L->top - nresults; /* protect stack slots below */
|
||||
L->status = LUA_YIELD;
|
||||
@@ -474,7 +474,7 @@ int luaD_pcall (lua_State *L, Pfunc func, void *u,
|
||||
ptrdiff_t old_errfunc = L->errfunc;
|
||||
L->errfunc = ef;
|
||||
status = luaD_rawrunprotected(L, func, u);
|
||||
if (status != 0) { /* an error occurred? */
|
||||
if (l_unlikely(status != 0)) { /* an error occurred? */
|
||||
StkId oldtop = restorestack(L, old_top);
|
||||
luaF_close(L, oldtop); /* close eventual pending closures */
|
||||
luaD_seterrorobj(L, status, oldtop);
|
||||
@@ -511,8 +511,8 @@ static void f_parser (lua_State *L, void *ud) {
|
||||
tf = ((c == LUA_SIGNATURE[0]) ? luaU_undump : luaY_parser)(L, p->z,
|
||||
&p->buff, p->name);
|
||||
#else
|
||||
if (c == LUA_SIGNATURE[0])
|
||||
luaG_runerror(L, "invalid format, cannot load bytecode scripts");
|
||||
if (l_unlikely(c == LUA_SIGNATURE[0]))
|
||||
luaG_runerror(L, "invalid format, cannot load bytecode scripts");
|
||||
tf = luaY_parser(L, p->z, &p->buff, p->name);
|
||||
#endif
|
||||
cl = luaF_newLclosure(L, tf->nups, hvalue(gt(L)));
|
||||
|
||||
+1
-1
@@ -14,7 +14,7 @@
|
||||
|
||||
|
||||
#define luaD_checkstack(L,n) \
|
||||
if ((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue)) \
|
||||
if (l_unlikely((char *)L->stack_last - (char *)L->top <= (n)*(int)sizeof(TValue))) \
|
||||
luaD_growstack(L, n); \
|
||||
else condhardstacktests(luaD_reallocstack(L, L->stacksize - EXTRA_STACK - 1));
|
||||
|
||||
|
||||
+10
-10
@@ -84,7 +84,7 @@ static int io_type (lua_State *L) {
|
||||
|
||||
static FILE *tofile (lua_State *L) {
|
||||
FILE **f = tofilep(L);
|
||||
if (*f == NULL)
|
||||
if (l_unlikely(*f == NULL))
|
||||
luaL_error(L, "attempt to use a closed file");
|
||||
return *f;
|
||||
}
|
||||
@@ -184,8 +184,8 @@ static int io_open (lua_State *L) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
||||
|| StartsWith(filename, "/") || !pass)
|
||||
if (l_unlikely(strstr(filename, "..") || strchr(filename, ':') || StartsWith(filename, "\\")
|
||||
|| StartsWith(filename, "/") || !pass))
|
||||
{
|
||||
luaL_error(L,"access denied to %s", filename);
|
||||
return pushresult(L,0,filename);
|
||||
@@ -202,7 +202,7 @@ static int io_open (lua_State *L) {
|
||||
{
|
||||
*splitter = 0;
|
||||
I_mkdir(destFilename, 0755);
|
||||
*splitter = '/';
|
||||
*splitter = '/';
|
||||
splitter++;
|
||||
|
||||
forward = strchr(splitter, '/');
|
||||
@@ -226,7 +226,7 @@ static FILE *getiofile (lua_State *L, int findex) {
|
||||
FILE *f;
|
||||
lua_rawgeti(L, LUA_ENVIRONINDEX, findex);
|
||||
f = *(FILE **)lua_touserdata(L, -1);
|
||||
if (f == NULL)
|
||||
if (l_unlikely(f == NULL))
|
||||
luaL_error(L, "standard %s file is closed", fnames[findex - 1]);
|
||||
return f;
|
||||
}
|
||||
@@ -238,7 +238,7 @@ static int g_iofile (lua_State *L, int f, const char *mode) {
|
||||
if (filename) {
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, mode);
|
||||
if (*pf == NULL)
|
||||
if (l_unlikely(*pf == NULL))
|
||||
fileerror(L, 1, filename);
|
||||
}
|
||||
else {
|
||||
@@ -290,7 +290,7 @@ static int io_lines (lua_State *L) {
|
||||
const char *filename = luaL_checkstring(L, 1);
|
||||
FILE **pf = newfile(L);
|
||||
*pf = fopen(filename, "r");
|
||||
if (*pf == NULL)
|
||||
if (l_unlikely(*pf == NULL))
|
||||
fileerror(L, 1, filename);
|
||||
aux_lines(L, lua_gettop(L), 1);
|
||||
return 1;
|
||||
@@ -307,7 +307,7 @@ static int io_lines (lua_State *L) {
|
||||
|
||||
static int read_number (lua_State *L, FILE *f) {
|
||||
lua_Number d;
|
||||
if (fscanf(f, LUA_NUMBER_SCAN, &d) == 1) {
|
||||
if (l_likely(fscanf(f, LUA_NUMBER_SCAN, &d) == 1)) {
|
||||
lua_pushnumber(L, d);
|
||||
return 1;
|
||||
}
|
||||
@@ -454,7 +454,7 @@ static int g_write (lua_State *L, FILE *f, int arg) {
|
||||
else {
|
||||
size_t l;
|
||||
const char *s = luaL_checklstring(L, arg, &l);
|
||||
if (ftell(f) + l > FILELIMIT)
|
||||
if (l_unlikely(ftell(f) + l > FILELIMIT))
|
||||
{
|
||||
luaL_error(L,"write limit bypassed in file. Changes have been discarded.");
|
||||
break;
|
||||
@@ -483,7 +483,7 @@ static int f_seek (lua_State *L) {
|
||||
int op = luaL_checkoption(L, 2, "cur", modenames);
|
||||
long offset = luaL_optlong(L, 3, 0);
|
||||
op = fseek(f, offset, mode[op]);
|
||||
if (op)
|
||||
if (l_unlikely(op))
|
||||
return pushresult(L, 0, NULL); /* error */
|
||||
else {
|
||||
lua_pushinteger(L, ftell(f));
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems,
|
||||
void *newblock;
|
||||
int newsize;
|
||||
if (*size >= limit/2) { /* cannot double it? */
|
||||
if (*size >= limit) /* cannot grow even a little? */
|
||||
if (l_unlikely(*size >= limit)) /* cannot grow even a little? */
|
||||
luaG_runerror(L, errormsg);
|
||||
newsize = limit; /* still have at least one free place */
|
||||
}
|
||||
@@ -77,7 +77,7 @@ void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) {
|
||||
global_State *g = G(L);
|
||||
lua_assert((osize == 0) == (block == NULL));
|
||||
block = (*g->frealloc)(g->ud, block, osize, nsize);
|
||||
if (block == NULL && nsize > 0)
|
||||
if (l_unlikely(block == NULL && nsize > 0))
|
||||
luaD_throw(L, LUA_ERRMEM);
|
||||
lua_assert((nsize == 0) == (block == NULL));
|
||||
g->totalbytes = (g->totalbytes - osize) + nsize;
|
||||
|
||||
+6
-6
@@ -103,7 +103,7 @@ static void checknext (LexState *ls, int c) {
|
||||
|
||||
|
||||
static void check_match (LexState *ls, int what, int who, int where) {
|
||||
if (!testnext(ls, what)) {
|
||||
if (l_unlikely(!testnext(ls, what))) {
|
||||
if (where == ls->linenumber)
|
||||
error_expected(ls, what);
|
||||
else {
|
||||
@@ -275,7 +275,7 @@ static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) {
|
||||
|
||||
|
||||
static void enterlevel (LexState *ls) {
|
||||
if (++ls->L->nCcalls > LUAI_MAXCCALLS)
|
||||
if (l_unlikely(++ls->L->nCcalls > LUAI_MAXCCALLS))
|
||||
luaX_lexerror(ls, "chunk has too many syntax levels", 0);
|
||||
}
|
||||
|
||||
@@ -643,7 +643,7 @@ static void funcargs (LexState *ls, expdesc *f) {
|
||||
int line = ls->linenumber;
|
||||
switch (ls->t.token) {
|
||||
case '(': { /* funcargs -> `(' [ explist1 ] `)' */
|
||||
if (line != ls->lastline)
|
||||
if (l_unlikely(line != ls->lastline))
|
||||
luaX_syntaxerror(ls,"ambiguous syntax (function call x new statement)");
|
||||
luaX_next(ls);
|
||||
if (ls->t.token == ')') /* arg list is empty? */
|
||||
@@ -712,7 +712,7 @@ static void prefixexp (LexState *ls, expdesc *v) {
|
||||
case '$': {
|
||||
lua_Number i = ls->t.seminfo.r;
|
||||
if (i == 0) i = ls->fs->nrhs;
|
||||
if (i <= 0 || i > ls->fs->nlhs)
|
||||
if (l_unlikely(i <= 0 || i > ls->fs->nlhs))
|
||||
luaX_syntaxerror(ls, "pseudo-variable out of range or not in assignment");
|
||||
else {
|
||||
expdesc_list *lhs = ls->fs->lhs;
|
||||
@@ -1105,7 +1105,7 @@ static void breakstat (LexState *ls, lua_Number n) {
|
||||
upval |= bl->upval;
|
||||
bl = bl->previous;
|
||||
}
|
||||
if (!bl)
|
||||
if (l_unlikely(!bl))
|
||||
luaX_syntaxerror(ls, "no loop to break");
|
||||
if (upval)
|
||||
luaK_codeABC(fs, OP_CLOSE, bl->nactvar, 0, 0);
|
||||
@@ -1124,7 +1124,7 @@ static void continuestat (LexState *ls) {
|
||||
//upval |= bl->upval; // AK: ADDITION (would this fix forbody probs?)
|
||||
bl = bl->previous;
|
||||
}
|
||||
if (!bl)
|
||||
if (l_unlikely(!bl))
|
||||
luaX_syntaxerror(ls, "no loop to continue");
|
||||
|
||||
//if (upval) //AK: experimental
|
||||
|
||||
+2
-2
@@ -83,7 +83,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
|
||||
o != NULL;
|
||||
o = o->gch.next) {
|
||||
TString *ts = rawgco2ts(o);
|
||||
if (ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0)) {
|
||||
if (l_unlikely(ts->tsv.len == l && (memcmp(str, getstr(ts), l) == 0))) {
|
||||
/* string may be dead */
|
||||
if (isdead(G(L), o)) changewhite(o);
|
||||
return ts;
|
||||
@@ -95,7 +95,7 @@ TString *luaS_newlstr (lua_State *L, const char *str, size_t l) {
|
||||
|
||||
Udata *luaS_newudata (lua_State *L, size_t s, Table *e) {
|
||||
Udata *u;
|
||||
if (s > MAX_SIZET - sizeof(Udata))
|
||||
if (l_unlikely(s > MAX_SIZET - sizeof(Udata)))
|
||||
luaM_toobig(L);
|
||||
u = cast(Udata *, luaM_malloc(L, s + sizeof(Udata)));
|
||||
u->uv.marked = luaC_white(G(L)); /* is not finalized */
|
||||
|
||||
+14
-12
@@ -113,7 +113,7 @@ static int str_byte (lua_State *L) {
|
||||
if ((size_t)pose > l) pose = l;
|
||||
if (posi > pose) return 0; /* empty interval; return no values */
|
||||
n = (int)(pose - posi + 1);
|
||||
if (posi + n <= pose) /* overflow? */
|
||||
if (l_unlikely(posi + n <= pose)) /* overflow? */
|
||||
luaL_error(L, "string slice too long");
|
||||
luaL_checkstack(L, n, "string slice too long");
|
||||
for (i=0; i<n; i++)
|
||||
@@ -187,7 +187,7 @@ typedef struct MatchState {
|
||||
|
||||
static int check_capture (MatchState *ms, int l) {
|
||||
l -= '1';
|
||||
if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED)
|
||||
if (l_unlikely(l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED))
|
||||
return luaL_error(ms->L, "invalid capture index");
|
||||
return l;
|
||||
}
|
||||
@@ -204,14 +204,14 @@ static int capture_to_close (MatchState *ms) {
|
||||
static const char *classend (MatchState *ms, const char *p) {
|
||||
switch (*p++) {
|
||||
case L_ESC: {
|
||||
if (*p == '\0')
|
||||
if (l_unlikely(*p == '\0'))
|
||||
luaL_error(ms->L, "malformed pattern (ends with " LUA_QL("%%") ")");
|
||||
return p+1;
|
||||
}
|
||||
case '[': {
|
||||
if (*p == '^') p++;
|
||||
do { /* look for a `]' */
|
||||
if (*p == '\0')
|
||||
if (l_unlikely(*p == '\0'))
|
||||
luaL_error(ms->L, "malformed pattern (missing " LUA_QL("]") ")");
|
||||
if (*(p++) == L_ESC && *p != '\0')
|
||||
p++; /* skip escapes (e.g. `%]') */
|
||||
@@ -282,7 +282,7 @@ static const char *match (MatchState *ms, const char *s, const char *p);
|
||||
|
||||
static const char *matchbalance (MatchState *ms, const char *s,
|
||||
const char *p) {
|
||||
if (*p == 0 || *(p+1) == 0)
|
||||
if (l_unlikely(*p == 0 || *(p+1) == 0))
|
||||
luaL_error(ms->L, "unbalanced pattern");
|
||||
if (*s != *p) return NULL;
|
||||
else {
|
||||
@@ -332,7 +332,8 @@ static const char *start_capture (MatchState *ms, const char *s,
|
||||
const char *p, int what) {
|
||||
const char *res;
|
||||
int level = ms->level;
|
||||
if (level >= LUA_MAXCAPTURES) luaL_error(ms->L, "too many captures");
|
||||
if (l_unlikely(level >= LUA_MAXCAPTURES))
|
||||
luaL_error(ms->L, "too many captures");
|
||||
ms->capture[level].init = s;
|
||||
ms->capture[level].len = what;
|
||||
ms->level = level+1;
|
||||
@@ -386,7 +387,7 @@ static const char *match (MatchState *ms, const char *s, const char *p) {
|
||||
case 'f': { /* frontier? */
|
||||
const char *ep; char previous;
|
||||
p += 2;
|
||||
if (*p != '[')
|
||||
if (l_unlikely(*p != '['))
|
||||
luaL_error(ms->L, "missing " LUA_QL("[") " after "
|
||||
LUA_QL("%%f") " in pattern");
|
||||
ep = classend(ms, p); /* points to what is next */
|
||||
@@ -468,14 +469,15 @@ static const char *lmemfind (const char *s1, size_t l1,
|
||||
static void push_onecapture (MatchState *ms, int i, const char *s,
|
||||
const char *e) {
|
||||
if (i >= ms->level) {
|
||||
if (i == 0) /* ms->level == 0, too */
|
||||
if (l_likely(i == 0)) /* ms->level == 0, too */
|
||||
lua_pushlstring(ms->L, s, e - s); /* add whole match */
|
||||
else
|
||||
luaL_error(ms->L, "invalid capture index");
|
||||
}
|
||||
else {
|
||||
ptrdiff_t l = ms->capture[i].len;
|
||||
if (l == CAP_UNFINISHED) luaL_error(ms->L, "unfinished capture");
|
||||
if (l_unlikely(l == CAP_UNFINISHED))
|
||||
luaL_error(ms->L, "unfinished capture");
|
||||
if (l == CAP_POSITION)
|
||||
lua_pushinteger(ms->L, ms->capture[i].init - ms->src_init + 1);
|
||||
else
|
||||
@@ -637,7 +639,7 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s,
|
||||
lua_pop(L, 1);
|
||||
lua_pushlstring(L, s, e - s); /* keep original text */
|
||||
}
|
||||
else if (!lua_isstring(L, -1))
|
||||
else if (l_unlikely(!lua_isstring(L, -1)))
|
||||
luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1));
|
||||
luaL_addvalue(b); /* add result to accumulator */
|
||||
}
|
||||
@@ -727,7 +729,7 @@ static void addquoted (lua_State *L, luaL_Buffer *b, int arg) {
|
||||
static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
|
||||
const char *p = strfrmt;
|
||||
while (*p != '\0' && strchr(FLAGS, *p) != NULL) p++; /* skip flags */
|
||||
if ((size_t)(p - strfrmt) >= sizeof(FLAGS))
|
||||
if (l_unlikely((size_t)(p - strfrmt) >= sizeof(FLAGS)))
|
||||
luaL_error(L, "invalid format (repeated flags)");
|
||||
if (isdigit(uchar(*p))) p++; /* skip width */
|
||||
if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
|
||||
@@ -736,7 +738,7 @@ static const char *scanformat (lua_State *L, const char *strfrmt, char *form) {
|
||||
if (isdigit(uchar(*p))) p++; /* skip precision */
|
||||
if (isdigit(uchar(*p))) p++; /* (2 digits at most) */
|
||||
}
|
||||
if (isdigit(uchar(*p)))
|
||||
if (l_unlikely(isdigit(uchar(*p))))
|
||||
luaL_error(L, "invalid format (width or precision too long)");
|
||||
*(form++) = '%';
|
||||
strncpy(form, strfrmt, p - strfrmt + 1);
|
||||
|
||||
+4
-3
@@ -278,7 +278,7 @@ static void setnodevector (lua_State *L, Table *t, int size) {
|
||||
else {
|
||||
int i;
|
||||
lsize = ceillog2(size);
|
||||
if (lsize > MAXBITS)
|
||||
if (l_unlikely(lsize > MAXBITS))
|
||||
luaG_runerror(L, "table overflow");
|
||||
size = twoto(lsize);
|
||||
t->node = luaM_newvector(L, size, Node);
|
||||
@@ -498,8 +498,9 @@ TValue *luaH_set (lua_State *L, Table *t, const TValue *key) {
|
||||
if (p != luaO_nilobject)
|
||||
return cast(TValue *, p);
|
||||
else {
|
||||
if (ttisnil(key)) luaG_runerror(L, "table index is nil");
|
||||
else if (ttisnumber(key) && luai_numisnan(nvalue(key)))
|
||||
if (l_unlikely(ttisnil(key)))
|
||||
luaG_runerror(L, "table index is nil");
|
||||
else if (l_unlikely(ttisnumber(key) && luai_numisnan(nvalue(key))))
|
||||
luaG_runerror(L, "table index is NaN");
|
||||
return newkey(L, t, key);
|
||||
}
|
||||
|
||||
+5
-3
@@ -134,7 +134,7 @@ static int tremove (lua_State *L) {
|
||||
|
||||
static void addfield (lua_State *L, luaL_Buffer *b, int i) {
|
||||
lua_rawgeti(L, 1, i);
|
||||
if (!lua_isstring(L, -1))
|
||||
if (l_unlikely(!lua_isstring(L, -1)))
|
||||
luaL_error(L, "invalid value (%s) at index %d in table for "
|
||||
LUA_QL("concat"), luaL_typename(L, -1), i);
|
||||
luaL_addvalue(b);
|
||||
@@ -224,12 +224,14 @@ static void auxsort (lua_State *L, int l, int u) {
|
||||
for (;;) { /* invariant: a[l..i] <= P <= a[j..u] */
|
||||
/* repeat ++i until a[i] >= P */
|
||||
while (lua_rawgeti(L, 1, ++i), sort_comp(L, -1, -2)) {
|
||||
if (i>u) luaL_error(L, "invalid order function for sorting");
|
||||
if (l_unlikely(i>u))
|
||||
luaL_error(L, "invalid order function for sorting");
|
||||
lua_pop(L, 1); /* remove a[i] */
|
||||
}
|
||||
/* repeat --j until a[j] <= P */
|
||||
while (lua_rawgeti(L, 1, --j), sort_comp(L, -3, -1)) {
|
||||
if (j<l) luaL_error(L, "invalid order function for sorting");
|
||||
if (l_unlikely(j<l))
|
||||
luaL_error(L, "invalid order function for sorting");
|
||||
lua_pop(L, 1); /* remove a[j] */
|
||||
}
|
||||
if (j<i) {
|
||||
|
||||
@@ -773,6 +773,23 @@ union luai_Cast { double l_d; long l_l; };
|
||||
|
||||
/* =================================================================== */
|
||||
|
||||
/*
|
||||
* * macros to improve jump prediction, used mostly for error handling
|
||||
** and debug facilities.
|
||||
*/
|
||||
#if !defined(l_likely)
|
||||
|
||||
#include <stdio.h>
|
||||
#if defined(__GNUC__)
|
||||
#define l_likely(x) (__builtin_expect(((x) != 0), 1))
|
||||
#define l_unlikely(x) (__builtin_expect(((x) != 0), 0))
|
||||
#else
|
||||
#define l_likely(x) (x)
|
||||
#define l_unlikely(x) (x)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Local configuration. You can use this space to add your redefinitions
|
||||
** without modifying the main part of the file.
|
||||
|
||||
+12
-11
@@ -119,7 +119,7 @@ void luaV_gettable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
}
|
||||
/* else will try the tag method */
|
||||
}
|
||||
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX)))
|
||||
else if (l_unlikely(ttisnil(tm = luaT_gettmbyobj(L, t, TM_INDEX))))
|
||||
luaG_typeerror(L, t, "index");
|
||||
if (ttisfunction(tm)) {
|
||||
callTMres(L, val, tm, t, key);
|
||||
@@ -147,7 +147,7 @@ void luaV_settable (lua_State *L, TValue *t, TValue *key, StkId val) {
|
||||
}
|
||||
/* else will try the tag method */
|
||||
}
|
||||
else if (ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX)))
|
||||
else if (l_unlikely(ttisnil(tm = luaT_gettmbyobj(L, t, TM_NEWINDEX))))
|
||||
luaG_typeerror(L, t, "index");
|
||||
if (ttisfunction(tm)) {
|
||||
callTM(L, tm, t, key, val);
|
||||
@@ -293,7 +293,8 @@ void luaV_concat (lua_State *L, int total, int last) {
|
||||
/* collect total length */
|
||||
for (n = 1; n < total && tostring(L, top-n-1); n++) {
|
||||
size_t l = tsvalue(top-n-1)->len;
|
||||
if (l >= MAX_SIZET - tl) luaG_runerror(L, "string length overflow");
|
||||
if (l_unlikely(l >= MAX_SIZET - tl))
|
||||
luaG_runerror(L, "string length overflow");
|
||||
tl += l;
|
||||
}
|
||||
buffer = luaZ_openspace(L, &G(L)->buff, tl);
|
||||
@@ -322,8 +323,8 @@ static void Arith (lua_State *L, StkId ra, TValue *rb,
|
||||
case TM_ADD: setnvalue(ra, luai_numadd(nb, nc)); break;
|
||||
case TM_SUB: setnvalue(ra, luai_numsub(nb, nc)); break;
|
||||
case TM_MUL: setnvalue(ra, luai_nummul(nb, nc)); break;
|
||||
case TM_DIV: if (nc == 0) { luaG_runerror(L, "divide by zero error"); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
|
||||
case TM_MOD: if (nc == 0) { luaG_runerror(L, "modulo by zero error"); } else setnvalue(ra, luai_nummod(nb, nc)); break;
|
||||
case TM_DIV: if (l_unlikely(nc == 0)) { luaG_runerror(L, "divide by zero error"); } else setnvalue(ra, luai_numdiv(nb, nc)); break;
|
||||
case TM_MOD: if (l_unlikely(nc == 0)) { luaG_runerror(L, "modulo by zero error"); } else setnvalue(ra, luai_nummod(nb, nc)); break;
|
||||
case TM_POW: setnvalue(ra, luai_numpow(nb, nc)); break;
|
||||
case TM_UNM: setnvalue(ra, luai_numunm(nb)); break;
|
||||
case TM_AND: setnvalue(ra, luai_numand(nb, nc)); break;
|
||||
@@ -491,7 +492,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
TValue *rc = RKC(i);
|
||||
if (ttisnumber(rb) && ttisnumber(rc)) {
|
||||
lua_Number nb = nvalue(rb), nc = nvalue(rc);
|
||||
if (nc == 0) {
|
||||
if (l_unlikely(nc == 0)) {
|
||||
luaG_runerror(L, "divide by zero error");
|
||||
}
|
||||
else
|
||||
@@ -506,7 +507,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
TValue *rc = RKC(i);
|
||||
if (ttisnumber(rb) && ttisnumber(rc)) {
|
||||
lua_Number nb = nvalue(rb), nc = nvalue(rc);
|
||||
if (nc == 0) {
|
||||
if (l_unlikely(nc == 0)) {
|
||||
luaG_runerror(L, "modulo by zero error");
|
||||
}
|
||||
else
|
||||
@@ -580,7 +581,7 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
}
|
||||
default: { /* try metamethod */
|
||||
Protect(
|
||||
if (!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN))
|
||||
if (l_unlikely(!call_binTM(L, rb, luaO_nilobject, ra, TM_LEN)))
|
||||
luaG_typeerror(L, rb, "get length of");
|
||||
)
|
||||
}
|
||||
@@ -724,11 +725,11 @@ void luaV_execute (lua_State *L, int nexeccalls) {
|
||||
const TValue *plimit = ra+1;
|
||||
const TValue *pstep = ra+2;
|
||||
L->savedpc = pc; /* next steps may throw errors */
|
||||
if (!tonumber(init, ra))
|
||||
if (l_unlikely(!tonumber(init, ra)))
|
||||
luaG_runerror(L, LUA_QL("for") " initial value must be a number");
|
||||
else if (!tonumber(plimit, ra+1))
|
||||
else if (l_unlikely(!tonumber(plimit, ra+1)))
|
||||
luaG_runerror(L, LUA_QL("for") " limit must be a number");
|
||||
else if (!tonumber(pstep, ra+2))
|
||||
else if (l_unlikely(!tonumber(pstep, ra+2)))
|
||||
luaG_runerror(L, LUA_QL("for") " step must be a number");
|
||||
if (ra && pstep)
|
||||
setnvalue(ra, luai_numsub(nvalue(ra), nvalue(pstep)));
|
||||
|
||||
+11
-140
@@ -90,9 +90,12 @@ char motd[254], server_context[8]; // Message of the Day, Unique Context (even w
|
||||
plrinfo playerinfo[MAXPLAYERS];
|
||||
SINT8 joinnode = 0; // used for CL_VIEWSERVER
|
||||
|
||||
boolean player_muted[MAXPLAYERS] = {0};
|
||||
|
||||
// Server specific vars
|
||||
UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
|
||||
// Minimum timeout for sending the savegame
|
||||
// The actual timeout will be longer depending on the savegame length
|
||||
tic_t jointimeout = (3*TICRATE);
|
||||
@@ -567,58 +570,7 @@ void SendKick(UINT8 playernum, UINT8 msg)
|
||||
// end of extra data function
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// extra data function for lmps
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// if extradatabit is set, after the ziped tic you find this:
|
||||
//
|
||||
// type | description
|
||||
// ---------+--------------
|
||||
// byte | size of the extradata
|
||||
// byte | the extradata (xd) bits: see XD_...
|
||||
// with this byte you know what parameter folow
|
||||
// if (xd & XDNAMEANDCOLOR)
|
||||
// byte | color
|
||||
// char[MAXPLAYERNAME] | name of the player
|
||||
// endif
|
||||
// if (xd & XD_WEAPON_PREF)
|
||||
// byte | original weapon switch: boolean, true if use the old
|
||||
// | weapon switch methode
|
||||
// char[NUMWEAPONS] | the weapon switch priority
|
||||
// byte | autoaim: true if use the old autoaim system
|
||||
// endif
|
||||
/*boolean AddLmpExtradata(UINT8 **demo_point, INT32 playernum)
|
||||
{
|
||||
UINT8 *textcmd = D_GetExistingTextcmd(gametic, playernum);
|
||||
|
||||
if (!textcmd)
|
||||
return false;
|
||||
|
||||
M_Memcpy(*demo_point, textcmd, textcmd[0]+1);
|
||||
*demo_point += textcmd[0]+1;
|
||||
return true;
|
||||
}
|
||||
|
||||
void ReadLmpExtraData(UINT8 **demo_pointer, INT32 playernum)
|
||||
{
|
||||
UINT8 nextra;
|
||||
UINT8 *textcmd;
|
||||
|
||||
if (!demo_pointer)
|
||||
return;
|
||||
|
||||
textcmd = D_GetTextcmd(gametic, playernum);
|
||||
nextra = **demo_pointer;
|
||||
M_Memcpy(textcmd, *demo_pointer, nextra + 1);
|
||||
// increment demo pointer
|
||||
*demo_pointer += nextra + 1;
|
||||
}*/
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
// end extra data function for lmps
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
// can we get rid of this finally lmao
|
||||
// -----------------------------------------------------------------
|
||||
// resynch player data
|
||||
// -----------------------------------------------------------------
|
||||
@@ -1580,70 +1532,6 @@ static boolean CL_SendJoin(void)
|
||||
return HSendPacket(servernode, false, 0, sizeof (clientconfig_pak));
|
||||
}
|
||||
|
||||
static void
|
||||
CopyCaretColors (char *p, const char *s, int n)
|
||||
{
|
||||
char *t;
|
||||
int m;
|
||||
int c;
|
||||
if (!n)
|
||||
return;
|
||||
while (( t = strchr(s, '^') ))
|
||||
{
|
||||
m = ( t - s );
|
||||
|
||||
if (m >= n)
|
||||
{
|
||||
memcpy(p, s, n);
|
||||
return;
|
||||
}
|
||||
else
|
||||
memcpy(p, s, m);
|
||||
|
||||
p += m;
|
||||
n -= m;
|
||||
s += m;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
|
||||
if (s[1])
|
||||
{
|
||||
c = toupper(s[1]);
|
||||
if (isdigit(c))
|
||||
c = 0x80 + ( c - '0' );
|
||||
else if (c >= 'A' && c <= 'F')
|
||||
c = 0x80 + ( c - 'A' );
|
||||
else
|
||||
c = 0;
|
||||
|
||||
if (c)
|
||||
{
|
||||
*p++ = c;
|
||||
n--;
|
||||
|
||||
if (!n)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (n < 2)
|
||||
break;
|
||||
|
||||
memcpy(p, s, 2);
|
||||
|
||||
p += 2;
|
||||
n -= 2;
|
||||
}
|
||||
|
||||
s += 2;
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
strncpy(p, s, n);
|
||||
}
|
||||
|
||||
static void SV_SendServerInfo(INT32 node, tic_t servertime)
|
||||
{
|
||||
UINT8 *p;
|
||||
@@ -2126,7 +2014,7 @@ static void CL_ReloadReceivedSavegame(void)
|
||||
|
||||
for (i = 0; i < MAXSPLITSCREENPLAYERS; i++)
|
||||
{
|
||||
camera[i].subsector = R_PointInSubsector(camera[i].x, camera[i].y);
|
||||
camera[i].subsector = R_PointInSubsectorFast(camera[i].x, camera[i].y);
|
||||
}
|
||||
|
||||
cl_redownloadinggamestate = false;
|
||||
@@ -3488,6 +3376,8 @@ void CL_Reset(void)
|
||||
#endif
|
||||
G_ResetAllDeviceRumbles();
|
||||
|
||||
memset(player_muted, 0, sizeof(player_muted));
|
||||
|
||||
// D_StartTitle should get done now, but the calling function will handle it
|
||||
}
|
||||
|
||||
@@ -3508,31 +3398,12 @@ static void Command_GetPlayerNum(void)
|
||||
|
||||
SINT8 nametonum(const char *name)
|
||||
{
|
||||
INT32 playernum, i;
|
||||
INT32 playernum = D_LookupPlayer(name);
|
||||
|
||||
if (!strcmp(name, "0"))
|
||||
return 0;
|
||||
if (playernum == -1)
|
||||
CONS_Printf(M_GetText("There is no player named \"%s\"\n"), name);
|
||||
|
||||
playernum = (SINT8)atoi(name);
|
||||
|
||||
if (playernum < 0 || playernum >= MAXPLAYERS)
|
||||
return -1;
|
||||
|
||||
if (playernum)
|
||||
{
|
||||
if (playeringame[playernum])
|
||||
return (SINT8)playernum;
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXPLAYERS; i++)
|
||||
if (playeringame[i] && !stricmp(player_names[i], name))
|
||||
return (SINT8)i;
|
||||
|
||||
CONS_Printf(M_GetText("There is no player named \"%s\"\n"), name);
|
||||
|
||||
return -1;
|
||||
return playernum;
|
||||
}
|
||||
|
||||
/** Lists all players and their player numbers.
|
||||
|
||||
@@ -671,6 +671,8 @@ SINT8 nametonum(const char *name);
|
||||
extern char motd[254], server_context[8];
|
||||
extern UINT8 playernode[MAXPLAYERS];
|
||||
|
||||
extern boolean player_muted[MAXPLAYERS];
|
||||
|
||||
INT32 D_NumPlayers(void);
|
||||
|
||||
void D_ResetTiccmds(void);
|
||||
|
||||
+21
-9
@@ -152,6 +152,8 @@ boolean dedicated = false;
|
||||
|
||||
boolean loaded_config = false; // true once config.cfg loaded AND executed
|
||||
|
||||
static void D_CleanFile(char **filearray);
|
||||
|
||||
//
|
||||
// D_PostEvent
|
||||
// Called by the I/O functions when input is detected
|
||||
@@ -896,9 +898,24 @@ void D_SRB2Loop(void)
|
||||
rendertimefrac_unpaused = FRACUNIT;
|
||||
}
|
||||
|
||||
if ((interp || doDisplay) && !frameskip)
|
||||
if (interp || doDisplay)
|
||||
{
|
||||
ranwipe = D_Display();
|
||||
if (!frameskip)
|
||||
{
|
||||
ranwipe = D_Display();
|
||||
}
|
||||
else if (!dedicated)
|
||||
{
|
||||
// always update console and hud
|
||||
// otherwise it may take minutes to open it
|
||||
CON_Drawer();
|
||||
|
||||
if (gamestate == GS_LEVEL)
|
||||
{
|
||||
ST_Drawer();
|
||||
HU_Drawer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Only take screenshots after drawing.
|
||||
@@ -1215,7 +1232,7 @@ void D_AddPostloadFiles(void)
|
||||
postautoloaded = true;
|
||||
}
|
||||
|
||||
void D_CleanFile(char **filearray)
|
||||
static void D_CleanFile(char **filearray)
|
||||
{
|
||||
size_t pnumwadfiles;
|
||||
for (pnumwadfiles = 0; filearray[pnumwadfiles]; pnumwadfiles++)
|
||||
@@ -1478,7 +1495,7 @@ static void D_CheckSaturnExtraFiles(void)
|
||||
}
|
||||
|
||||
// extra round joystick inputdisplay sprites
|
||||
if (W_CheckMultipleLumps("JOYBCK","JOYKNB","JOYSHD", NULL))
|
||||
if (W_CheckMultipleLumps("JOYBCK", "JOYKNB", "JOYSHD", NULL))
|
||||
{
|
||||
joystickicon = true;
|
||||
PUSHCONS(inputdisplay_cons_temp, last_inputdisplay_i, 3, "StickGFX");
|
||||
@@ -1609,11 +1626,6 @@ void D_SRB2Main(void)
|
||||
I_OutputMsg("setvbuf didnt work\n");
|
||||
#endif
|
||||
|
||||
#ifdef GETTEXT
|
||||
// initialise locale code
|
||||
M_StartupLocale();
|
||||
#endif
|
||||
|
||||
// get parameters from a response file (eg: srb2 @parms.txt)
|
||||
M_FindResponseFile();
|
||||
|
||||
|
||||
@@ -85,8 +85,6 @@ void D_PostEvent(const event_t *ev);
|
||||
|
||||
void D_ProcessEvents(void);
|
||||
|
||||
void D_CleanFile(char **filearray);
|
||||
|
||||
const char *D_Home(void);
|
||||
|
||||
//
|
||||
|
||||
+10
-6
@@ -1026,6 +1026,7 @@ void D_RegisterClientCommands(void)
|
||||
CV_RegisterVar(&cv_scr_height);
|
||||
|
||||
CV_RegisterVar(&cv_parallelsoftware);
|
||||
CV_RegisterVar(&cv_paralleldrawmasked);
|
||||
|
||||
CV_RegisterVar(&cv_soundtest);
|
||||
|
||||
@@ -2082,7 +2083,7 @@ static void Command_ResetCamera_f(void)
|
||||
}
|
||||
|
||||
/* Consider replacing nametonum with this */
|
||||
static INT32 LookupPlayer(const char *s)
|
||||
INT32 D_LookupPlayer(const char *s)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
@@ -2098,8 +2099,7 @@ static INT32 LookupPlayer(const char *s)
|
||||
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
||||
{
|
||||
/* Match name case-insensitively: fully, or partially the start. */
|
||||
if (playeringame[playernum])
|
||||
if (strnicmp(player_names[playernum], s, strlen(s)) == 0)
|
||||
if (playeringame[playernum] && (strnicmp(player_names[playernum], s, strlen(s)) == 0))
|
||||
{
|
||||
return playernum;
|
||||
}
|
||||
@@ -2110,14 +2110,18 @@ static INT32 LookupPlayer(const char *s)
|
||||
static INT32 FindPlayerByPlace(INT32 place)
|
||||
{
|
||||
INT32 playernum;
|
||||
|
||||
for (playernum = 0; playernum < MAXPLAYERS; ++playernum)
|
||||
if (playeringame[playernum])
|
||||
{
|
||||
if (!playeringame[playernum])
|
||||
continue;
|
||||
|
||||
if (players[playernum].kartstuff[k_position] == place)
|
||||
{
|
||||
return playernum;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -2210,7 +2214,7 @@ static void Command_View_f(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (( playernum = LookupPlayer(COM_Argv(1)) ) == -1)
|
||||
if (( playernum = D_LookupPlayer(COM_Argv(1)) ) == -1)
|
||||
{
|
||||
CONS_Alert(CONS_WARNING, "There is no player by that name!\n");
|
||||
return;
|
||||
@@ -5674,7 +5678,7 @@ static void Command_Archivetest_f(void)
|
||||
// assign mobjnum
|
||||
i = 1;
|
||||
for (th = thinkercap.next; th != &thinkercap; th = th->next)
|
||||
if (th->function.acp1 == (actionf_p1)P_MobjThinker)
|
||||
if (th->function == (actionf_p1)P_MobjThinker)
|
||||
((mobj_t *)th)->mobjnum = i++;
|
||||
|
||||
// allocate buffer
|
||||
|
||||
@@ -323,6 +323,7 @@ void ClearAdminPlayers(void);
|
||||
void RemoveAdminPlayer(INT32 playernum);
|
||||
void ItemFinder_OnChange(void);
|
||||
void D_SetPassword(const char *pw);
|
||||
INT32 D_LookupPlayer(const char *s);
|
||||
|
||||
// used for the player setup menu
|
||||
UINT8 CanChangeSkin(INT32 playernum);
|
||||
|
||||
@@ -1185,6 +1185,18 @@ filestatus_t findfile(char *filename, const UINT8 *wantedmd5sum, boolean complet
|
||||
badmd5 = true;
|
||||
// if not found at all, just move on without doing anything
|
||||
|
||||
if (cv_addons_option.value == 3 && *cv_addons_folder.string != '\0')
|
||||
{
|
||||
// next, check any custom directory if specified
|
||||
homecheck = filesearch(filename, cv_addons_folder.string, wantedmd5sum, completepath, 10);
|
||||
|
||||
if (homecheck == FS_FOUND) // we found the file, so return that we have :)
|
||||
return FS_FOUND;
|
||||
else if (homecheck == FS_MD5SUMBAD) // file has a bad md5; move on and look for a file with the right md5
|
||||
badmd5 = true;
|
||||
// if not found at all, just move on without doing anything
|
||||
}
|
||||
|
||||
// finally check "." directory
|
||||
homecheck = filesearch(filename, ".", wantedmd5sum, completepath, 10);
|
||||
|
||||
|
||||
+1
-8
@@ -28,18 +28,11 @@
|
||||
// To compile this as "ANSI C with classes" we will need to handle the various
|
||||
// action functions cleanly.
|
||||
//
|
||||
typedef void (*actionf_v)();
|
||||
typedef void (*actionf_p1)(void *);
|
||||
|
||||
typedef union
|
||||
{
|
||||
actionf_v acv;
|
||||
actionf_p1 acp1;
|
||||
} actionf_t;
|
||||
|
||||
// Historically, "think_t" is yet another function pointer to a routine
|
||||
// to handle an actor.
|
||||
typedef actionf_t think_t;
|
||||
typedef actionf_p1 think_t;
|
||||
|
||||
// Doubly linked list of actors.
|
||||
typedef struct thinker_s
|
||||
|
||||
@@ -152,3 +152,8 @@ boolean I_UseNativeKeyboard(void)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void I_SetBorderlessWindow(void)
|
||||
{
|
||||
|
||||
}
|
||||
+218
-217
@@ -1416,211 +1416,212 @@ static void readhuditem(MYFILE *f, INT32 num)
|
||||
// DO NOT FORGET TO SYNC THIS LIST WITH THE ACTIONNUM ENUM IN INFO.H
|
||||
actionpointer_t actionpointers[] =
|
||||
{
|
||||
{{A_Explode}, "A_EXPLODE"},
|
||||
{{A_Pain}, "A_PAIN"},
|
||||
{{A_Fall}, "A_FALL"},
|
||||
{{A_MonitorPop}, "A_MONITORPOP"},
|
||||
{{A_Look}, "A_LOOK"},
|
||||
{{A_Chase}, "A_CHASE"},
|
||||
{{A_FaceStabChase}, "A_FACESTABCHASE"},
|
||||
{{A_FaceTarget}, "A_FACETARGET"},
|
||||
{{A_FaceTracer}, "A_FACETRACER"},
|
||||
{{A_Scream}, "A_SCREAM"},
|
||||
{{A_BossDeath}, "A_BOSSDEATH"},
|
||||
{{A_CustomPower}, "A_CUSTOMPOWER"},
|
||||
{{A_GiveWeapon}, "A_GIVEWEAPON"},
|
||||
{{A_RingShield}, "A_RINGSHIELD"},
|
||||
{{A_RingBox}, "A_RINGBOX"},
|
||||
{{A_Invincibility}, "A_INVINCIBILITY"},
|
||||
{{A_SuperSneakers}, "A_SUPERSNEAKERS"},
|
||||
{{A_BunnyHop}, "A_BUNNYHOP"},
|
||||
{{A_BubbleSpawn}, "A_BUBBLESPAWN"},
|
||||
{{A_FanBubbleSpawn}, "A_FANBUBBLESPAWN"},
|
||||
{{A_BubbleRise}, "A_BUBBLERISE"},
|
||||
{{A_BubbleCheck}, "A_BUBBLECHECK"},
|
||||
{{A_AwardScore}, "A_AWARDSCORE"},
|
||||
{{A_ExtraLife}, "A_EXTRALIFE"},
|
||||
{{A_BombShield}, "A_BOMBSHIELD"},
|
||||
{{A_JumpShield}, "A_JUMPSHIELD"},
|
||||
{{A_WaterShield}, "A_WATERSHIELD"},
|
||||
{{A_ForceShield}, "A_FORCESHIELD"},
|
||||
{{A_PityShield}, "A_PITYSHIELD"},
|
||||
{{A_GravityBox}, "A_GRAVITYBOX"},
|
||||
{{A_ScoreRise}, "A_SCORERISE"},
|
||||
{{A_ParticleSpawn}, "A_PARTICLESPAWN"},
|
||||
{{A_AttractChase}, "A_ATTRACTCHASE"},
|
||||
{{A_DropMine}, "A_DROPMINE"},
|
||||
{{A_FishJump}, "A_FISHJUMP"},
|
||||
{{A_ThrownRing}, "A_THROWNRING"},
|
||||
{{A_GrenadeRing}, "A_GRENADERING"}, // SRB2kart
|
||||
{{A_SetSolidSteam}, "A_SETSOLIDSTEAM"},
|
||||
{{A_UnsetSolidSteam}, "A_UNSETSOLIDSTEAM"},
|
||||
{{A_SignPlayer}, "A_SIGNPLAYER"},
|
||||
{{A_OverlayThink}, "A_OVERLAYTHINK"},
|
||||
{{A_JetChase}, "A_JETCHASE"},
|
||||
{{A_JetbThink}, "A_JETBTHINK"},
|
||||
{{A_JetgThink}, "A_JETGTHINK"},
|
||||
{{A_JetgShoot}, "A_JETGSHOOT"},
|
||||
{{A_ShootBullet}, "A_SHOOTBULLET"},
|
||||
{{A_MinusDigging}, "A_MINUSDIGGING"},
|
||||
{{A_MinusPopup}, "A_MINUSPOPUP"},
|
||||
{{A_MinusCheck}, "A_MINUSCHECK"},
|
||||
{{A_ChickenCheck}, "A_CHICKENCHECK"},
|
||||
{{A_MouseThink}, "A_MOUSETHINK"},
|
||||
{{A_DetonChase}, "A_DETONCHASE"},
|
||||
{{A_CapeChase}, "A_CAPECHASE"},
|
||||
{{A_RotateSpikeBall}, "A_ROTATESPIKEBALL"},
|
||||
{{A_SlingAppear}, "A_SLINGAPPEAR"},
|
||||
{{A_MaceRotate}, "A_MACEROTATE"},
|
||||
{{A_UnidusBall}, "A_UNIDUSBALL"},
|
||||
{{A_RockSpawn}, "A_ROCKSPAWN"},
|
||||
{{A_SetFuse}, "A_SETFUSE"},
|
||||
{{A_CrawlaCommanderThink}, "A_CRAWLACOMMANDERTHINK"},
|
||||
{{A_SmokeTrailer}, "A_SMOKETRAILER"},
|
||||
{{A_RingExplode}, "A_RINGEXPLODE"},
|
||||
{{A_OldRingExplode}, "A_OLDRINGEXPLODE"},
|
||||
{{A_MixUp}, "A_MIXUP"},
|
||||
{{A_RecyclePowers}, "A_RECYCLEPOWERS"},
|
||||
{{A_Boss1Chase}, "A_BOSS1CHASE"},
|
||||
{{A_FocusTarget}, "A_FOCUSTARGET"},
|
||||
{{A_Boss2Chase}, "A_BOSS2CHASE"},
|
||||
{{A_Boss2Pogo}, "A_BOSS2POGO"},
|
||||
{{A_BossZoom}, "A_BOSSZOOM"},
|
||||
{{A_BossScream}, "A_BOSSSCREAM"},
|
||||
{{A_Boss2TakeDamage}, "A_BOSS2TAKEDAMAGE"},
|
||||
{{A_Boss7Chase}, "A_BOSS7CHASE"},
|
||||
{{A_GoopSplat}, "A_GOOPSPLAT"},
|
||||
{{A_Boss2PogoSFX}, "A_BOSS2POGOSFX"},
|
||||
{{A_Boss2PogoTarget}, "A_BOSS2POGOTARGET"},
|
||||
{{A_BossJetFume}, "A_BOSSJETFUME"},
|
||||
{{A_EggmanBox}, "A_EGGMANBOX"},
|
||||
{{A_TurretFire}, "A_TURRETFIRE"},
|
||||
{{A_SuperTurretFire}, "A_SUPERTURRETFIRE"},
|
||||
{{A_TurretStop}, "A_TURRETSTOP"},
|
||||
{{A_JetJawRoam}, "A_JETJAWROAM"},
|
||||
{{A_JetJawChomp}, "A_JETJAWCHOMP"},
|
||||
{{A_PointyThink}, "A_POINTYTHINK"},
|
||||
{{A_CheckBuddy}, "A_CHECKBUDDY"},
|
||||
{{A_HoodThink}, "A_HOODTHINK"},
|
||||
{{A_ArrowCheck}, "A_ARROWCHECK"},
|
||||
{{A_SnailerThink}, "A_SNAILERTHINK"},
|
||||
{{A_SharpChase}, "A_SHARPCHASE"},
|
||||
{{A_SharpSpin}, "A_SHARPSPIN"},
|
||||
{{A_VultureVtol}, "A_VULTUREVTOL"},
|
||||
{{A_VultureCheck}, "A_VULTURECHECK"},
|
||||
{{A_SkimChase}, "A_SKIMCHASE"},
|
||||
{{A_1upThinker}, "A_1UPTHINKER"},
|
||||
{{A_SkullAttack}, "A_SKULLATTACK"},
|
||||
{{A_LobShot}, "A_LOBSHOT"},
|
||||
{{A_FireShot}, "A_FIRESHOT"},
|
||||
{{A_SuperFireShot}, "A_SUPERFIRESHOT"},
|
||||
{{A_BossFireShot}, "A_BOSSFIRESHOT"},
|
||||
{{A_Boss7FireMissiles}, "A_BOSS7FIREMISSILES"},
|
||||
{{A_Boss1Laser}, "A_BOSS1LASER"},
|
||||
{{A_Boss4Reverse}, "A_BOSS4REVERSE"},
|
||||
{{A_Boss4SpeedUp}, "A_BOSS4SPEEDUP"},
|
||||
{{A_Boss4Raise}, "A_BOSS4RAISE"},
|
||||
{{A_SparkFollow}, "A_SPARKFOLLOW"},
|
||||
{{A_BuzzFly}, "A_BUZZFLY"},
|
||||
{{A_GuardChase}, "A_GUARDCHASE"},
|
||||
{{A_EggShield}, "A_EGGSHIELD"},
|
||||
{{A_SetReactionTime}, "A_SETREACTIONTIME"},
|
||||
{{A_Boss1Spikeballs}, "A_BOSS1SPIKEBALLS"},
|
||||
{{A_Boss3TakeDamage}, "A_BOSS3TAKEDAMAGE"},
|
||||
{{A_Boss3Path}, "A_BOSS3PATH"},
|
||||
{{A_LinedefExecute}, "A_LINEDEFEXECUTE"},
|
||||
{{A_PlaySeeSound}, "A_PLAYSEESOUND"},
|
||||
{{A_PlayAttackSound}, "A_PLAYATTACKSOUND"},
|
||||
{{A_PlayActiveSound}, "A_PLAYACTIVESOUND"},
|
||||
{{A_SpawnObjectAbsolute}, "A_SPAWNOBJECTABSOLUTE"},
|
||||
{{A_SpawnObjectRelative}, "A_SPAWNOBJECTRELATIVE"},
|
||||
{{A_ChangeAngleRelative}, "A_CHANGEANGLERELATIVE"},
|
||||
{{A_ChangeAngleAbsolute}, "A_CHANGEANGLEABSOLUTE"},
|
||||
{{A_PlaySound}, "A_PLAYSOUND"},
|
||||
{{A_FindTarget}, "A_FINDTARGET"},
|
||||
{{A_FindTracer}, "A_FINDTRACER"},
|
||||
{{A_SetTics}, "A_SETTICS"},
|
||||
{{A_SetRandomTics}, "A_SETRANDOMTICS"},
|
||||
{{A_ChangeColorRelative}, "A_CHANGECOLORRELATIVE"},
|
||||
{{A_ChangeColorAbsolute}, "A_CHANGECOLORABSOLUTE"},
|
||||
{{A_MoveRelative}, "A_MOVERELATIVE"},
|
||||
{{A_MoveAbsolute}, "A_MOVEABSOLUTE"},
|
||||
{{A_Thrust}, "A_THRUST"},
|
||||
{{A_ZThrust}, "A_ZTHRUST"},
|
||||
{{A_SetTargetsTarget}, "A_SETTARGETSTARGET"},
|
||||
{{A_SetObjectFlags}, "A_SETOBJECTFLAGS"},
|
||||
{{A_SetObjectFlags2}, "A_SETOBJECTFLAGS2"},
|
||||
{{A_RandomState}, "A_RANDOMSTATE"},
|
||||
{{A_RandomStateRange}, "A_RANDOMSTATERANGE"},
|
||||
{{A_DualAction}, "A_DUALACTION"},
|
||||
{{A_RemoteAction}, "A_REMOTEACTION"},
|
||||
{{A_ToggleFlameJet}, "A_TOGGLEFLAMEJET"},
|
||||
{{A_ItemPop}, "A_ITEMPOP"}, // SRB2kart
|
||||
{{A_JawzChase}, "A_JAWZCHASE"}, // SRB2kart
|
||||
{{A_JawzExplode}, "A_JAWZEXPLODE"}, // SRB2kart
|
||||
{{A_SPBChase}, "A_SPBCHASE"}, // SRB2kart
|
||||
{{A_MineExplode}, "A_MINEEXPLODE"}, // SRB2kart
|
||||
{{A_BallhogExplode}, "A_BALLHOGEXPLODE"}, // SRB2kart
|
||||
{{A_LightningFollowPlayer},"A_LIGHTNINGFOLLOWPLAYER"}, //SRB2kart
|
||||
{{A_FZBoomFlash}, "A_FZBOOMFLASH"}, //SRB2kart
|
||||
{{A_FZBoomSmoke}, "A_FZBOOMSMOKE"}, //SRB2kart
|
||||
{{A_RandomShadowFrame}, "A_RANDOMSHADOWFRAME"}, //SRB2kart
|
||||
{{A_RoamingShadowThinker}, "A_ROAMINGSHADOWTHINKER"}, //SRB2kart
|
||||
{{A_MayonakaArrow}, "A_MAYONAKAARROW"}, //SRB2kart
|
||||
{{A_ReaperThinker}, "A_REAPERTHINKER"}, //SRB2kart
|
||||
{{A_MementosTPParticles}, "A_MEMENTOSTPPARTICLES"}, //SRB2kart
|
||||
{{A_FlameParticle}, "A_FLAMEPARTICLE"}, // SRB2kart
|
||||
{{A_OrbitNights}, "A_ORBITNIGHTS"},
|
||||
{{A_GhostMe}, "A_GHOSTME"},
|
||||
{{A_SetObjectState}, "A_SETOBJECTSTATE"},
|
||||
{{A_SetObjectTypeState}, "A_SETOBJECTTYPESTATE"},
|
||||
{{A_KnockBack}, "A_KNOCKBACK"},
|
||||
{{A_PushAway}, "A_PUSHAWAY"},
|
||||
{{A_RingDrain}, "A_RINGDRAIN"},
|
||||
{{A_SplitShot}, "A_SPLITSHOT"},
|
||||
{{A_MissileSplit}, "A_MISSILESPLIT"},
|
||||
{{A_MultiShot}, "A_MULTISHOT"},
|
||||
{{A_InstaLoop}, "A_INSTALOOP"},
|
||||
{{A_Custom3DRotate}, "A_CUSTOM3DROTATE"},
|
||||
{{A_SearchForPlayers}, "A_SEARCHFORPLAYERS"},
|
||||
{{A_CheckRandom}, "A_CHECKRANDOM"},
|
||||
{{A_CheckTargetRings}, "A_CHECKTARGETRINGS"},
|
||||
{{A_CheckRings}, "A_CHECKRINGS"},
|
||||
{{A_CheckTotalRings}, "A_CHECKTOTALRINGS"},
|
||||
{{A_CheckHealth}, "A_CHECKHEALTH"},
|
||||
{{A_CheckRange}, "A_CHECKRANGE"},
|
||||
{{A_CheckHeight}, "A_CHECKHEIGHT"},
|
||||
{{A_CheckTrueRange}, "A_CHECKTRUERANGE"},
|
||||
{{A_CheckThingCount}, "A_CHECKTHINGCOUNT"},
|
||||
{{A_CheckAmbush}, "A_CHECKAMBUSH"},
|
||||
{{A_CheckCustomValue}, "A_CHECKCUSTOMVALUE"},
|
||||
{{A_CheckCusValMemo}, "A_CHECKCUSVALMEMO"},
|
||||
{{A_SetCustomValue}, "A_SETCUSTOMVALUE"},
|
||||
{{A_UseCusValMemo}, "A_USECUSVALMEMO"},
|
||||
{{A_RelayCustomValue}, "A_RELAYCUSTOMVALUE"},
|
||||
{{A_CusValAction}, "A_CUSVALACTION"},
|
||||
{{A_ForceStop}, "A_FORCESTOP"},
|
||||
{{A_ForceWin}, "A_FORCEWIN"},
|
||||
{{A_SpikeRetract}, "A_SPIKERETRACT"},
|
||||
{{A_InfoState}, "A_INFOSTATE"},
|
||||
{{A_Repeat}, "A_REPEAT"},
|
||||
{{A_SetScale}, "A_SETSCALE"},
|
||||
{{A_RemoteDamage}, "A_REMOTEDAMAGE"},
|
||||
{{A_HomingChase}, "A_HOMINGCHASE"},
|
||||
{{A_TrapShot}, "A_TRAPSHOT"},
|
||||
{{A_VileTarget}, "A_VILETARGET"},
|
||||
{{A_VileAttack}, "A_VILEATTACK"},
|
||||
{{A_VileFire}, "A_VILEFIRE"},
|
||||
{{A_BrakChase}, "A_BRAKCHASE"},
|
||||
{{A_BrakFireShot}, "A_BRAKFIRESHOT"},
|
||||
{{A_BrakLobShot}, "A_BRAKLOBSHOT"},
|
||||
{{A_NapalmScatter}, "A_NAPALMSCATTER"},
|
||||
{{A_SpawnFreshCopy}, "A_SPAWNFRESHCOPY"},
|
||||
{A_Explode, "A_EXPLODE"},
|
||||
{A_Pain, "A_PAIN"},
|
||||
{A_Fall, "A_FALL"},
|
||||
{A_MonitorPop, "A_MONITORPOP"},
|
||||
{A_Look, "A_LOOK"},
|
||||
{A_Chase, "A_CHASE"},
|
||||
{A_FaceStabChase, "A_FACESTABCHASE"},
|
||||
{A_FaceTarget, "A_FACETARGET"},
|
||||
{A_FaceTracer, "A_FACETRACER"},
|
||||
{A_Scream, "A_SCREAM"},
|
||||
{A_BossDeath, "A_BOSSDEATH"},
|
||||
{A_CustomPower, "A_CUSTOMPOWER"},
|
||||
{A_GiveWeapon, "A_GIVEWEAPON"},
|
||||
{A_RingShield, "A_RINGSHIELD"},
|
||||
{A_RingBox, "A_RINGBOX"},
|
||||
{A_Invincibility, "A_INVINCIBILITY"},
|
||||
{A_SuperSneakers, "A_SUPERSNEAKERS"},
|
||||
{A_BunnyHop, "A_BUNNYHOP"},
|
||||
{A_BubbleSpawn, "A_BUBBLESPAWN"},
|
||||
{A_FanBubbleSpawn, "A_FANBUBBLESPAWN"},
|
||||
{A_BubbleRise, "A_BUBBLERISE"},
|
||||
{A_BubbleCheck, "A_BUBBLECHECK"},
|
||||
{A_AwardScore, "A_AWARDSCORE"},
|
||||
{A_ExtraLife, "A_EXTRALIFE"},
|
||||
{A_BombShield, "A_BOMBSHIELD"},
|
||||
{A_JumpShield, "A_JUMPSHIELD"},
|
||||
{A_WaterShield, "A_WATERSHIELD"},
|
||||
{A_ForceShield, "A_FORCESHIELD"},
|
||||
{A_PityShield, "A_PITYSHIELD"},
|
||||
{A_GravityBox, "A_GRAVITYBOX"},
|
||||
{A_ScoreRise, "A_SCORERISE"},
|
||||
{A_ParticleSpawn, "A_PARTICLESPAWN"},
|
||||
{A_AttractChase, "A_ATTRACTCHASE"},
|
||||
{A_DropMine, "A_DROPMINE"},
|
||||
{A_FishJump, "A_FISHJUMP"},
|
||||
{A_ThrownRing, "A_THROWNRING"},
|
||||
{A_GrenadeRing, "A_GRENADERING"}, // SRB2kart
|
||||
{A_SetSolidSteam, "A_SETSOLIDSTEAM"},
|
||||
{A_UnsetSolidSteam, "A_UNSETSOLIDSTEAM"},
|
||||
{A_SignPlayer, "A_SIGNPLAYER"},
|
||||
{A_OverlayThink, "A_OVERLAYTHINK"},
|
||||
{A_JetChase, "A_JETCHASE"},
|
||||
{A_JetbThink, "A_JETBTHINK"},
|
||||
{A_JetgThink, "A_JETGTHINK"},
|
||||
{A_JetgShoot, "A_JETGSHOOT"},
|
||||
{A_ShootBullet, "A_SHOOTBULLET"},
|
||||
{A_MinusDigging, "A_MINUSDIGGING"},
|
||||
{A_MinusPopup, "A_MINUSPOPUP"},
|
||||
{A_MinusCheck, "A_MINUSCHECK"},
|
||||
{A_ChickenCheck, "A_CHICKENCHECK"},
|
||||
{A_MouseThink, "A_MOUSETHINK"},
|
||||
{A_DetonChase, "A_DETONCHASE"},
|
||||
{A_CapeChase, "A_CAPECHASE"},
|
||||
{A_RotateSpikeBall, "A_ROTATESPIKEBALL"},
|
||||
{A_SlingAppear, "A_SLINGAPPEAR"},
|
||||
{A_MaceRotate, "A_MACEROTATE"},
|
||||
{A_UnidusBall, "A_UNIDUSBALL"},
|
||||
{A_RockSpawn, "A_ROCKSPAWN"},
|
||||
{A_SetFuse, "A_SETFUSE"},
|
||||
{A_CrawlaCommanderThink, "A_CRAWLACOMMANDERTHINK"},
|
||||
{A_SmokeTrailer, "A_SMOKETRAILER"},
|
||||
{A_RingExplode, "A_RINGEXPLODE"},
|
||||
{A_OldRingExplode, "A_OLDRINGEXPLODE"},
|
||||
{A_MixUp, "A_MIXUP"},
|
||||
{A_RecyclePowers, "A_RECYCLEPOWERS"},
|
||||
{A_Boss1Chase, "A_BOSS1CHASE"},
|
||||
{A_FocusTarget, "A_FOCUSTARGET"},
|
||||
{A_Boss2Chase, "A_BOSS2CHASE"},
|
||||
{A_Boss2Pogo, "A_BOSS2POGO"},
|
||||
{A_BossZoom, "A_BOSSZOOM"},
|
||||
{A_BossScream, "A_BOSSSCREAM"},
|
||||
{A_Boss2TakeDamage, "A_BOSS2TAKEDAMAGE"},
|
||||
{A_Boss7Chase, "A_BOSS7CHASE"},
|
||||
{A_GoopSplat, "A_GOOPSPLAT"},
|
||||
{A_Boss2PogoSFX, "A_BOSS2POGOSFX"},
|
||||
{A_Boss2PogoTarget, "A_BOSS2POGOTARGET"},
|
||||
{A_BossJetFume, "A_BOSSJETFUME"},
|
||||
{A_EggmanBox, "A_EGGMANBOX"},
|
||||
{A_TurretFire, "A_TURRETFIRE"},
|
||||
{A_SuperTurretFire, "A_SUPERTURRETFIRE"},
|
||||
{A_TurretStop, "A_TURRETSTOP"},
|
||||
{A_JetJawRoam, "A_JETJAWROAM"},
|
||||
{A_JetJawChomp, "A_JETJAWCHOMP"},
|
||||
{A_PointyThink, "A_POINTYTHINK"},
|
||||
{A_CheckBuddy, "A_CHECKBUDDY"},
|
||||
{A_HoodThink, "A_HOODTHINK"},
|
||||
{A_ArrowCheck, "A_ARROWCHECK"},
|
||||
{A_SnailerThink, "A_SNAILERTHINK"},
|
||||
{A_SharpChase, "A_SHARPCHASE"},
|
||||
{A_SharpSpin, "A_SHARPSPIN"},
|
||||
{A_VultureVtol, "A_VULTUREVTOL"},
|
||||
{A_VultureCheck, "A_VULTURECHECK"},
|
||||
{A_SkimChase, "A_SKIMCHASE"},
|
||||
{A_1upThinker, "A_1UPTHINKER"},
|
||||
{A_SkullAttack, "A_SKULLATTACK"},
|
||||
{A_LobShot, "A_LOBSHOT"},
|
||||
{A_FireShot, "A_FIRESHOT"},
|
||||
{A_SuperFireShot, "A_SUPERFIRESHOT"},
|
||||
{A_BossFireShot, "A_BOSSFIRESHOT"},
|
||||
{A_Boss7FireMissiles, "A_BOSS7FIREMISSILES"},
|
||||
{A_Boss1Laser, "A_BOSS1LASER"},
|
||||
{A_Boss4Reverse, "A_BOSS4REVERSE"},
|
||||
{A_Boss4SpeedUp, "A_BOSS4SPEEDUP"},
|
||||
{A_Boss4Raise, "A_BOSS4RAISE"},
|
||||
{A_SparkFollow, "A_SPARKFOLLOW"},
|
||||
{A_BuzzFly, "A_BUZZFLY"},
|
||||
{A_GuardChase, "A_GUARDCHASE"},
|
||||
{A_EggShield, "A_EGGSHIELD"},
|
||||
{A_SetReactionTime, "A_SETREACTIONTIME"},
|
||||
{A_Boss1Spikeballs, "A_BOSS1SPIKEBALLS"},
|
||||
{A_Boss3TakeDamage, "A_BOSS3TAKEDAMAGE"},
|
||||
{A_Boss3Path, "A_BOSS3PATH"},
|
||||
{A_LinedefExecute, "A_LINEDEFEXECUTE"},
|
||||
{A_PlaySeeSound, "A_PLAYSEESOUND"},
|
||||
{A_PlayAttackSound, "A_PLAYATTACKSOUND"},
|
||||
{A_PlayActiveSound, "A_PLAYACTIVESOUND"},
|
||||
{A_SpawnObjectAbsolute, "A_SPAWNOBJECTABSOLUTE"},
|
||||
{A_SpawnObjectRelative, "A_SPAWNOBJECTRELATIVE"},
|
||||
{A_ChangeAngleRelative, "A_CHANGEANGLERELATIVE"},
|
||||
{A_ChangeAngleAbsolute, "A_CHANGEANGLEABSOLUTE"},
|
||||
{A_PlaySound, "A_PLAYSOUND"},
|
||||
{A_FindTarget, "A_FINDTARGET"},
|
||||
{A_FindTracer, "A_FINDTRACER"},
|
||||
{A_SetTics, "A_SETTICS"},
|
||||
{A_SetRandomTics, "A_SETRANDOMTICS"},
|
||||
{A_ChangeColorRelative, "A_CHANGECOLORRELATIVE"},
|
||||
{A_ChangeColorAbsolute, "A_CHANGECOLORABSOLUTE"},
|
||||
{A_MoveRelative, "A_MOVERELATIVE"},
|
||||
{A_MoveAbsolute, "A_MOVEABSOLUTE"},
|
||||
{A_Thrust, "A_THRUST"},
|
||||
{A_ZThrust, "A_ZTHRUST"},
|
||||
{A_SetTargetsTarget, "A_SETTARGETSTARGET"},
|
||||
{A_SetObjectFlags, "A_SETOBJECTFLAGS"},
|
||||
{A_SetObjectFlags2, "A_SETOBJECTFLAGS2"},
|
||||
{A_RandomState, "A_RANDOMSTATE"},
|
||||
{A_RandomStateRange, "A_RANDOMSTATERANGE"},
|
||||
{A_DualAction, "A_DUALACTION"},
|
||||
{A_RemoteAction, "A_REMOTEACTION"},
|
||||
{A_ToggleFlameJet, "A_TOGGLEFLAMEJET"},
|
||||
{A_ItemPop, "A_ITEMPOP"}, // SRB2kart
|
||||
{A_JawzChase, "A_JAWZCHASE"}, // SRB2kart
|
||||
{A_JawzExplode, "A_JAWZEXPLODE"}, // SRB2kart
|
||||
{A_SPBChase, "A_SPBCHASE"}, // SRB2kart
|
||||
{A_MineExplode, "A_MINEEXPLODE"}, // SRB2kart
|
||||
{A_BallhogExplode, "A_BALLHOGEXPLODE"}, // SRB2kart
|
||||
{A_LightningFollowPlayer,"A_LIGHTNINGFOLLOWPLAYER"}, //SRB2kart
|
||||
{A_FZBoomFlash, "A_FZBOOMFLASH"}, //SRB2kart
|
||||
{A_FZBoomSmoke, "A_FZBOOMSMOKE"}, //SRB2kart
|
||||
{A_RandomShadowFrame, "A_RANDOMSHADOWFRAME"}, //SRB2kart
|
||||
{A_RoamingShadowThinker, "A_ROAMINGSHADOWTHINKER"}, //SRB2kart
|
||||
{A_MayonakaArrow, "A_MAYONAKAARROW"}, //SRB2kart
|
||||
{A_ReaperThinker, "A_REAPERTHINKER"}, //SRB2kart
|
||||
{A_MementosTPParticles, "A_MEMENTOSTPPARTICLES"}, //SRB2kart
|
||||
{A_FlameParticle, "A_FLAMEPARTICLE"}, // SRB2kart
|
||||
{A_OrbitNights, "A_ORBITNIGHTS"},
|
||||
{A_GhostMe, "A_GHOSTME"},
|
||||
{A_SetObjectState, "A_SETOBJECTSTATE"},
|
||||
{A_SetObjectTypeState, "A_SETOBJECTTYPESTATE"},
|
||||
{A_KnockBack, "A_KNOCKBACK"},
|
||||
{A_PushAway, "A_PUSHAWAY"},
|
||||
{A_RingDrain, "A_RINGDRAIN"},
|
||||
{A_SplitShot, "A_SPLITSHOT"},
|
||||
{A_MissileSplit, "A_MISSILESPLIT"},
|
||||
{A_MultiShot, "A_MULTISHOT"},
|
||||
{A_InstaLoop, "A_INSTALOOP"},
|
||||
{A_Custom3DRotate, "A_CUSTOM3DROTATE"},
|
||||
{A_SearchForPlayers, "A_SEARCHFORPLAYERS"},
|
||||
{A_CheckRandom, "A_CHECKRANDOM"},
|
||||
{A_CheckTargetRings, "A_CHECKTARGETRINGS"},
|
||||
{A_CheckRings, "A_CHECKRINGS"},
|
||||
{A_CheckTotalRings, "A_CHECKTOTALRINGS"},
|
||||
{A_CheckHealth, "A_CHECKHEALTH"},
|
||||
{A_CheckRange, "A_CHECKRANGE"},
|
||||
{A_CheckHeight, "A_CHECKHEIGHT"},
|
||||
{A_CheckTrueRange, "A_CHECKTRUERANGE"},
|
||||
{A_CheckThingCount, "A_CHECKTHINGCOUNT"},
|
||||
{A_CheckAmbush, "A_CHECKAMBUSH"},
|
||||
{A_CheckCustomValue, "A_CHECKCUSTOMVALUE"},
|
||||
{A_CheckCusValMemo, "A_CHECKCUSVALMEMO"},
|
||||
{A_SetCustomValue, "A_SETCUSTOMVALUE"},
|
||||
{A_UseCusValMemo, "A_USECUSVALMEMO"},
|
||||
{A_RelayCustomValue, "A_RELAYCUSTOMVALUE"},
|
||||
{A_CusValAction, "A_CUSVALACTION"},
|
||||
{A_ForceStop, "A_FORCESTOP"},
|
||||
{A_ForceWin, "A_FORCEWIN"},
|
||||
{A_SpikeRetract, "A_SPIKERETRACT"},
|
||||
{A_InfoState, "A_INFOSTATE"},
|
||||
{A_Repeat, "A_REPEAT"},
|
||||
{A_SetScale, "A_SETSCALE"},
|
||||
{A_RemoteDamage, "A_REMOTEDAMAGE"},
|
||||
{A_HomingChase, "A_HOMINGCHASE"},
|
||||
{A_TrapShot, "A_TRAPSHOT"},
|
||||
{A_VileTarget, "A_VILETARGET"},
|
||||
{A_VileAttack, "A_VILEATTACK"},
|
||||
{A_VileFire, "A_VILEFIRE"},
|
||||
{A_BrakChase, "A_BRAKCHASE"},
|
||||
{A_BrakFireShot, "A_BRAKFIRESHOT"},
|
||||
{A_BrakLobShot, "A_BRAKLOBSHOT"},
|
||||
{A_NapalmScatter, "A_NAPALMSCATTER"},
|
||||
{A_SpawnFreshCopy, "A_SPAWNFRESHCOPY"},
|
||||
//{A_InvincSparkleRotate, "A_INVINCSPARKLEROTATE"},
|
||||
|
||||
{{NULL}, "NONE"},
|
||||
{NULL, "NONE"},
|
||||
|
||||
// This NULL entry must be the last in the list
|
||||
{{NULL}, NULL},
|
||||
{NULL, NULL},
|
||||
};
|
||||
|
||||
static void readframe(MYFILE *f, INT32 num)
|
||||
@@ -1702,7 +1703,7 @@ static void readframe(MYFILE *f, INT32 num)
|
||||
|
||||
for (z = 0; actionpointers[z].name; z++)
|
||||
{
|
||||
if (actionpointers[z].action.acv == states[num].action.acv)
|
||||
if (actionpointers[z].action == states[num].action)
|
||||
{
|
||||
break;
|
||||
}
|
||||
@@ -1711,17 +1712,17 @@ static void readframe(MYFILE *f, INT32 num)
|
||||
z = 0;
|
||||
found = LUA_SetLuaAction(&states[num], actiontocompare);
|
||||
if (!found)
|
||||
while (actionpointers[z].name)
|
||||
{
|
||||
if (fastcmp(actiontocompare, actionpointers[z].name))
|
||||
while (actionpointers[z].name)
|
||||
{
|
||||
states[num].action = actionpointers[z].action;
|
||||
states[num].action.acv = actionpointers[z].action.acv; // assign
|
||||
states[num].action.acp1 = actionpointers[z].action.acp1;
|
||||
found = true;
|
||||
break;
|
||||
if (fastcmp(actiontocompare, actionpointers[z].name))
|
||||
{
|
||||
states[num].action = actionpointers[z].action;
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
z++;
|
||||
}
|
||||
z++;
|
||||
}
|
||||
|
||||
if (!found)
|
||||
@@ -8524,13 +8525,13 @@ static inline int lib_freeslot(lua_State *L)
|
||||
// Arguments: mobj_t actor, int var1, int var2
|
||||
static inline int lib_action(lua_State *L)
|
||||
{
|
||||
actionf_t *action = lua_touserdata(L,lua_upvalueindex(1));
|
||||
actionf_p1 *action = lua_touserdata(L,lua_upvalueindex(1));
|
||||
mobj_t *actor = *((mobj_t **)luaL_checkudata(L,1,META_MOBJ));
|
||||
var1 = (INT32)luaL_optinteger(L,2,0);
|
||||
var2 = (INT32)luaL_optinteger(L,3,0);
|
||||
if (!actor)
|
||||
return LUA_ErrInvalid(L, "mobj_t");
|
||||
action->acp1(actor);
|
||||
(*action)(actor);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -9344,13 +9345,15 @@ int LUA_SOCLib(lua_State *L)
|
||||
|
||||
const char *LUA_GetActionName(void *action)
|
||||
{
|
||||
actionf_t *act = (actionf_t *)action;
|
||||
actionf_p1 *act = (actionf_p1 *)action;
|
||||
size_t z;
|
||||
|
||||
for (z = 0; actionpointers[z].name; z++)
|
||||
{
|
||||
if (actionpointers[z].action.acv == act->acv)
|
||||
if (actionpointers[z].action == *act)
|
||||
return actionpointers[z].name;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -9363,8 +9366,6 @@ void LUA_SetActionByName(void *state, const char *actiontocompare)
|
||||
if (fasticmp(actiontocompare, actionpointers[z].name))
|
||||
{
|
||||
st->action = actionpointers[z].action;
|
||||
st->action.acv = actionpointers[z].action.acv; // assign
|
||||
st->action.acp1 = actionpointers[z].action.acp1;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Loaded 100 of 174 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user