summaryrefslogtreecommitdiffabout
path: root/libmu_scm
authorSergey Poznyakoff <gray@gnu.org.ua>2002-09-10 12:03:42 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2002-09-10 12:03:42 (GMT)
commit19be4447de8711a0480455d2bd5f902813b4db10 (patch) (side-by-side diff)
treea6cbedf81dcd5e257f57346308946f2127ce31a0 /libmu_scm
parent59e7b2d4cd24c1a202729612fca35113e419e1e6 (diff)
downloadmailutils-19be4447de8711a0480455d2bd5f902813b4db10.tar.gz
mailutils-19be4447de8711a0480455d2bd5f902813b4db10.tar.bz2
Upgrade to guile 1.6.0
Diffstat (limited to 'libmu_scm') (more/less context) (ignore whitespace changes)
-rw-r--r--libmu_scm/mu_address.c8
-rw-r--r--libmu_scm/mu_body.c2
-rw-r--r--libmu_scm/mu_guimb.c6
-rw-r--r--libmu_scm/mu_logger.c12
-rw-r--r--libmu_scm/mu_mailbox.c6
-rw-r--r--libmu_scm/mu_message.c18
-rw-r--r--libmu_scm/mu_scm.c34
-rw-r--r--libmu_scm/mu_scm.h18
8 files changed, 66 insertions, 38 deletions
diff --git a/libmu_scm/mu_address.c b/libmu_scm/mu_address.c
index 0f1701e..46a3531 100644
--- a/libmu_scm/mu_address.c
+++ b/libmu_scm/mu_address.c
@@ -41,12 +41,12 @@ _get_address_part (const char *func_name, address_get_fp fun,
else
num = 1;
- str = SCM_CHARS (ADDRESS);
+ str = SCM_STRING_CHARS (ADDRESS);
length = strlen (str);
if (length == 0)
return scm_makfrom0str("");
- if (address_create (&addr, SCM_CHARS (ADDRESS)))
+ if (address_create (&addr, SCM_STRING_CHARS (ADDRESS)))
return SCM_BOOL_F;
str = malloc (length + 1);
@@ -126,7 +126,7 @@ SCM_DEFINE (mu_address_get_count, "mu-address-get-count", 1, 0, 0,
SCM_ASSERT (SCM_NIMP (ADDRESS) && SCM_STRINGP (ADDRESS),
ADDRESS, SCM_ARG1, FUNC_NAME);
- if (address_create (&addr, SCM_CHARS (ADDRESS)))
+ if (address_create (&addr, SCM_STRING_CHARS (ADDRESS)))
return SCM_MAKINUM(0);
address_get_count (addr, &count);
@@ -150,7 +150,7 @@ SCM_DEFINE (mu_username_to_email, "mu-username->email", 0, 1, 0,
else {
SCM_ASSERT (SCM_NIMP (NAME) && SCM_STRINGP (NAME),
NAME, SCM_ARG1, FUNC_NAME);
- name = SCM_CHARS (NAME);
+ name = SCM_STRING_CHARS (NAME);
}
email = mu_get_user_email (name);
diff --git a/libmu_scm/mu_body.c b/libmu_scm/mu_body.c
index 5faab69..18ad853 100644
--- a/libmu_scm/mu_body.c
+++ b/libmu_scm/mu_body.c
@@ -174,7 +174,7 @@ SCM_DEFINE (mu_body_write, "mu-body-write", 2, 0, 0,
return SCM_BOOL_F;
}
- ptr = SCM_CHARS (TEXT);
+ ptr = SCM_STRING_CHARS (TEXT);
len = strlen (ptr);
if (stream_write (mbp->stream, ptr, len, mbp->offset, &n))
{
diff --git a/libmu_scm/mu_guimb.c b/libmu_scm/mu_guimb.c
index 5b1e408..888a37d 100644
--- a/libmu_scm/mu_guimb.c
+++ b/libmu_scm/mu_guimb.c
@@ -56,13 +56,11 @@ _scheme_main (void *closure, int argc, char **argv)
#include <mu_guimb.x>
_current_mailbox = mu_scm_mailbox_create (param->mbox);
- scm_loc = SCM_CDRLOC (scm_sysintern ("current-mailbox", SCM_EOL));
- *scm_loc = _current_mailbox;
+ mu_set_variable ("current-mailbox", _current_mailbox);
_user_name = param->user_name ?
scm_makfrom0str (param->user_name) : SCM_BOOL_F;
- scm_loc = SCM_CDRLOC (scm_sysintern ("user-name", SCM_EOL));
- *scm_loc = _user_name;
+ mu_set_variable ("user-name", _user_name);
if (param->init)
param->init (param->data);
diff --git a/libmu_scm/mu_logger.c b/libmu_scm/mu_logger.c
index d42227f..85d151a 100644
--- a/libmu_scm/mu_logger.c
+++ b/libmu_scm/mu_logger.c
@@ -33,20 +33,20 @@ SCM_DEFINE(mu_openlog, "mu-openlog", 3, 0, 0,
{
SCM_ASSERT (SCM_NIMP (IDENT) && SCM_STRINGP (IDENT),
IDENT, SCM_ARG1, FUNC_NAME);
- ident = SCM_CHARS (IDENT);
+ ident = SCM_STRING_CHARS (IDENT);
}
if (SCM_IMP (OPTION) && SCM_INUMP (OPTION))
option = SCM_INUM (OPTION);
else if (SCM_BIGP (OPTION))
- option = (int) scm_big2dbl (OPTION);
+ option = (int) scm_i_big2dbl (OPTION);
else
SCM_ASSERT (0, OPTION, SCM_ARG2, FUNC_NAME);
if (SCM_IMP (FACILITY) && SCM_INUMP (FACILITY))
facility = SCM_INUM (FACILITY);
else if (SCM_BIGP (FACILITY))
- facility = (int) scm_big2dbl (FACILITY);
+ facility = (int) scm_i_big2dbl (FACILITY);
else
SCM_ASSERT (0, FACILITY, SCM_ARG3, FUNC_NAME);
@@ -67,13 +67,13 @@ SCM_DEFINE (mu_logger, "mu-logger", 2, 0, 0,
else if (SCM_IMP (PRIO) && SCM_INUMP (PRIO))
prio = SCM_INUM (PRIO);
else if (SCM_BIGP (PRIO))
- prio = (int) scm_big2dbl (PRIO);
+ prio = (int) scm_i_big2dbl (PRIO);
else
SCM_ASSERT (0, PRIO, SCM_ARG1, FUNC_NAME);
SCM_ASSERT (SCM_NIMP (TEXT) && SCM_STRINGP (TEXT),
TEXT, SCM_ARG2, FUNC_NAME);
- syslog (prio, "%s", SCM_CHARS (TEXT));
+ syslog (prio, "%s", SCM_STRING_CHARS (TEXT));
return SCM_UNSPECIFIED;
}
#undef FUNC_NAME
@@ -126,6 +126,6 @@ mu_scm_logger_init ()
int i;
for (i = 0; i < sizeof (syslog_kw)/sizeof (syslog_kw[0]); i++)
- scm_sysintern (syslog_kw[i].name, SCM_MAKINUM (syslog_kw[i].facility));
+ scm_c_define (syslog_kw[i].name, SCM_MAKINUM (syslog_kw[i].facility));
#include <mu_logger.x>
}
diff --git a/libmu_scm/mu_mailbox.c b/libmu_scm/mu_mailbox.c
index 301ab71..f6b2baa 100644
--- a/libmu_scm/mu_mailbox.c
+++ b/libmu_scm/mu_mailbox.c
@@ -117,7 +117,7 @@ SCM_DEFINE (mu_mailbox_open, "mu-mailbox-open", 2, 0, 0,
SCM_ASSERT (SCM_NIMP (MODE) && SCM_STRINGP (MODE),
MODE, SCM_ARG2, FUNC_NAME);
- for (mode_str = SCM_CHARS (MODE); *mode_str; mode_str++)
+ for (mode_str = SCM_STRING_CHARS (MODE); *mode_str; mode_str++)
switch (*mode_str)
{
case 'r':
@@ -137,7 +137,7 @@ SCM_DEFINE (mu_mailbox_open, "mu-mailbox-open", 2, 0, 0,
if (mode & MU_STREAM_READ && mode & MU_STREAM_WRITE)
mode = (mode & ~(MU_STREAM_READ | MU_STREAM_WRITE)) | MU_STREAM_RDWR;
- if (mailbox_create_default (&mbox, SCM_CHARS (URL)) != 0)
+ if (mailbox_create_default (&mbox, SCM_STRING_CHARS (URL)) != 0)
return SCM_BOOL_F;
if (mailbox_open (mbox, mode) != 0)
@@ -197,7 +197,7 @@ SCM_DEFINE (mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0,
if (mailbox_get_stream (mum->mbox, &stream))
return SCM_BOOL_F;
return mu_port_make_from_stream (MBOX, stream,
- scm_mode_bits (SCM_CHARS (MODE)));
+ scm_mode_bits (SCM_STRING_CHARS (MODE)));
}
#undef FUNC_NAME
diff --git a/libmu_scm/mu_message.c b/libmu_scm/mu_message.c
index ac9efd9..3475827 100644
--- a/libmu_scm/mu_message.c
+++ b/libmu_scm/mu_message.c
@@ -272,7 +272,7 @@ SCM_DEFINE (mu_message_set_header, "mu-message-set-header", 3, 1, 0,
}
message_get_header (msg, &hdr);
- header_set_value (hdr, SCM_CHARS (HEADER), strdup (SCM_CHARS (VALUE)),
+ header_set_value (hdr, SCM_STRING_CHARS (HEADER), strdup (SCM_STRING_CHARS (VALUE)),
replace);
return SCM_UNSPECIFIED;
}
@@ -342,7 +342,7 @@ SCM_DEFINE (mu_message_get_header, "mu-message-get-header", 2, 0, 0,
msg = mu_scm_message_get (MESG);
SCM_ASSERT (SCM_NIMP (HEADER) && SCM_STRINGP (HEADER),
HEADER, SCM_ARG2, FUNC_NAME);
- header_string = SCM_CHARS (HEADER);
+ header_string = SCM_STRING_CHARS (HEADER);
message_get_header (msg, &hdr);
if (header_aget_value (hdr, header_string, &value) == 0)
{
@@ -360,7 +360,7 @@ string_sloppy_member (SCM lst, char *name)
{
SCM car = SCM_CAR (lst);
if ((SCM_NIMP (car) && SCM_STRINGP (car))
- && strcasecmp (SCM_CHARS (car), name) == 0)
+ && strcasecmp (SCM_STRING_CHARS (car), name) == 0)
return 1;
}
return 0;
@@ -463,7 +463,7 @@ SCM_DEFINE (mu_message_set_header_fields, "mu-message-set-header-fields", 2, 1,
car, SCM_ARGn, FUNC_NAME);
SCM_ASSERT (SCM_NIMP (cdr) && SCM_STRINGP (cdr),
cdr, SCM_ARGn, FUNC_NAME);
- header_set_value (hdr, SCM_CHARS (car), SCM_CHARS (cdr), replace);
+ header_set_value (hdr, SCM_STRING_CHARS (car), SCM_STRING_CHARS (cdr), replace);
}
return SCM_UNDEFINED;
}
@@ -710,7 +710,7 @@ SCM_DEFINE (mu_message_get_port, "mu-message-get-port", 2, 1, 0,
}
return mu_port_make_from_stream (MESG, stream,
- scm_mode_bits (SCM_CHARS (MODE)));
+ scm_mode_bits (SCM_STRING_CHARS (MODE)));
}
#undef FUNC_NAME
@@ -810,22 +810,22 @@ SCM_DEFINE (mu_message_send, "mu-message-send", 1, 3, 0,
{
SCM_ASSERT (SCM_NIMP (MAILER) && SCM_STRINGP (MAILER),
MAILER, SCM_ARG2, FUNC_NAME);
- mailer_name = SCM_CHARS (MAILER);
+ mailer_name = SCM_STRING_CHARS (MAILER);
}
else
- mailer_name = SCM_CHARS(_mu_scm_mailer);
+ mailer_name = SCM_STRING_CHARS(_mu_scm_mailer);
if (!SCM_UNBNDP (FROM) && FROM != SCM_BOOL_F)
{
SCM_ASSERT (SCM_NIMP (FROM) && SCM_STRINGP (FROM)
- && address_create (&from, SCM_CHARS (FROM)) == 0,
+ && address_create (&from, SCM_STRING_CHARS (FROM)) == 0,
FROM, SCM_ARG3, FUNC_NAME);
}
if (!SCM_UNBNDP (TO) && TO != SCM_BOOL_F)
{
SCM_ASSERT (SCM_NIMP (TO) && SCM_STRINGP (TO)
- && address_create (&to, SCM_CHARS (TO)) == 0,
+ && address_create (&to, SCM_STRING_CHARS (TO)) == 0,
TO, SCM_ARG4, FUNC_NAME);
}
diff --git a/libmu_scm/mu_scm.c b/libmu_scm/mu_scm.c
index 0fe68e1..ab69623 100644
--- a/libmu_scm/mu_scm.c
+++ b/libmu_scm/mu_scm.c
@@ -21,8 +21,9 @@
# define _PATH_SENDMAIL "/usr/lib/sendmail"
#endif
-SCM
+SCM
scm_makenum (unsigned long val)
+#ifndef HAVE_SCM_LONG2NUM
{
if (SCM_FIXABLE ((long) val))
return SCM_MAKINUM (val);
@@ -33,6 +34,22 @@ scm_makenum (unsigned long val)
return scm_make_real ((double) val);
#endif /* SCM_BIGDIG */
}
+#else
+{
+ return scm_long2num (val);
+}
+#endif
+
+void
+mu_set_variable (const char *name, SCM value)
+{
+#if GUILE_VERSION == 14
+ scm_c_define (name, value); /*FIXME*/
+#else
+ scm_c_define (name, value);
+#endif
+}
+
SCM _mu_scm_package; /* STRING: PACKAGE */
SCM _mu_scm_version; /* STRING: VERSION */
@@ -60,30 +77,25 @@ static struct
void
mu_scm_init ()
{
- SCM *scm_loc;
char *defmailer;
int i;
asprintf (&defmailer, "sendmail:%s", _PATH_SENDMAIL);
_mu_scm_mailer = scm_makfrom0str (defmailer);
- scm_loc = SCM_CDRLOC (scm_sysintern ("mu-mailer", SCM_EOL));
- *scm_loc = _mu_scm_mailer;
+ mu_set_variable ("mu-mailer", _mu_scm_mailer);
_mu_scm_debug = scm_makenum(0);
- scm_loc = SCM_CDRLOC (scm_sysintern ("mu-debug", SCM_EOL));
- *scm_loc = _mu_scm_debug;
+ mu_set_variable ("mu-debug", _mu_scm_debug);
_mu_scm_package = scm_makfrom0str (PACKAGE);
- scm_loc = SCM_CDRLOC (scm_sysintern ("mu-package", SCM_EOL));
- *scm_loc = _mu_scm_package;
+ mu_set_variable ("mu-package", _mu_scm_package);
_mu_scm_version = scm_makfrom0str (VERSION);
- scm_loc = SCM_CDRLOC (scm_sysintern ("mu-version", SCM_EOL));
- *scm_loc = _mu_scm_version;
+ mu_set_variable ("mu-version", _mu_scm_version);
/* Create MU- attribute names */
for (i = 0; attr_kw[i].name; i++)
- scm_sysintern(attr_kw[i].name, SCM_MAKINUM(attr_kw[i].value));
+ scm_c_define(attr_kw[i].name, SCM_MAKINUM(attr_kw[i].value));
mu_scm_mutil_init ();
mu_scm_mailbox_init ();
diff --git a/libmu_scm/mu_scm.h b/libmu_scm/mu_scm.h
index 49fb749..ee580c0 100644
--- a/libmu_scm/mu_scm.h
+++ b/libmu_scm/mu_scm.h
@@ -43,6 +43,23 @@
#include <libguile.h>
+#if GUILE_VERSION == 14
+
+# define SCM_STRING_CHARS SCM_CHARS
+# define scm_list_1 SCM_LIST1
+# define scm_list_2 SCM_LIST2
+# define scm_list_3 SCM_LIST3
+# define scm_list_4 SCM_LIST4
+# define scm_list_5 SCM_LIST5
+# define scm_list_n SCM_LISTN
+# define scm_c_define scm_sysintern
+# define scm_primitive_eval_x scm_eval_x
+# define scm_i_big2dbl scm_big2dbl
+
+extern SCM scm_long2num (long val);
+
+#endif
+
typedef struct
{
int debug_guile;
@@ -60,6 +77,7 @@ extern SCM _mu_scm_mailer;
extern SCM _mu_scm_debug;
extern SCM scm_makenum __P((unsigned long val));
+extern void mu_set_variable (const char *name, SCM value);
extern void mu_scm_init __P((void));
extern void mu_scm_mailbox_init __P((void));

Return to:

Send suggestions and report system problems to the System administrator.