diff --git a/src/CHANGELOG b/src/CHANGELOG index 102a80a60..7d349859d 100644 --- a/src/CHANGELOG +++ b/src/CHANGELOG @@ -1,4 +1,4 @@ -ECL 9.7.2: +ECL 9.8.1: ========== * Ports: @@ -11,6 +11,8 @@ ECL 9.7.2: - The NetBSD port builds with default values using the garbage collector in the pkgsrc distribution. + - Solaris/Sparc now builds with the given libraries (GMP and Boehm). + * Compiler: - The compiler now understands FFI types :[u]int{8,16,32,64}-t. @@ -40,6 +42,15 @@ ECL 9.7.2: - The dynamic FFI is now implemented using libffi. This extends the portability and removes the previous, error prone implementation. + - A new function, (SI:SAFE-EVAL form env &optional error-value), can be used + to evaluate lisp forms in a safe way. If supplied three values, when an + error happens, it returns ERROR-VALUE; otherwise it will invoke a debugger. + + - Two new functions, ecl_read_from_cstring(s) and ecl_read_from_cstring(s,v) + read an object from a C string (char *). The first one is unsafe and will + enter a debugger when there is a syntax error. The second one will return V + when an error happens. + * Bugs fixed: - SI:GET-LIBRARY-PATHNAME did not work properly in Windows. @@ -49,76 +60,6 @@ ECL 9.7.2: - --enable-slow-config works again. -ECL 9.7.1: -========== - -* Printer: - - - Readtables have a new flag that makes them read-only. Function - (si::readtable-lock readtable &optional new-flag) - either reads the state of this flag (if NEW-FLAG is missing) or - also sets it. - - - The compiler now uses cl_core to efficiently access certain lisp - constants (standard packages, standard readtables, etc) - - - EXT:OUTPUT-FLOAT-INFINITY works now fine when *print-circle* is T. - - - WITH-STANDARD-IO-SYNTAX now also rebinds *print-pprint-dispatch*. - -* Compiler: - - - When printing out data and reading it from a FASL file, the compiler now - uses more strict settings avoiding usual interferences such as the user - changing the readtable or the printing rules. - - - The compiler no longer enters the debugger when it finds an error in the - code it compiles. - - - C:COMPILER-ERROR no longer derives from ERROR or SERIOUS-CONDITION. - - - Trapping of compiler conditions now works even for compiler errors. - - - Handlers of compiler errors can now call (ABORT). COMPILE-FILE will - interrupt the compilation process, and the outputs values that signal - the failure to terminate. - - - ECL no longer emits compiler notes when deleting unreachable code. - - - Compiler messages now show the offending form and file position. - - - DEFCONSTANT only had the expected compile-time side effects in the bytecodes - compiler, not in the lisp->C translator. - - - New type information propagators for AREF, ASET, +, *, /, -, COS, SIN, ACOS, - ASIN, COSH, ACOSH, ASINH, SINH, ATAN, ATANH, EXP, EXPT, CIS, SQRT, ISQRT and - ABS. allow ECL to produce better code even without an additional - back-propagation phase. - - - Code to perform a type inference pass, with which-way information has - been added to ECL. The code is still in a debug phase, with lots of debug - output printed and rather incomplete, but it is by default deactivated and - should not interfere with usual functioning. - - - The code for inlining functions has been improved. Some safe inline - expansions that were already available are now actively used thanks to these - fixes. - - - Formerly, by historical reasons, many library functions that take a fixed - number of arguments were declared as functions with a variable number of - arguments. This slows down ECL and prevents detecting certain errors. In an - ongoing effort to solve this problem, the C prototypes of COSH, SINH, CIS, - ACOSH, ASINH and ISQRT now take only one argument (i.e. cl_cosh(cl_object x) - instead of cl_cosh(cl_narg narg, cl_object x, ...)) - -* Visible changes: - - - The toplevel only traps SERIOUS-CONDITIONS. - - - "make clean" now wipes out the entire content of the build directory. Please - use this before re-configuring again ECL so that header and configuration - files are properly updated. - ;;; Local Variables: *** ;;; mode:text *** ;;; fill-column:79 *** diff --git a/src/c/read.d b/src/c/read.d index c9ffef16c..675dd084b 100644 --- a/src/c/read.d +++ b/src/c/read.d @@ -2090,26 +2090,6 @@ ecl_invalid_character_p(int c) @(return ecl_gethash_safe(subchr, table, Cnil)) @) -cl_object -c_string_to_object(const char *s) -{ - return si_string_to_object(make_constant_base_string(s)); -} - -cl_object -si_string_to_object(cl_object x) -{ - cl_object in; - - /* FIXME! Restricted to base string */ - x = ecl_check_cl_type(@'si::string-to-object', x, t_base_string); - in = ecl_make_string_input_stream(x, 0, TOKEN_STRING_FILLP(x)); - x = ecl_read_object(in); - if (x == OBJNULL) - FEend_of_file(in); - @(return x) -} - cl_object si_standard_readtable() { diff --git a/src/h/external.h b/src/h/external.h index 15e5f76e2..6939d0e9b 100644 --- a/src/h/external.h +++ b/src/h/external.h @@ -549,7 +549,7 @@ extern ECL_API void FEwin32_error(const char *msg, int narg, ...) /*__attribute_ extern ECL_API cl_object cl_funcall _ARGS((cl_narg narg, cl_object fun, ...)); extern ECL_API cl_object cl_apply _ARGS((cl_narg narg, cl_object fun, cl_object arg, ...)); -extern ECL_API cl_object si_safe_eval _ARGS((cl_narg narg, cl_object form, cl_object env, cl_object value, ...)); +extern ECL_API cl_object si_safe_eval _ARGS((cl_narg narg, cl_object form, cl_object env, ...)); #define cl_safe_eval(form,env,value) si_safe_eval(3,form,env,value) extern ECL_API cl_object *_ecl_va_sp(cl_narg narg); extern ECL_API cl_object si_unlink_symbol(cl_object s); @@ -1381,7 +1381,6 @@ extern ECL_API cl_object si_get_buffer_string(); extern ECL_API cl_object si_put_buffer_string(cl_object string); extern ECL_API cl_object cl_read_sequence _ARGS((cl_narg narg, cl_object seq, cl_object stream, ...)); extern ECL_API cl_object cl_readtablep(cl_object readtable); -extern ECL_API cl_object si_string_to_object(cl_object str); extern ECL_API cl_object si_standard_readtable(void); extern ECL_API cl_object cl_read _ARGS((cl_narg narg, ...)); extern ECL_API cl_object cl_read_preserving_whitespace _ARGS((cl_narg narg, ...)); @@ -1418,7 +1417,8 @@ extern ECL_API cl_object ecl_copy_readtable(cl_object from, cl_object to); extern ECL_API cl_object ecl_current_readtable(void); extern ECL_API int ecl_current_read_base(void); extern ECL_API char ecl_current_read_default_float_format(void); -extern ECL_API cl_object c_string_to_object(const char *s); +#define ecl_read_from_cstring(s) si_string_to_object(1,make_constant_base_string(s)) +#define ecl_read_from_cstring_safe(s,v) si_string_to_object(2,make_constant_base_string(s),(v)) extern ECL_API cl_object read_VV(cl_object block, void (*entry)(cl_object)); /* reference.c */ @@ -1771,6 +1771,7 @@ extern ECL_API cl_object cl_prin1_to_string _ARGS((cl_narg narg, cl_object V1, . extern ECL_API cl_object cl_princ_to_string _ARGS((cl_narg narg, cl_object V1, ...)); extern ECL_API cl_object cl_y_or_n_p _ARGS((cl_narg narg, ...)); extern ECL_API cl_object cl_yes_or_no_p _ARGS((cl_narg narg, ...)); +extern ECL_API cl_object si_string_to_object _ARGS((cl_narg narg, cl_object str, ...); /* listlib.lsp */ @@ -1967,6 +1968,7 @@ extern ECL_API cl_object clos_standard_instance_set _ARGS((cl_narg narg, cl_obje #define si_bc_file(o) si_compiled_function_file(o) #define ARRAYP ECL_ARRAYP #define VECTORP ECL_VECTORP +#define c_string_to_object ecl_read_from_cstring #ifdef __cplusplus } diff --git a/src/lsp/top.lsp b/src/lsp/top.lsp index 2d1a79fff..dd9449cd8 100644 --- a/src/lsp/top.lsp +++ b/src/lsp/top.lsp @@ -1330,13 +1330,20 @@ package." (default-debugger condition))))) (finish-output)) -(defun safe-eval (form env err-value) - (catch 'si::protect-tag - (let* ((*debugger-hook* - #'(lambda (condition old-hooks) - (throw 'si::protect-tag condition)))) - (return-from safe-eval (eval-with-env form env)))) - err-value) +(defun safe-eval (form env &optional (err-value nil err-value-p)) + "Args: (FORM ENV &optional ERR-VALUE) +Evaluates FORM in the given environment, which may be NIL. If the form +signals an error, or tries to jump to an outer point, the function has two +choices: by default, it will invoke a debugger, but if a third value is +supplied, then SAFE-EVAL will not use a debugger but rather return that +value." + (let ((output nil) (ok nil)) + (unwind-protect + (handler-bind ((error (if err-value-p + #'(lambda (c) (return-from safe-eval c)) + #'invoke-debugger))) + (setf output (si::eval-with-env form env) ok t)) + (return-from safe-eval (if ok output err-value))))) #-ecl-min (package-lock "COMMON-LISP" t)