+/*
+ 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.
+
+ */
+
+
+static void
+scm_input_error(char const * function,
+ SCM port, const char * message, SCM arg)
+{
+ char *fn = SCM_STRINGP (SCM_FILENAME(port))
+ ? SCM_STRING_CHARS(SCM_FILENAME(port))
+ : "#<unknown port>";
+
+ SCM string_port = scm_open_output_string ();
+ SCM string = SCM_EOL;
+ scm_simple_format (string_port,
+ scm_makfrom0str ("~A:~S:~S: ~A"),
+ scm_list_4 (scm_makfrom0str (fn),
+ scm_int2num (SCM_LINUM (port) + 1),
+ scm_int2num (SCM_COL (port) + 1),
+ scm_makfrom0str (message)));
+
+
+ string = scm_get_output_string (string_port);
+ scm_close_output_port (string_port);
+ scm_error_scm (scm_str2symbol ("read-error"),
+ scm_makfrom0str (function),
+ string,
+ SCM_EOL,
+ SCM_BOOL_F);
+}
+
+