aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2012-07-25 22:56:37 +0300
committerArnold D. Robbins <arnold@skeeve.com>2012-07-25 22:56:37 +0300
commit40eefdd931066129d0bb2f6144a0ec7741c6cc2b (patch)
tree7f1cd006b2f53d7c03f778dfc275ee7de1895276
parent4bb85f0f0e221c158b1a81af286acb422834c0fd (diff)
downloadegawk-40eefdd931066129d0bb2f6144a0ec7741c6cc2b.tar.gz
egawk-40eefdd931066129d0bb2f6144a0ec7741c6cc2b.tar.bz2
egawk-40eefdd931066129d0bb2f6144a0ec7741c6cc2b.zip
Remove translation of errno strings from API.
-rw-r--r--ChangeLog13
-rw-r--r--awk.h3
-rw-r--r--eval.c6
-rw-r--r--extension/ChangeLog2
-rw-r--r--extension/time.c8
-rw-r--r--gawkapi.c5
-rw-r--r--gawkapi.h7
-rw-r--r--io.c2
8 files changed, 28 insertions, 18 deletions
diff --git a/ChangeLog b/ChangeLog
index 6d097640..a80439aa 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1399,6 +1399,19 @@
* pprint (profile.c): Add case for the new opcode.
* print_instruction (debug.c): Ditto.
+ Take out translation for errno strings; extensions will
+ need to use their own domain.
+
+ * awk.h (enum errno_translate): Removed.
+ (update_ERRNO_string): Remove second translate paramater.
+ * eval.c (update_ERRNO_string): Remove second translate paramater
+ and code that used it.
+ * gawkapi.h (api_update_ERRNO_string): Remove third translate
+ parameter.
+ * gawkapi.c (api_update_ERRNO_string): Remove third translate
+ paramater and change call to update_ERRNO_string.
+ * io.c (do_close): Fix call to update_ERRNO_string.
+
2011-07-15 Arnold D. Robbins <arnold@skeeve.com>
* awk.h: Typo fix: "loner" --> longer. Thanks to Nelson Beebe.
diff --git a/awk.h b/awk.h
index fbb57b01..ddde04bd 100644
--- a/awk.h
+++ b/awk.h
@@ -1477,8 +1477,7 @@ extern void set_BINMODE(void);
extern void set_LINT(void);
extern void set_TEXTDOMAIN(void);
extern void update_ERRNO_int(int);
-enum errno_translate { TRANSLATE, DONT_TRANSLATE };
-extern void update_ERRNO_string(const char *string, enum errno_translate);
+extern void update_ERRNO_string(const char *string);
extern void unset_ERRNO(void);
extern void update_NR(void);
extern void update_NF(void);
diff --git a/eval.c b/eval.c
index 9b3e8e01..f7037872 100644
--- a/eval.c
+++ b/eval.c
@@ -1007,13 +1007,11 @@ update_ERRNO_int(int errcode)
ERRNO_node->var_value = make_string(cp, strlen(cp));
}
-/* update_ERRNO_string --- update ERRNO with optionally translated string */
+/* update_ERRNO_string --- update ERRNO */
void
-update_ERRNO_string(const char *string, enum errno_translate translate)
+update_ERRNO_string(const char *string)
{
- if (translate == TRANSLATE)
- string = gettext(string);
unref(ERRNO_node->var_value);
ERRNO_node->var_value = make_string(string, strlen(string));
}
diff --git a/extension/ChangeLog b/extension/ChangeLog
index 939a6aed..9f60bd07 100644
--- a/extension/ChangeLog
+++ b/extension/ChangeLog
@@ -3,6 +3,8 @@
* readdir.c: New file.
* Makefile.am (readdir): New extension.
+ * time.c: Fix all calls to update_ERRNO_string.
+
2012-07-20 Arnold D. Robbins <arnold@skeeve.com>
* filefuncs.3am, fnmatch.3am, ordchr.3am, readfile.3am:
diff --git a/extension/time.c b/extension/time.c
index eb42eee2..60e569a8 100644
--- a/extension/time.c
+++ b/extension/time.c
@@ -97,7 +97,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", 1);
+ update_ERRNO_string("gettimeofday: not supported on this platform");
#endif
return make_number(curtime, result);
@@ -121,13 +121,13 @@ do_sleep(int nargs, awk_value_t *result)
lintwarn(ext_id, "sleep: called with too many arguments");
if (! get_argument(0, AWK_NUMBER, &num)) {
- update_ERRNO_string("sleep: missing required numeric argument", 1);
+ 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", 1);
+ update_ERRNO_string("sleep: argument is negative");
return make_number(-1, result);
}
@@ -154,7 +154,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", 1);
+ update_ERRNO_str("sleep: not supported on this platform");
#endif
return make_number(rc, result);
diff --git a/gawkapi.c b/gawkapi.c
index 09c9f399..b72a62a6 100644
--- a/gawkapi.c
+++ b/gawkapi.c
@@ -241,12 +241,11 @@ api_update_ERRNO_int(awk_ext_id_t id, int errno_val)
static void
api_update_ERRNO_string(awk_ext_id_t id,
- const char *string,
- awk_bool_t translate)
+ const char *string)
{
(void) id;
- update_ERRNO_string(string, (translate ? TRANSLATE : DONT_TRANSLATE));
+ update_ERRNO_string(string);
}
/* api_unset_ERRNO --- unset ERRNO */
diff --git a/gawkapi.h b/gawkapi.h
index 58162002..b8422db5 100644
--- a/gawkapi.h
+++ b/gawkapi.h
@@ -294,8 +294,7 @@ typedef struct gawk_api {
/* Functions to update ERRNO */
void (*api_update_ERRNO_int)(awk_ext_id_t id, int errno_val);
- void (*api_update_ERRNO_string)(awk_ext_id_t id, const char *string,
- awk_bool_t translate);
+ void (*api_update_ERRNO_string)(awk_ext_id_t id, const char *string);
void (*api_unset_ERRNO)(awk_ext_id_t id);
/* Add a function to the interpreter, returns true upon success */
@@ -475,8 +474,8 @@ typedef struct gawk_api {
#define register_input_parser(parser) (api->api_register_input_parser(ext_id, parser))
#define update_ERRNO_int(e) (api->api_update_ERRNO_int(ext_id, e))
-#define update_ERRNO_string(str, translate) \
- (api->api_update_ERRNO_string(ext_id, str, translate))
+#define update_ERRNO_string(str) \
+ (api->api_update_ERRNO_string(ext_id, str))
#define unset_ERRNO() (api->api_unset_ERRNO(ext_id))
#define add_ext_func(func, ns) (api->api_add_ext_func(ext_id, func, ns))
diff --git a/io.c b/io.c
index 584e434c..6cfc3efe 100644
--- a/io.c
+++ b/io.c
@@ -1018,7 +1018,7 @@ do_close(int nargs)
if (! do_traditional) {
/* update ERRNO manually, using errno = ENOENT is a stretch. */
cp = _("close of redirection that was never opened");
- update_ERRNO_string(cp, DONT_TRANSLATE);
+ update_ERRNO_string(cp);
}
DEREF(tmp);