diff options
author | John Ankarström <john@ankarstrom.se> | 2022-08-24 15:17:08 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2022-08-24 15:17:33 +0200 |
commit | 6fd66a9264731bd7ee6d7602675965021d929a4a (patch) | |
tree | e94fc63efb823ad2f5c9ef6de6188da389a08d38 /c/pl.cpp | |
parent | ff48d644a45dd71098ecb9007a41807fb37d0081 (diff) | |
download | EpisodeBrowser-6fd66a9264731bd7ee6d7602675965021d929a4a.tar.gz |
Remove Prolog dependency.
The only thing left to reimplement is the tracking of watched episodes
in MPC-HC.
Diffstat (limited to 'c/pl.cpp')
-rw-r--r-- | c/pl.cpp | 93 |
1 files changed, 0 insertions, 93 deletions
diff --git a/c/pl.cpp b/c/pl.cpp deleted file mode 100644 index bab2f31..0000000 --- a/c/pl.cpp +++ /dev/null @@ -1,93 +0,0 @@ -#include <windows.h> -#include <SWI-Prolog.h> - -#include "pl.h" - -Frame::Frame() -{ - m_f = PL_open_foreign_frame(); -} - -Frame::~Frame() -{ - PL_close_foreign_frame(m_f); -} - -void Frame::Close() -{ - PL_close_foreign_frame(m_f); -} - -void Frame::Discard() -{ - PL_discard_foreign_frame(m_f); -} - -void Frame::Rewind() -{ - PL_rewind_foreign_frame(m_f); -} - -Mark::Mark() -{ - PL_mark_string_buffers(&m_m); -} - -Mark::~Mark() -{ - PL_release_string_buffers_from_mark(m_m); -} - -Query::Query(const module_t ctx, const predicate_t p, const term_t t0) -{ - m_q = PL_open_query(ctx, PL_Q_CATCH_EXCEPTION, p, t0); -} - -Query::~Query() -{ - PL_cut_query(m_q); -} - -int Query::Cut(std::nothrow_t) -{ - return PL_cut_query(m_q); -} -int Query::Cut() -{ - if (PL_cut_query(m_q)) return 1; - if (const term_t t = PL_exception(m_q)) throw t; - return 0; -} - -int Query::Close(std::nothrow_t) -{ - return PL_close_query(m_q); -} - -int Query::Close() -{ - if (PL_close_query(m_q)) return 1; - if (const term_t t = PL_exception(m_q)) throw t; - return 0; -} - -int Query::NextSolution(std::nothrow_t) -{ - return PL_next_solution(m_q); -} - -int Query::NextSolution() -{ - if (PL_next_solution(m_q)) return 1; - if (const term_t t = PL_exception(m_q)) throw t; - return 0; -} - -WcharPtr PlString(const term_t t, const int flags) -{ - char* s; - if (PL_get_chars(t, &s, flags)) - return {WcharPtr::FromNarrow(s)}; - else - return {}; -} |