Add support for guile 2.0.5.

* guile/guile-internal.h (gdbscm_guile_major_version): Declare.
	(gdbscm_guile_minor_version, gdbscm_guile_micro_version): Declare.
	(gdbscm_guile_version_is_at_least): Declare.
	(gdbscm_scm_string_to_int): Declare.
	* guile/guile.c (gdbscm_guile_major_version): New global.
	(gdbscm_guile_minor_version, gdbscm_guile_micro_version): New globals.
	(guile_datadir): New static global.
	(gdbscm_guile_data_directory): New function.
	(initialize_scheme_side): Update.
	(misc_guile_functions): Add guile-data-directory.
	(initialize_gdb_module): Fetch guile version number.
	* guile/lib/gdb.scm: Remove call to add-to-load-path.
	* guile/lib/gdb/init.scm (%initialize!): Ditto.
	* guile/lib/gdb/boot.scm: Use guile-data-directory.
	* guile/scm-exception.c (gdbscm_print_exception_with_stack): Fix
	comments.
	* guile/scm-string.c (gdbscm_scm_string_to_int): New function.
	* guile/scm-utils.c (gdbscm_guile_version_is_at_least): New function.
	* guile/scm-value.c (gdbscm_value_to_string): Only call
	scm_port_conversion_strategy if Guile version >= 2.0.6.

	doc/
	* guile.texi (Guile Configuration): Document guile-data-directory.
This commit is contained in:
Doug Evans 2014-06-06 15:57:03 -07:00 committed by Doug Evans
parent 6da01dbef2
commit d2929fdcf0
12 changed files with 127 additions and 23 deletions

View file

@ -1016,9 +1016,11 @@ gdbscm_value_to_real (SCM self)
the target's charset.
ERRORS is one of #f, 'error or 'substitute.
An error setting of #f means use the default, which is
Guile's %default-port-conversion-strategy. If the default is not one
of 'error or 'substitute, 'substitute is used.
An error setting of #f means use the default, which is Guile's
%default-port-conversion-strategy when using Guile >= 2.0.6, or 'error if
using an earlier version of Guile. Earlier versions do not properly
support obtaining the default port conversion strategy.
If the default is not one of 'error or 'substitute, 'substitute is used.
An error setting of "error" causes an exception to be thrown if there's
a decoding error. An error setting of "substitute" causes invalid
characters to be replaced with "?".
@ -1069,7 +1071,14 @@ gdbscm_value_to_string (SCM self, SCM rest)
gdbscm_throw (excp);
}
if (errors == SCM_BOOL_F)
errors = scm_port_conversion_strategy (SCM_BOOL_F);
{
/* N.B. scm_port_conversion_strategy in Guile versions prior to 2.0.6
will throw a Scheme error when passed #f. */
if (gdbscm_guile_version_is_at_least (2, 0, 6))
errors = scm_port_conversion_strategy (SCM_BOOL_F);
else
errors = error_symbol;
}
/* We don't assume anything about the result of scm_port_conversion_strategy.
From this point on, if errors is not 'errors, use 'substitute. */