aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-07-25 23:10:35 +0300
committerArnold D. Robbins <arnold@skeeve.com>2012-07-25 23:10:35 +0300
commit7e5b2a94ce3c089c50c5862168d1d917e5febcf4 (patch)
tree41b6a17e241279bcc9fc25765a0aeb6c461b7a76
parent40eefdd931066129d0bb2f6144a0ec7741c6cc2b (diff)
downloadegawk-7e5b2a94ce3c089c50c5862168d1d917e5febcf4.tar.gz
egawk-7e5b2a94ce3c089c50c5862168d1d917e5febcf4.tar.bz2
egawk-7e5b2a94ce3c089c50c5862168d1d917e5febcf4.zip
Add translation to the extensions.
-rw-r--r--extension/ChangeLog3
-rw-r--r--extension/filefuncs.c10
-rw-r--r--extension/fnmatch.c24
-rw-r--r--extension/fork.c14
-rw-r--r--extension/ordchr.c16
-rw-r--r--extension/readfile.c8
-rw-r--r--extension/rwarray.c24
-rw-r--r--extension/time.c16
-rw-r--r--po/POTFILES.in7
9 files changed, 81 insertions, 41 deletions
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 9f60bd07..1836b2cc 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -5,6 +5,9 @@
* time.c: Fix all calls to update_ERRNO_string.
+ * filefuncs.c, fnmatch.c, fork.c, ordchr.c, readfile.c, rwarray.c,
+ time.c: Translate strings.
+
2012-07-20 Arnold D. Robbins <arnold@skeeve.com>
* filefuncs.3am, fnmatch.3am, ordchr.3am, readfile.3am:
diff --git a/extension/filefuncs.c b/extension/filefuncs.c
index 41783c85..e8c16e8f 100644
--- a/extension/filefuncs.c
+++ b/extension/filefuncs.c
@@ -42,6 +42,10 @@
#include "config.h"
#include "gawkapi.h"
+#include "gettext.h"
+#define _(msgid) gettext(msgid)
+#define N_(msgid) msgid
+
static const gawk_api_t *api; /* for convenience macros to work */
static awk_ext_id_t *ext_id;
static awk_bool_t (*init_func)(void) = NULL;
@@ -59,7 +63,7 @@ do_chdir(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs != 1)
- lintwarn(ext_id, "chdir: called with incorrect number of arguments, expecting 1");
+ lintwarn(ext_id, _("chdir: called with incorrect number of arguments, expecting 1"));
if (get_argument(0, AWK_STRING, & newdir)) {
ret = chdir(newdir.str_value.str);
@@ -339,14 +343,14 @@ do_stat(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs != 2) {
- lintwarn(ext_id, "stat: called with wrong number of arguments");
+ lintwarn(ext_id, _("stat: called with wrong number of arguments"));
return make_number(-1, result);
}
/* file is first arg, array to hold results is second */
if ( ! get_argument(0, AWK_STRING, & file_param)
|| ! get_argument(1, AWK_ARRAY, & array_param)) {
- warning(ext_id, "stat: bad parameters");
+ warning(ext_id, _("stat: bad parameters"));
return make_number(-1, result);
}
diff --git a/extension/fnmatch.c b/extension/fnmatch.c
index d28e2655..3ebae595 100644
--- a/extension/fnmatch.c
+++ b/extension/fnmatch.c
@@ -39,6 +39,10 @@
#include "config.h"
#include "gawkapi.h"
+#include "gettext.h"
+#define _(msgid) gettext(msgid)
+#define N_(msgid) msgid
+
#ifdef HAVE_FNMATCH_H
#define _GNU_SOURCE 1 /* use GNU extensions if they're there */
#include <fnmatch.h>
@@ -69,33 +73,35 @@ int plugin_is_GPL_compatible;
static awk_value_t *
do_fnmatch(int nargs, awk_value_t *result)
{
+#ifdef HAVE_FNMATCH_H
static int flags_mask =
FNM_CASEFOLD | FNM_FILE_NAME |
FNM_LEADING_DIR | FNM_NOESCAPE |
FNM_PATHNAME | FNM_PERIOD ;
+#endif
awk_value_t pattern, string, flags;
int int_flags, retval;
make_number(-1.0, result); /* default return */
#ifdef HAVE_FNMATCH
if (nargs < 3) {
- warning(ext_id, "fnmatch: called with less than three arguments");
+ warning(ext_id, _("fnmatch: called with less than three arguments"));
goto out;
} else if (do_lint && nargs > 3)
- lintwarn(ext_id, "fnmatch: called with more than three arguments");
+ lintwarn(ext_id, _("fnmatch: called with more than three arguments"));
if (! get_argument(0, AWK_STRING, & pattern)) {
- warning(ext_id, "fnmatch: could not get first argument");
+ warning(ext_id, _("fnmatch: could not get first argument"));
goto out;
}
if (! get_argument(1, AWK_STRING, & string)) {
- warning(ext_id, "fnmatch: could not get second argument");
+ warning(ext_id, _("fnmatch: could not get second argument"));
goto out;
}
if (! get_argument(2, AWK_NUMBER, & flags)) {
- warning(ext_id, "fnmatch: could not get third argument");
+ warning(ext_id, _("fnmatch: could not get third argument"));
goto out;
}
@@ -108,7 +114,7 @@ do_fnmatch(int nargs, awk_value_t *result)
out:
#else
- fatal(ext_id, "fnmatch is not implemented on this system\n");
+ fatal(ext_id, _("fnmatch is not implemented on this system\n"));
#endif
return result;
}
@@ -140,7 +146,7 @@ init_fnmatch(void)
int i;
if (! sym_constant("FNM_NOMATCH", make_number(FNM_NOMATCH, & value))) {
- warning(ext_id, "fnmatch init: could not add FNM_NOMATCH variable");
+ warning(ext_id, _("fnmatch init: could not add FNM_NOMATCH variable"));
errors++;
}
@@ -150,7 +156,7 @@ init_fnmatch(void)
strlen(flagtable[i].name), & index);
(void) make_number(flagtable[i].value, & value);
if (! set_array_element(new_array, & index, & value)) {
- warning(ext_id, "fnmatch init: could not set array element %s",
+ warning(ext_id, _("fnmatch init: could not set array element %s"),
flagtable[i].name);
errors++;
}
@@ -160,7 +166,7 @@ init_fnmatch(void)
the_array.array_cookie = new_array;
if (! sym_update("FNM", & the_array)) {
- warning(ext_id, "fnmatch init: could not install FNM array");
+ warning(ext_id, _("fnmatch init: could not install FNM array"));
errors++;
}
diff --git a/extension/fork.c b/extension/fork.c
index 02b6b6f2..7bee8ba1 100644
--- a/extension/fork.c
+++ b/extension/fork.c
@@ -39,6 +39,10 @@
#include "config.h"
#include "gawkapi.h"
+#include "gettext.h"
+#define _(msgid) gettext(msgid)
+#define N_(msgid) msgid
+
static const gawk_api_t *api; /* for convenience macros to work */
static awk_ext_id_t *ext_id;
static awk_bool_t (*init_func)(void) = NULL;
@@ -69,7 +73,7 @@ do_fork(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs > 0)
- lintwarn(ext_id, "fork: called with too many arguments");
+ lintwarn(ext_id, _("fork: called with too many arguments"));
ret = fork();
@@ -82,7 +86,7 @@ do_fork(int nargs, awk_value_t *result)
if (sym_lookup("PROCINFO", AWK_ARRAY, & procinfo)) {
if (procinfo.val_type != AWK_ARRAY) {
if (do_lint)
- lintwarn(ext_id, "fork: PROCINFO is not an array!");
+ lintwarn(ext_id, _("fork: PROCINFO is not an array!"));
} else {
array_set_numeric(procinfo.array_cookie, "pid", getpid());
array_set_numeric(procinfo.array_cookie, "ppid", getppid());
@@ -106,7 +110,7 @@ do_waitpid(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs > 1)
- lintwarn(ext_id, "waitpid: called with too many arguments");
+ lintwarn(ext_id, _("waitpid: called with too many arguments"));
if (get_argument(0, AWK_NUMBER, &pid)) {
options = WNOHANG|WUNTRACED;
@@ -114,7 +118,7 @@ do_waitpid(int nargs, awk_value_t *result)
if (ret < 0)
update_ERRNO_int(errno);
} else if (do_lint)
- lintwarn(ext_id, "wait: called with no arguments");
+ lintwarn(ext_id, _("wait: called with no arguments"));
/* Set the return value */
return make_number(ret, result);
@@ -131,7 +135,7 @@ do_wait(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs > 0)
- lintwarn(ext_id, "wait: called with too many arguments");
+ lintwarn(ext_id, _("wait: called with too many arguments"));
ret = wait(NULL);
if (ret < 0)
diff --git a/extension/ordchr.c b/extension/ordchr.c
index 7773f1b9..01466f1a 100644
--- a/extension/ordchr.c
+++ b/extension/ordchr.c
@@ -41,6 +41,10 @@
#include "config.h"
#include "gawkapi.h"
+#include "gettext.h"
+#define _(msgid) gettext(msgid)
+#define N_(msgid) msgid
+
static const gawk_api_t *api; /* for convenience macros to work */
static awk_ext_id_t *ext_id;
static awk_bool_t (*init_func)(void) = NULL;
@@ -58,15 +62,15 @@ do_ord(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs > 1)
- lintwarn(ext_id, "ord: called with too many arguments");
+ lintwarn(ext_id, _("ord: called with too many arguments"));
if (get_argument(0, AWK_STRING, & str)) {
ret = str.str_value.str[0];
} else if (do_lint) {
if (nargs == 0)
- lintwarn(ext_id, "ord: called with no arguments");
+ lintwarn(ext_id, _("ord: called with no arguments"));
else
- lintwarn(ext_id, "ord: called with inappropriate argument(s)");
+ lintwarn(ext_id, _("ord: called with inappropriate argument(s)"));
}
/* Set the return value */
@@ -88,7 +92,7 @@ do_chr(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs > 1)
- lintwarn(ext_id, "chr: called with too many arguments");
+ lintwarn(ext_id, _("chr: called with too many arguments"));
if (get_argument(0, AWK_NUMBER, & num)) {
val = num.num_value;
@@ -98,9 +102,9 @@ do_chr(int nargs, awk_value_t *result)
str[1] = '\0';
} else if (do_lint) {
if (nargs == 0)
- lintwarn(ext_id, "chr: called with no arguments");
+ lintwarn(ext_id, _("chr: called with no arguments"));
else
- lintwarn(ext_id, "chr: called with inappropriate argument(s)");
+ lintwarn(ext_id, _("chr: called with inappropriate argument(s)"));
}
/* Set the return value */
diff --git a/extension/readfile.c b/extension/readfile.c
index f9a364fb..8f68c247 100644
--- a/extension/readfile.c
+++ b/extension/readfile.c
@@ -44,6 +44,10 @@
#include "config.h"
#include "gawkapi.h"
+#include "gettext.h"
+#define _(msgid) gettext(msgid)
+#define N_(msgid) msgid
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
@@ -69,7 +73,7 @@ do_readfile(int nargs, awk_value_t *result)
make_null_string(result); /* default return value */
if (do_lint && nargs > 1)
- lintwarn(ext_id, "readfile: called with too many arguments");
+ lintwarn(ext_id, _("readfile: called with too many arguments"));
unset_ERRNO();
@@ -102,7 +106,7 @@ do_readfile(int nargs, awk_value_t *result)
make_malloced_string(text, sbuf.st_size, result);
goto done;
} else if (do_lint)
- lintwarn(ext_id, "readfile: called with no arguments");
+ lintwarn(ext_id, _("readfile: called with no arguments"));
done:
diff --git a/extension/rwarray.c b/extension/rwarray.c
index 8a749498..75c735a4 100644
--- a/extension/rwarray.c
+++ b/extension/rwarray.c
@@ -41,6 +41,10 @@
#include "gawkapi.h"
+#include "gettext.h"
+#define _(msgid) gettext(msgid)
+#define N_(msgid) msgid
+
#define MAGIC "awkrulz\n"
#define MAJOR 3
#define MINOR 0
@@ -97,20 +101,20 @@ do_writea(int nargs, awk_value_t *result)
make_number(0.0, result);
if (do_lint && nargs > 2)
- lintwarn(ext_id, "writea: called with too many arguments");
+ lintwarn(ext_id, _("writea: called with too many arguments"));
if (nargs < 2)
goto out;
/* directory is first arg, array to dump is second */
if (! get_argument(0, AWK_STRING, & filename)) {
- fprintf(stderr, "do_writea: argument 0 is not a string\n");
+ fprintf(stderr, _("do_writea: argument 0 is not a string\n"));
errno = EINVAL;
goto done1;
}
if (! get_argument(1, AWK_ARRAY, & array)) {
- fprintf(stderr, "do_writea: argument 1 is not an array\n");
+ fprintf(stderr, _("do_writea: argument 1 is not an array\n"));
errno = EINVAL;
goto done1;
}
@@ -157,7 +161,7 @@ write_array(int fd, awk_array_t array)
awk_flat_array_t *flat_array;
if (! flatten_array(array, & flat_array)) {
- printf("write_array: could not flatten array\n");
+ fprintf(stderr, _("write_array: could not flatten array\n"));
return 0;
}
@@ -171,7 +175,7 @@ write_array(int fd, awk_array_t array)
}
if (! release_flattened_array(array, flat_array)) {
- printf("write_array: could not release flattened array\n");
+ fprintf(stderr, _("write_array: could not release flattened array\n"));
return 0;
}
@@ -253,20 +257,20 @@ do_reada(int nargs, awk_value_t *result)
make_number(0.0, result);
if (do_lint && nargs > 2)
- lintwarn(ext_id, "reada: called with too many arguments");
+ lintwarn(ext_id, _("reada: called with too many arguments"));
if (nargs < 2)
goto out;
/* directory is first arg, array to read is second */
if (! get_argument(0, AWK_STRING, & filename)) {
- fprintf(stderr, "do_reada: argument 0 is not a string\n");
+ fprintf(stderr, _("do_reada: argument 0 is not a string\n"));
errno = EINVAL;
goto done1;
}
if (! get_argument(1, AWK_ARRAY, & array)) {
- fprintf(stderr, "do_reada: argument 1 is not an array\n");
+ fprintf(stderr, _("do_reada: argument 1 is not an array\n"));
errno = EINVAL;
goto done1;
}
@@ -310,7 +314,7 @@ do_reada(int nargs, awk_value_t *result)
if (! clear_array(array.array_cookie)) {
errno = ENOMEM;
- printf("do_reada: clear_array failed\n");
+ fprintf(stderr, _("do_reada: clear_array failed\n"));
goto done1;
}
@@ -346,7 +350,7 @@ read_array(int fd, awk_array_t array)
if (read_elem(fd, & new_elem)) {
/* add to array */
if (! set_array_element_by_elem(array, & new_elem)) {
- printf("read_array: set_array_element failed\n");
+ fprintf(stderr, _("read_array: set_array_element failed\n"));
return 0;
}
} else
diff --git a/extension/time.c b/extension/time.c
index 60e569a8..7e3fc521 100644
--- a/extension/time.c
+++ b/extension/time.c
@@ -37,6 +37,10 @@
#include "config.h"
#include "gawkapi.h"
+#include "gettext.h"
+#define _(msgid) gettext(msgid)
+#define N_(msgid) msgid
+
static const gawk_api_t *api; /* for convenience macros to work */
static awk_ext_id_t *ext_id;
static awk_bool_t (*init_func)(void) = NULL;
@@ -66,7 +70,7 @@ do_gettimeofday(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs > 0)
- lintwarn(ext_id, "gettimeofday: ignoring arguments");
+ lintwarn(ext_id, _("gettimeofday: ignoring arguments"));
#if defined(HAVE_GETTIMEOFDAY)
{
@@ -97,7 +101,7 @@ do_gettimeofday(int nargs, awk_value_t *result)
#else
/* no way to retrieve system time on this platform */
curtime = -1;
- update_ERRNO_string("gettimeofday: not supported on this platform");
+ update_ERRNO_string(_("gettimeofday: not supported on this platform"));
#endif
return make_number(curtime, result);
@@ -118,16 +122,16 @@ do_sleep(int nargs, awk_value_t *result)
assert(result != NULL);
if (do_lint && nargs > 1)
- lintwarn(ext_id, "sleep: called with too many arguments");
+ lintwarn(ext_id, _("sleep: called with too many arguments"));
if (! get_argument(0, AWK_NUMBER, &num)) {
- update_ERRNO_string("sleep: missing required numeric argument");
+ update_ERRNO_string(_("sleep: missing required numeric argument"));
return make_number(-1, result);
}
secs = num.num_value;
if (secs < 0) {
- update_ERRNO_string("sleep: argument is negative");
+ update_ERRNO_string(_("sleep: argument is negative"));
return make_number(-1, result);
}
@@ -154,7 +158,7 @@ do_sleep(int nargs, awk_value_t *result)
#else
/* no way to sleep on this platform */
rc = -1;
- update_ERRNO_str("sleep: not supported on this platform");
+ update_ERRNO_str(_("sleep: not supported on this platform"));
#endif
return make_number(rc, result);
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 3934d7ff..f62ba39b 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -10,6 +10,13 @@ debug.c
dfa.c
eval.c
ext.c
+extension/filefuncs.c
+extension/fnmatch.c
+extension/fork.c
+extension/ordchr.c
+extension/readfile.c
+extension/rwarray.c
+extension/time.c
field.c
floatcomp.c
gawkapi.c