diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2009-12-05 10:44:04 -0800 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2009-12-05 10:44:04 -0800 |
commit | 0c86abee82a66963ec3c46e36c63ba8df89e1fa9 (patch) | |
tree | cd49af1479fea5c6550161039d24b249b6a9c7e1 | |
parent | bdfe648ad88513857c3f9ef670ac0cae47bd606c (diff) | |
download | txr-0c86abee82a66963ec3c46e36c63ba8df89e1fa9.tar.gz txr-0c86abee82a66963ec3c46e36c63ba8df89e1fa9.tar.bz2 txr-0c86abee82a66963ec3c46e36c63ba8df89e1fa9.zip |
More void * to mem_t * conversion.
-rw-r--r-- | ChangeLog | 12 | ||||
-rw-r--r-- | stream.c | 12 | ||||
-rw-r--r-- | utf8.c | 4 | ||||
-rw-r--r-- | utf8.h | 4 |
4 files changed, 22 insertions, 10 deletions
@@ -1,3 +1,15 @@ +2009-12-05 Kaz Kylheku <kkylheku@gmail.com> + + More void * to mem_t * conversion. + + * stream.c (stdio_put_char_callback, stdio_get_char_callback, + stdio_put_string, stdio_put_char, stdio_snarf_line, stdio_get_char): + Convert void * to mem_t *. + + * utf8.c (utf8_encode, utf8_decode): Convert void * to mem_t *. + + * utf8.h (utf8_encode, utf8_decode): Update declarations. + 2009-12-04 Kaz Kylheku <kkylheku@gmail.com> Eliminate the void * disease. Generic pointers are of mem_t * @@ -112,12 +112,12 @@ static val stdio_maybe_write_error(val stream) stream, num(errno), string_utf8(strerror(errno)), nao); } -static int stdio_put_char_callback(int ch, void *f) +static int stdio_put_char_callback(int ch, mem_t *f) { return putc(ch, (FILE *) f) != EOF; } -static int stdio_get_char_callback(void *f) +static int stdio_get_char_callback(mem_t *f) { return getc((FILE *) f); } @@ -129,7 +129,7 @@ static val stdio_put_string(val stream, val str) if (h->f != 0) { const wchar_t *s = c_str(str); while (*s) { - if (!utf8_encode(*s++, stdio_put_char_callback, h->f)) + if (!utf8_encode(*s++, stdio_put_char_callback, (mem_t *) h->f)) return stdio_maybe_write_error(stream); } return t; @@ -140,7 +140,7 @@ static val stdio_put_string(val stream, val str) static val stdio_put_char(val stream, val ch) { struct stdio_handle *h = (struct stdio_handle *) stream->co.handle; - return h->f != 0 && utf8_encode(c_chr(ch), stdio_put_char_callback, h->f) + return h->f != 0 && utf8_encode(c_chr(ch), stdio_put_char_callback, (mem_t *) h->f) ? t : stdio_maybe_write_error(stream); } @@ -152,7 +152,7 @@ static wchar_t *snarf_line(struct stdio_handle *h) wchar_t *buf = 0; for (;;) { - wint_t ch = utf8_decode(&h->ud, stdio_get_char_callback, h->f); + wint_t ch = utf8_decode(&h->ud, stdio_get_char_callback, (mem_t *) h->f); if (ch == WEOF && buf == 0) break; @@ -193,7 +193,7 @@ static val stdio_get_char(val stream) { struct stdio_handle *h = (struct stdio_handle *) stream->co.handle; if (h->f) { - wint_t ch = utf8_decode(&h->ud, stdio_get_char_callback, h->f); + wint_t ch = utf8_decode(&h->ud, stdio_get_char_callback, (mem_t *) h->f); return (ch != WEOF) ? chr(ch) : stdio_maybe_read_error(stream); } return stdio_maybe_read_error(stream); @@ -184,7 +184,7 @@ char *utf8_dup_to(const wchar_t *wstr) return str; } -int utf8_encode(wchar_t wch, int (*put)(int ch, void *ctx), void *ctx) +int utf8_encode(wchar_t wch, int (*put)(int ch, mem_t *ctx), mem_t *ctx) { if (wch < 0x80) { return put(wch, ctx); @@ -212,7 +212,7 @@ void utf8_decoder_init(utf8_decoder_t *ud) ud->head = ud->tail = ud->back = 0; } -wint_t utf8_decode(utf8_decoder_t *ud, int (*get)(void *ctx), void *ctx) +wint_t utf8_decode(utf8_decoder_t *ud, int (*get)(mem_t *ctx), mem_t *ctx) { for (;;) { int ch; @@ -42,9 +42,9 @@ typedef struct utf8_decoder { int buf[8]; } utf8_decoder_t; -int utf8_encode(wchar_t, int (*put)(int ch, void *ctx), void *ctx); +int utf8_encode(wchar_t, int (*put)(int ch, mem_t *ctx), mem_t *ctx); void utf8_decoder_init(utf8_decoder_t *); -wint_t utf8_decode(utf8_decoder_t *,int (*get)(void *ctx), void *ctx); +wint_t utf8_decode(utf8_decoder_t *,int (*get)(mem_t *ctx), mem_t *ctx); FILE *w_fopen(const wchar_t *, const wchar_t *); FILE *w_popen(const wchar_t *, const wchar_t *); |