aboutsummaryrefslogtreecommitdiff
path: root/c/pl.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/pl.h')
-rw-r--r--c/pl.h33
1 files changed, 22 insertions, 11 deletions
diff --git a/c/pl.h b/c/pl.h
index e91aff0..e1dbea7 100644
--- a/c/pl.h
+++ b/c/pl.h
@@ -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>