+/*
+ Give meaningful error messages for errors
+
+ We use the format
+
+ FILE:LINE:COL: MESSAGE
+ This happened in ....
+
+ This is not standard GNU format, but the test-suite likes the real
+ message to be in front.
+
+ */
+
+
+void
+scm_i_input_error (char const *function,
+ SCM port, const char *message, SCM arg)
+{
+ SCM fn = (scm_is_string (SCM_FILENAME(port))
+ ? SCM_FILENAME(port)
+ : scm_from_locale_string ("#<unknown port>"));
+
+ SCM string_port = scm_open_output_string ();
+ SCM string = SCM_EOL;
+ scm_simple_format (string_port,
+ scm_from_locale_string ("~A:~S:~S: ~A"),
+ scm_list_4 (fn,
+ scm_from_int (SCM_LINUM (port) + 1),
+ scm_from_int (SCM_COL (port) + 1),
+ scm_from_locale_string (message)));
+
+ string = scm_get_output_string (string_port);
+ scm_close_output_port (string_port);
+ scm_error_scm (scm_from_locale_symbol ("read-error"),
+ function? scm_from_locale_string (function) : SCM_BOOL_F,
+ string,
+ arg,
+ SCM_BOOL_F);
+}
+
+