aboutsummaryrefslogtreecommitdiff
path: root/c/pl.h
diff options
context:
space:
mode:
Diffstat (limited to 'c/pl.h')
-rw-r--r--c/pl.h52
1 files changed, 26 insertions, 26 deletions
diff --git a/c/pl.h b/c/pl.h
index 9f40676..38fa94f 100644
--- a/c/pl.h
+++ b/c/pl.h
@@ -4,8 +4,8 @@
#include <windows.h>
#include <SWI-Prolog.h>
-int PL_get_tchars(term_t, TCHAR **, int);
-int Plx(const char *, const char *);
+int PL_get_tchars(term_t, TCHAR**, int);
+int Plx(const char*, const char*);
struct Query
{
@@ -23,34 +23,34 @@ inline int PlPut(const term_t t, const int x) { return PL_put_integer(t, x); }
inline int PlPut(const term_t t, const long x) { return PL_put_integer(t, x); }
inline int PlPut(const term_t t, const long long x) { return PL_put_integer(t, x); }
inline int PlPut(const term_t t, const atom_t x) { return PL_put_atom(t, x); }
-inline int PlPut(const term_t t, char *x) { return PL_put_atom(t, PL_new_atom(x)); }
-inline int PlPut(const term_t t, const char *x) { return PL_put_atom(t, PL_new_atom(x)); }
-inline int PlPut(const term_t t, wchar_t *x) { return PL_put_atom(t, PL_new_atom_wchars(-1, x)); }
-inline int PlPut(const term_t t, const wchar_t *x) { return PL_put_atom(t, PL_new_atom_wchars(-1, x)); }
-inline int PlPut(const term_t, int *) { return -1; }
-inline int PlPut(const term_t, long *) { return -1; }
-inline int PlPut(const term_t, long long *) { return -1; }
-inline int PlPut(const term_t, atom_t *) { return -1; }
-inline int PlPut(const term_t, char **) { return -1; }
-inline int PlPut(const term_t, wchar_t **) { return -1; }
+inline int PlPut(const term_t t, char* const x) { return PL_put_atom(t, PL_new_atom(x)); }
+inline int PlPut(const term_t t, const char* const x) { return PL_put_atom(t, PL_new_atom(x)); }
+inline int PlPut(const term_t t, wchar_t* const x) { return PL_put_atom(t, PL_new_atom_wchars(-1, x)); }
+inline int PlPut(const term_t t, const wchar_t* const x) { return PL_put_atom(t, PL_new_atom_wchars(-1, x)); }
+inline int PlPut(const term_t, int* const) { return -1; }
+inline int PlPut(const term_t, long* const) { return -1; }
+inline int PlPut(const term_t, long long* const) { return -1; }
+inline int PlPut(const term_t, atom_t* const) { return -1; }
+inline int PlPut(const term_t, char** const) { return -1; }
+inline int PlPut(const term_t, wchar_t** const) { return -1; }
inline int PlGet(const term_t, const int) { return -1; }
inline int PlGet(const term_t, const long) { return -1; }
inline int PlGet(const term_t, const long long) { return -1; }
inline int PlGet(const term_t, const atom_t) { return -1; }
-inline int PlGet(const term_t, char*) { return -1; }
-inline int PlGet(const term_t, const char *) { return -1; }
-inline int PlGet(const term_t t, int *x) { return PL_get_integer(t, x); }
-inline int PlGet(const term_t t, long *x) { return PL_get_long(t, x); }
-inline int PlGet(const term_t t, long long *x) { return PL_get_int64(t, x); }
-inline int PlGet(const term_t t, atom_t *x) { return PL_get_atom(t, x); }
-inline int PlGet(const term_t t, char **x) { return PL_get_atom_chars(t, x); }
-inline int PlGet(const term_t t, wchar_t **x)
+inline int PlGet(const term_t, char* const) { return -1; }
+inline int PlGet(const term_t, const char* const) { return -1; }
+inline int PlGet(const term_t t, int* const x) { return PL_get_integer(t, x); }
+inline int PlGet(const term_t t, long* const x) { return PL_get_long(t, x); }
+inline int PlGet(const term_t t, long long* const x) { return PL_get_int64(t, x); }
+inline int PlGet(const term_t t, atom_t* const x) { return PL_get_atom(t, x); }
+inline int PlGet(const term_t t, char** const x) { return PL_get_atom_chars(t, x); }
+inline int PlGet(const term_t t, wchar_t** const x)
{
atom_t a;
size_t len;
if (!PL_get_atom(t, &a)) return 0;
- *x = (wchar_t *)PL_atom_wchars(a, &len);
+ *x = (wchar_t*)PL_atom_wchars(a, &len);
return *x != NULL;
}
@@ -70,7 +70,7 @@ int Countv(const int i, T arg, R... rest) { return Countv(i+1, rest...); }
/* Call Prolog predicate, propagating Prolog exceptions. */
template <typename ...T>
-int Plx(const char *szMod, const char *szPred, T... args)
+int Plx(const char* const szMod, const char* const szPred, T... args)
{
const int iArity = Countv(0, args...);
const term_t t = PL_new_term_refs(iArity);
@@ -82,20 +82,20 @@ int Plx(const char *szMod, const char *szPred, T... args)
}
/* Call Prolog predicate, ignoring Prolog exceptions. */
-inline int Pl(const char *szMod, const char *szPred)
+inline int Pl(const char* const szMod, const char* const szPred)
{
try {
return Plx(szMod, szPred);
- } catch (term_t &t) {
+ } catch (term_t& t) {
return 0;
}
}
template <typename ...T>
-int Pl(const char *szMod, const char *szPred, T... args)
+int Pl(const char* const szMod, const char* const szPred, T... args)
{
try {
return Plx(szMod, szPred, args...);
- } catch (term_t &t) {
+ } catch (term_t& t) {
return 0;
}
}