PR is ready for review: ENHANCED: C++-compatible exception handling + more wrapper functions and classes by kamahen · Pull Request #39 · SWI-Prolog/packages-cpp · GitHub is ready for review.
Here are the main changes:
-
SWI-cpp2-plx.h
contains wrapper functions (imported fromSWI-cpp2.h
) - throw
PlException
for Prolog errors - most
SWI-Prolog.h
functions have a wrapper. -
verify()
methods removed fromPlAtom
,PlTerm
, etc. - the wrapper functions do the checking.
- Some executable code has been moved to
SWI-cpp2.cpp
- can be inlined, if desired.
-
PlException
is now a subclass ofstd::exception
, not a subclass ofPlTerm
. -
PlTypeError
,PlDomainError
, etc. are no longer subclasses ofPlTerm
, but are functions for creating suitable PlException objects. - The string comparison operators are deprecated; use
as_string()
andstd::string
comparison instead, which allows specifying the encoding. - Added
PlRecord
,PlRecordExternal
,PlControl
(used byPREDICATE_NONDET
),PlStream
. - Fixed numerous bugs and misfeatures; added tests.
I’ve also made PRs for swipl-win, rocksdb, and rolog.
I apologize for the large size of the PR, but I didn’t see an easy way to break it into smaller pieces.
The documentation is still a bit rough; I’ll try to review it and improve it “in the future”.
There are still a few things that need to be done, mostly to do with text encodings. However, their lack shouldn’t be a significant issue, and missing functionality should be easy to add.