diff options
author | John Ankarström <john@ankarstrom.se> | 2022-07-17 00:50:37 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-07-17 00:50:37 +0200 |
commit | 03fe36165b6767bc4e0d26bf1b1de38fdff3f75e (patch) | |
tree | d4145d918964b0b0f93e611de52220632113bfa8 /c/pl.h | |
parent | 605a3ff052defc3e41542204b0579e528d81ad72 (diff) | |
download | EpisodeBrowser-03fe36165b6767bc4e0d26bf1b1de38fdff3f75e.tar.gz |
Use SWI-Prolog's wide-character functions.
This avoids the use of TsmFromSz.
Diffstat (limited to 'c/pl.h')
-rw-r--r-- | c/pl.h | 33 |
1 files changed, 22 insertions, 11 deletions
@@ -25,23 +25,34 @@ inline int PlPut(term_t t, long long x) { return PL_put_integer(t, x); } inline int PlPut(term_t t, atom_t x) { return PL_put_atom(t, x); } inline int PlPut(term_t t, char *x) { return PL_put_atom(t, PL_new_atom(x)); } inline int PlPut(term_t t, const char *x) { return PL_put_atom(t, PL_new_atom(x)); } -inline int PlPut(term_t t, int *x) { return -1; } -inline int PlPut(term_t t, long *x) { return -1; } -inline int PlPut(term_t t, long long *x) { return -1; } -inline int PlPut(term_t t, atom_t *x) { return -1; } -inline int PlPut(term_t t, char **x) { return -1; } +inline int PlPut(term_t t, wchar_t *x) { return PL_put_atom(t, PL_new_atom_wchars(-1, x)); } +inline int PlPut(term_t t, const wchar_t *x) { return PL_put_atom(t, PL_new_atom_wchars(-1, x)); } +inline int PlPut(term_t, int *) { return -1; } +inline int PlPut(term_t, long *) { return -1; } +inline int PlPut(term_t, long long *) { return -1; } +inline int PlPut(term_t, atom_t *) { return -1; } +inline int PlPut(term_t, char **) { return -1; } +inline int PlPut(term_t, wchar_t **) { return -1; } -inline int PlGet(term_t t, int x) { return -1; } -inline int PlGet(term_t t, long x) { return -1; } -inline int PlGet(term_t t, long long x) { return -1; } -inline int PlGet(term_t t, atom_t x) { return -1; } -inline int PlGet(term_t t, char *x) { return -1; } -inline int PlGet(term_t t, const char *x) { return -1; } +inline int PlGet(term_t, int) { return -1; } +inline int PlGet(term_t, long) { return -1; } +inline int PlGet(term_t, long long) { return -1; } +inline int PlGet(term_t, atom_t) { return -1; } +inline int PlGet(term_t, char*) { return -1; } +inline int PlGet(term_t, const char *) { return -1; } inline int PlGet(term_t t, int *x) { return PL_get_integer(t, x); } inline int PlGet(term_t t, long *x) { return PL_get_long(t, x); } inline int PlGet(term_t t, long long *x) { return PL_get_int64(t, x); } inline int PlGet(term_t t, atom_t *x) { return PL_get_atom(t, x); } inline int PlGet(term_t t, char **x) { return PL_get_atom_chars(t, x); } +inline int PlGet(term_t t, wchar_t **x) +{ + atom_t a; + size_t siz; + if (!PL_get_atom(t, &a)) return 0; + *x = (wchar_t *)PL_atom_wchars(a, &siz); + return *x != NULL; +} /* Helper templates for Plx, Pl. */ template <typename T> |