Commit 42f9e9d0 42f9e9d0e3c73059048934e385074d78a023e6e4 by Sergey Poznyakoff

Fix the use of deprecated Guile interfaces in port code.

* am/guile.m4 (MU_CHECK_GUILE): Check for SCM_DEVAL_P et al.
* libmu_scm/mu_guile.c (mu_guile_init): Protect calls to
SCM_DEVAL_P &c. by #ifdef GUILE_DEBUG_MACROS
* libmu_scm/mu_port.c [!HAVE_SCM_T_OFF](scm_t_off): New typedef.
(mu_port_make_from_stream): Use scm_new_port_table_entry instead
of the deprecated scm_add_to_port_table
1 parent 43a43a75
......@@ -63,6 +63,17 @@ AC_DEFUN([MU_CHECK_GUILE],
GUILE_VERSION_NUMBER=
m4_if($3,,[AC_MSG_ERROR(required library libguile not found)], [$3])
else
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <libguile.h>]],
[SCM_DEVAL_P = 1;
SCM_BACKTRACE_P = 1;
SCM_RECORD_POSITIONS_P = 1;
SCM_RESET_DEBUG_MODE;])],
[mu_cv_guile_debug=yes],
[mu_cv_guile_debug=no])
if test $mu_cv_guile_debug = yes; then
AC_DEFINE_UNQUOTED(GUILE_DEBUG_MACROS, 1,
[Define to 1 if SCM_DEVAL_P, SCM_BACKTRACE_P, SCM_RECORD_POSITIONS_P and SCM_RESET_DEBUG_MODE are defined])
fi
AC_CHECK_TYPES([scm_t_off],[],[],[#include <libguile.h>])
AC_DEFINE_UNQUOTED(GUILE_VERSION, "$GUILE_VERSION",
[Guile version number])
......
......@@ -109,10 +109,12 @@ mu_guile_init (int debug)
if (debug)
{
#ifdef GUILE_DEBUG_MACROS
SCM_DEVAL_P = 1;
SCM_BACKTRACE_P = 1;
SCM_RECORD_POSITIONS_P = 1;
SCM_RESET_DEBUG_MODE;
#endif
}
mu_scm_init ();
}
......
......@@ -20,6 +20,10 @@
#include "mu_scm.h"
#include <mailutils/io.h>
#ifndef HAVE_SCM_T_OFF
typedef off_t scm_t_off;
#endif
struct mu_port
{
mu_stream_t stream; /* Associated stream */
......@@ -87,16 +91,13 @@ mu_port_make_from_stream (SCM msg, mu_stream_t stream, long mode)
mp->stream = stream;
mp->offset = 0;
port = scm_cell (scm_tc16_smuport | mode, 0);
pt = scm_add_to_port_table (port);
SCM_SETPTAB_ENTRY (port, pt);
port = scm_new_port_table_entry (scm_tc16_smuport | mode);
pt = SCM_PTAB_ENTRY (port);
pt->rw_random = mu_stream_is_seekable (stream);
SCM_SETSTREAM (port, mp);
mu_port_alloc_buffer (port, 0, 0);
/* SCM_PTAB_ENTRY (port)->file_name = "name";FIXME*/
/* FIXME:
SCM_PTAB_ENTRY (port)->file_name = "name";*/
return port;
}
......