*
* You should have received a copy of the GNU General Public License
* along with this software; see the file COPYING. If not, write to
- * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ * the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307 USA
*
* As a special exception, the Free Software Foundation gives permission
* for additional uses of the text contained in its release of GUILE.
*
* If you write modifications of your own for GUILE, it is your choice
* whether to permit this exception to apply to your modifications.
- * If you do not wish that, delete this exception notice.
- */
+ * If you do not wish that, delete this exception notice. */
\f
#include <stdio.h>
extern int errno;
-void (*scm_error_callback) () = 0;
-
/* All errors should pass through here. */
void
scm_error (key, subr, message, args, rest)
SCM rest;
{
SCM arg_list;
- if (scm_error_callback)
- (*scm_error_callback) (key, subr, message, args, rest);
-
arg_list = scm_listify (subr ? scm_makfrom0str (subr) : SCM_BOOL_F,
message ? scm_makfrom0str (message) : SCM_BOOL_F,
args,
/* No return, but just in case: */
- write (2, "unhandled system error", sizeof ("unhandled system error") - 1);
+ write (2, "unhandled system error\n",
+ sizeof ("unhandled system error\n") - 1);
exit (1);
}
|| (SCM_NIMP (message) && SCM_ROSTRINGP (message)),
message, SCM_ARG3, s_error_scm);
+ SCM_COERCE_SUBSTR (message);
+
scm_error (key,
(SCM_FALSEP (subr)) ? NULL : SCM_ROCHARS (subr),
(SCM_FALSEP (message)) ? NULL : SCM_ROCHARS (message),
/* not reached. */
}
+SCM_PROC (s_strerror, "strerror", 1, 0, 0, scm_strerror);
+SCM
+scm_strerror (SCM err)
+{
+ SCM_ASSERT (SCM_INUMP (err), err, SCM_ARG1, s_strerror);
+ return scm_makfrom0str (strerror (SCM_INUM (err)));
+}
+
SCM_SYMBOL (scm_system_error_key, "system-error");
void
scm_syserror (subr)
if ((~0x1fL) & (long) pos)
{
/* error string supplied. */
- scm_misc_error (s_subr, pos, SCM_BOOL_F);
+ scm_misc_error (s_subr, pos, SCM_EOL);
}
else
{
scm_memory_error (s_subr);
default:
/* this shouldn't happen. */
- scm_misc_error (s_subr, "Unknown error", SCM_BOOL_F);
+ scm_misc_error (s_subr, "Unknown error", SCM_EOL);
}
}
return SCM_UNSPECIFIED;
void
scm_init_error ()
{
-#include "errnos.c"
+#include "cpp_err_symbols.c"
#include "error.x"
}