Assorted `syntax-check' fixes.
[bpt/guile.git] / libguile / error.c
index 300d333..4b6bab8 100644 (file)
@@ -1,27 +1,29 @@
-/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2004 Free Software Foundation, Inc.
+/* Copyright (C) 1995,1996,1997,1998,2000,2001, 2004, 2006, 2010 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 3 of
+ * the License, or (at your option) any later version.
  *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+ * 02110-1301 USA
  */
 
 
 \f
 
-#if HAVE_CONFIG_H
+#ifdef HAVE_CONFIG_H
 #  include <config.h>
 #endif
 
+#include <stdlib.h>
 #include <stdio.h>
 #include <errno.h>
 
@@ -93,7 +95,7 @@ SCM_DEFINE (scm_error_scm, "scm-error", 5, 0, 0,
   
   /* No return, but just in case: */
   fprintf (stderr, "Guile scm_ithrow returned!\n");
-  exit (1);
+  exit (EXIT_FAILURE);
 }
 #undef FUNC_NAME
 
@@ -130,12 +132,12 @@ SCM_DEFINE (scm_strerror, "strerror", 1, 0, 0,
 #define FUNC_NAME s_scm_strerror
 {
   SCM ret;
-  scm_frame_begin (0);
-  scm_frame_pthread_mutex_lock (&scm_i_misc_mutex);
+  scm_dynwind_begin (0);
+  scm_i_dynwind_pthread_mutex_lock (&scm_i_misc_mutex);
 
   ret = scm_from_locale_string (SCM_I_STRERROR (scm_to_int (err)));
 
-  scm_frame_end ();
+  scm_dynwind_end ();
   return ret;
 }
 #undef FUNC_NAME
@@ -231,6 +233,19 @@ scm_wrong_type_arg (const char *subr, int pos, SCM bad_value)
             scm_list_1 (bad_value));
 }
 
+void
+scm_i_wrong_type_arg_symbol (SCM symbol, int pos, SCM bad_value)
+{
+  scm_error_scm (scm_arg_type_key,
+                scm_symbol_to_string (symbol),
+                (pos == 0) ? scm_from_locale_string ("Wrong type: ~S")
+                : scm_from_locale_string ("Wrong type argument in position ~A: ~S"),
+                (pos == 0) ? scm_list_1 (bad_value)
+                : scm_list_2 (scm_from_int (pos), bad_value),
+                scm_list_1 (bad_value));
+  scm_remember_upto_here_2 (symbol, bad_value);
+}
+
 void
 scm_wrong_type_arg_msg (const char *subr, int pos, SCM bad_value, const char *szMessage)
 {
@@ -271,7 +286,7 @@ scm_misc_error (const char *subr, const char *message, SCM args)
 void
 scm_init_error ()
 {
-#include "libguile/cpp_err_symbols.c"
+#include "libguile/cpp-E.c"
 #include "libguile/error.x"
 }