diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-25 22:56:37 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2012-07-25 22:56:37 +0300 |
commit | 40eefdd931066129d0bb2f6144a0ec7741c6cc2b (patch) | |
tree | 7f1cd006b2f53d7c03f778dfc275ee7de1895276 | |
parent | 4bb85f0f0e221c158b1a81af286acb422834c0fd (diff) | |
download | egawk-40eefdd931066129d0bb2f6144a0ec7741c6cc2b.tar.gz egawk-40eefdd931066129d0bb2f6144a0ec7741c6cc2b.tar.bz2 egawk-40eefdd931066129d0bb2f6144a0ec7741c6cc2b.zip |
Remove translation of errno strings from API.
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | awk.h | 3 | ||||
-rw-r--r-- | eval.c | 6 | ||||
-rw-r--r-- | extension/ChangeLog | 2 | ||||
-rw-r--r-- | extension/time.c | 8 | ||||
-rw-r--r-- | gawkapi.c | 5 | ||||
-rw-r--r-- | gawkapi.h | 7 | ||||
-rw-r--r-- | io.c | 2 |
8 files changed, 28 insertions, 18 deletions
@@ -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. @@ -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); @@ -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); @@ -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 */ @@ -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)) @@ -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); |