Skip to content

Commit

Permalink
Merge pull request #1069 from rajithv/exception-fix
Browse files Browse the repository at this point in the history
Fixing enum issue in Exceptions
  • Loading branch information
isuruf committed Aug 20, 2016
2 parents b3ab94e + 2129adf commit d674459
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions symengine/cwrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ extern "C" {
#define CWRAPPER_BEGIN try {

#define CWRAPPER_END \
return 0; \
return SYMENGINE_NO_EXCEPTION; \
} \
catch (SymEngineException & e) \
{ \
return e.error_code(); \
} \
catch (...) \
{ \
return -1; \
return SYMENGINE_RUNTIME_ERROR; \
}

struct CRCPBasic {
Expand Down Expand Up @@ -346,15 +346,15 @@ CWRAPPER_OUTPUT_TYPE rational_set_ui(basic s, unsigned long a, unsigned long b)
CWRAPPER_END
}

int rational_set(basic s, const basic a, const basic b)
CWRAPPER_OUTPUT_TYPE rational_set(basic s, const basic a, const basic b)
{
if (not is_a_Integer(a) or not is_a_Integer(b)) {
return 0;
return SYMENGINE_RUNTIME_ERROR;
}
s->m = SymEngine::Rational::from_two_ints(
*(rcp_static_cast<const Integer>(a->m)),
*(rcp_static_cast<const Integer>(b->m)));
return 1;
return SYMENGINE_NO_EXCEPTION;
}

CWRAPPER_OUTPUT_TYPE rational_set_mpq(basic s, const mpq_t i)
Expand Down Expand Up @@ -421,12 +421,12 @@ CWRAPPER_OUTPUT_TYPE complex_double_imaginary_part(basic s, const basic com)
CWRAPPER_END
}

int basic_diff(basic s, const basic expr, basic const symbol)
CWRAPPER_OUTPUT_TYPE basic_diff(basic s, const basic expr, basic const symbol)
{
if (not is_a_Symbol(symbol))
return 0;
return SYMENGINE_RUNTIME_ERROR;
s->m = expr->m->diff(rcp_static_cast<const Symbol>(symbol->m));
return 1;
return SYMENGINE_NO_EXCEPTION;
}

CWRAPPER_OUTPUT_TYPE basic_assign(basic a, const basic b)
Expand Down
4 changes: 2 additions & 2 deletions symengine/cwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ extern "C" {
} \
}

typedef int CWRAPPER_OUTPUT_TYPE;

#include "symengine/symengine_exception.h"

typedef symengine_exceptions_t CWRAPPER_OUTPUT_TYPE;

typedef enum {
#define SYMENGINE_INCLUDE_ALL
#define SYMENGINE_ENUM(type, Class) SYMENGINE_##type,
Expand Down

0 comments on commit d674459

Please sign in to comment.