re-arrange 'si_safe_eval' code for MSVC compilers
This commit is contained in:
parent
cc3011dc0d
commit
c70380b4d2
1 changed files with 25 additions and 15 deletions
40
src/eql.cpp
40
src/eql.cpp
|
|
@ -55,24 +55,34 @@ void EQL::ini(int argc, char** argv) {
|
|||
cl_booted = true;
|
||||
cl_boot(argc, argv); }
|
||||
|
||||
void EQL::eval(const char* lisp_code, const EvalMode mode) {
|
||||
static void safe_eval_debug(const char* lisp_code) {
|
||||
CL_CATCH_ALL_BEGIN(ecl_process_env()) {
|
||||
switch(mode) {
|
||||
case DebugOnError:
|
||||
si_safe_eval(2, ecl_read_from_cstring((char*)lisp_code), Cnil);
|
||||
break;
|
||||
case LogOnError:
|
||||
case DieOnError:
|
||||
cl_object ret = si_safe_eval(3, ecl_read_from_cstring((char*)lisp_code), Cnil, ecl_make_fixnum(EVAL_ERROR_VALUE));
|
||||
if (ecl_t_of(ret) == t_fixnum && fix(ret) == EVAL_ERROR_VALUE) {
|
||||
qDebug()<<"Error evaluating " <<lisp_code;
|
||||
if (mode == DieOnError)
|
||||
exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
si_safe_eval(2, ecl_read_from_cstring((char*)lisp_code), ECL_NIL); }
|
||||
CL_CATCH_ALL_END; }
|
||||
|
||||
static cl_object safe_eval(const char* lisp_code) {
|
||||
cl_object ret = ECL_NIL;
|
||||
CL_CATCH_ALL_BEGIN(ecl_process_env()) {
|
||||
ret = si_safe_eval(3,
|
||||
ecl_read_from_cstring((char*)lisp_code),
|
||||
ECL_NIL,
|
||||
ecl_make_fixnum(EVAL_ERROR_VALUE)); }
|
||||
CL_CATCH_ALL_END;
|
||||
return ret; }
|
||||
|
||||
void EQL::eval(const char* lisp_code, const EvalMode mode) {
|
||||
switch(mode) {
|
||||
case DebugOnError:
|
||||
safe_eval_debug(lisp_code);
|
||||
break;
|
||||
case LogOnError:
|
||||
case DieOnError:
|
||||
cl_object ret = safe_eval(lisp_code);
|
||||
if (ecl_t_of(ret) == t_fixnum && fix(ret) == EVAL_ERROR_VALUE) {
|
||||
qDebug() << "Error evaluating " << lisp_code;
|
||||
if (mode == DieOnError) {
|
||||
exit(-1); }}}}
|
||||
|
||||
void EQL::ignoreIOStreams() {
|
||||
// [Windows] print output would cause a gui exe to crash (without console)
|
||||
eval("(eql::ignore-io-streams)"); }
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue