aboutsummaryrefslogtreecommitdiff
path: root/c/pl.h
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2022-07-31 19:56:53 +0200
committerJohn Ankarström <john@ankarstrom.se>2022-07-31 19:58:54 +0200
commitd9e1caa37e53c7dbc42b1fc652efc23a40c47c42 (patch)
treed2a1608a3c88fef98af9a356a116af3551ea5680 /c/pl.h
parentd9bafcecfd60f38f98bca8a1705f6007b39e18a2 (diff)
downloadEpisodeBrowser-d9e1caa37e53c7dbc42b1fc652efc23a40c47c42.tar.gz
Limit use of Hungarian notation.
I don't hate Hungarian notation. It has some very nice qualities. But it also adds a lot of typing. That said, not using it feels a bit... unsafe. I might go back on this decision. We'll see.
Diffstat (limited to 'c/pl.h')
-rw-r--r--c/pl.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/c/pl.h b/c/pl.h
index c7fcfc8..0a65c96 100644
--- a/c/pl.h
+++ b/c/pl.h
@@ -7,7 +7,7 @@
#include "common.h"
-wstring_owner PlString(const term_t t, const int iFlags = CVT_WRITE);
+wstring_owner PlString(const term_t t, const int flags = CVT_WRITE);
struct Frame
{
@@ -69,9 +69,9 @@ 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, wstring_owner* x) {
Mark m;
- char* sz;
- if (!PlGet(t, &sz)) return 0;
- *x = WsoFromSz(sz);
+ char* s;
+ if (!PlGet(t, &s)) return 0;
+ *x = WsoFromSz(s);
return 1; /* or catch potential exception from BstrFromSz? */
}
@@ -89,13 +89,13 @@ inline bool PlGetN(term_t t, T x, U... xs) { return PlGet(t, x) && PlGetN(t+1, x
/* Call Prolog predicate. */
template <bool Except = false, typename... T>
-int Pl(const char* const szMod, const char* const szPred, T... xs)
+int Pl(const char* const mod, const char* const pred, T... xs)
{
Frame f;
const term_t t = PL_new_term_refs(sizeof...(T));
if (!PlPutN(t, xs...)) return 0;
- Query q(NULL, PL_predicate(szPred, sizeof...(T), szMod), t);
+ Query q(NULL, PL_predicate(pred, sizeof...(T), mod), t);
if constexpr (Except) {
if (!q.NextSolution()) return 0;
@@ -109,9 +109,9 @@ int Pl(const char* const szMod, const char* const szPred, T... xs)
/* Call Prolog predicate, propagating Prolog exceptions. */
template <typename... T>
-int Plx(const char* const szMod, const char* const szPred, T... xs)
+int Plx(const char* const mod, const char* const pred, T... xs)
{
- return Pl<true>(szMod, szPred, xs...);
+ return Pl<true>(mod, pred, xs...);
}
#endif