Remove the uses of deprecated Guile functions.
* am/guile.m4 (MU_CHECK_GUILE): Check for scm_t_off. * include/mailutils/guile.h (mu_scm_makenum) (mu_set_variable): Remove prototypes. * libmu_scm/mu_address.c: Remove calls to deprecated Guile functions. * libmu_scm/mu_body.c: Likewise. * libmu_scm/mu_guile.c: Likewise. * libmu_scm/mu_mailbox.c: Likewise. * libmu_scm/mu_message.c: Likewise. * libmu_scm/mu_mime.c: Likewise. * libmu_scm/mu_util.c: Likewise. * libmu_scm/mu_scm.c (mu_scm_makenum): Remove. (mu_set_variable): Remove. Use scm_c_define instead.
Showing
10 changed files
with
64 additions
and
102 deletions
... | @@ -62,7 +62,8 @@ AC_DEFUN([MU_CHECK_GUILE], | ... | @@ -62,7 +62,8 @@ AC_DEFUN([MU_CHECK_GUILE], |
62 | GUILE_VERSION= | 62 | GUILE_VERSION= |
63 | GUILE_VERSION_NUMBER= | 63 | GUILE_VERSION_NUMBER= |
64 | m4_if($3,,[AC_MSG_ERROR(required library libguile not found)], [$3]) | 64 | m4_if($3,,[AC_MSG_ERROR(required library libguile not found)], [$3]) |
65 | else | 65 | else |
66 | AC_CHECK_TYPES([scm_t_off],[],[],[#include <libguile.h>]) | ||
66 | AC_DEFINE_UNQUOTED(GUILE_VERSION, "$GUILE_VERSION", | 67 | AC_DEFINE_UNQUOTED(GUILE_VERSION, "$GUILE_VERSION", |
67 | [Guile version number]) | 68 | [Guile version number]) |
68 | AC_DEFINE_UNQUOTED(GUILE_VERSION_NUMBER, $GUILE_VERSION_NUMBER, | 69 | AC_DEFINE_UNQUOTED(GUILE_VERSION_NUMBER, $GUILE_VERSION_NUMBER, | ... | ... |
... | @@ -43,8 +43,7 @@ extern "C" { | ... | @@ -43,8 +43,7 @@ extern "C" { |
43 | 43 | ||
44 | void mu_scm_error (const char *func_name, int status, | 44 | void mu_scm_error (const char *func_name, int status, |
45 | const char *fmt, SCM args); | 45 | const char *fmt, SCM args); |
46 | extern SCM mu_scm_makenum (unsigned long val); | 46 | |
47 | extern void mu_set_variable (const char *name, SCM value); | ||
48 | extern void mu_scm_init (void); | 47 | extern void mu_scm_init (void); |
49 | 48 | ||
50 | extern void mu_scm_mailbox_init (void); | 49 | extern void mu_scm_mailbox_init (void); | ... | ... |
... | @@ -66,7 +66,7 @@ _get_address_part (const char *func_name, address_get_fp fun, | ... | @@ -66,7 +66,7 @@ _get_address_part (const char *func_name, address_get_fp fun, |
66 | mu_address_destroy (&addr); | 66 | mu_address_destroy (&addr); |
67 | 67 | ||
68 | if (status == 0) | 68 | if (status == 0) |
69 | ret = scm_makfrom0str (str); | 69 | ret = scm_from_locale_string (str); |
70 | else | 70 | else |
71 | { | 71 | { |
72 | free (str); | 72 | free (str); |
... | @@ -150,7 +150,7 @@ SCM_DEFINE (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, | ... | @@ -150,7 +150,7 @@ SCM_DEFINE (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, |
150 | 150 | ||
151 | mu_address_get_count (addr, &count); | 151 | mu_address_get_count (addr, &count); |
152 | mu_address_destroy (&addr); | 152 | mu_address_destroy (&addr); |
153 | return mu_scm_makenum (count); | 153 | return scm_from_size_t (count); |
154 | } | 154 | } |
155 | #undef FUNC_NAME | 155 | #undef FUNC_NAME |
156 | 156 | ||
... | @@ -179,7 +179,7 @@ SCM_DEFINE (scm_mu_username_to_email, "mu-username->email", 0, 1, 0, | ... | @@ -179,7 +179,7 @@ SCM_DEFINE (scm_mu_username_to_email, "mu-username->email", 0, 1, 0, |
179 | "Cannot get user email for ~A", | 179 | "Cannot get user email for ~A", |
180 | scm_list_1 (NAME)); | 180 | scm_list_1 (NAME)); |
181 | 181 | ||
182 | ret = scm_makfrom0str (email); | 182 | ret = scm_from_locale_string (email); |
183 | free (email); | 183 | free (email); |
184 | return ret; | 184 | return ret; |
185 | } | 185 | } | ... | ... |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | 19 | ||
20 | #include "mu_scm.h" | 20 | #include "mu_scm.h" |
21 | 21 | ||
22 | long body_tag; | 22 | static scm_t_bits body_tag; |
23 | 23 | ||
24 | struct mu_body | 24 | struct mu_body |
25 | { | 25 | { |
... | @@ -159,7 +159,7 @@ SCM_DEFINE (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0, | ... | @@ -159,7 +159,7 @@ SCM_DEFINE (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0, |
159 | if (nread == 0) | 159 | if (nread == 0) |
160 | return SCM_EOF_VAL; | 160 | return SCM_EOF_VAL; |
161 | 161 | ||
162 | return scm_makfrom0str (mbp->buffer); | 162 | return scm_from_locale_string (mbp->buffer); |
163 | } | 163 | } |
164 | #undef FUNC_NAME | 164 | #undef FUNC_NAME |
165 | 165 | ... | ... |
... | @@ -131,7 +131,7 @@ load_path_handler (void *data) | ... | @@ -131,7 +131,7 @@ load_path_handler (void *data) |
131 | struct load_closure *lp = data; | 131 | struct load_closure *lp = data; |
132 | 132 | ||
133 | scm_set_program_arguments (lp->argc, lp->argv, (char*)lp->filename); | 133 | scm_set_program_arguments (lp->argc, lp->argv, (char*)lp->filename); |
134 | scm_primitive_load (scm_makfrom0str (lp->filename)); | 134 | scm_primitive_load (scm_from_locale_string (lp->filename)); |
135 | return SCM_UNDEFINED; | 135 | return SCM_UNDEFINED; |
136 | } | 136 | } |
137 | 137 | ... | ... |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | 19 | ||
20 | #include "mu_scm.h" | 20 | #include "mu_scm.h" |
21 | 21 | ||
22 | long mailbox_tag; | 22 | static scm_t_bits mailbox_tag; |
23 | 23 | ||
24 | /* NOTE: Maybe will have to add some more members. That's why it is a | 24 | /* NOTE: Maybe will have to add some more members. That's why it is a |
25 | struct, not just a typedef mu_mailbox_t */ | 25 | struct, not just a typedef mu_mailbox_t */ |
... | @@ -160,7 +160,7 @@ SCM_DEFINE (scm_mu_user_mailbox_url, "mu-user-mailbox-url", 1, 0, 0, | ... | @@ -160,7 +160,7 @@ SCM_DEFINE (scm_mu_user_mailbox_url, "mu-user-mailbox-url", 1, 0, 0, |
160 | mu_scm_error (FUNC_NAME, rc, | 160 | mu_scm_error (FUNC_NAME, rc, |
161 | "Cannot construct mailbox URL for ~A", | 161 | "Cannot construct mailbox URL for ~A", |
162 | scm_list_1 (USER)); | 162 | scm_list_1 (USER)); |
163 | ret = scm_makfrom0str (p); | 163 | ret = scm_from_locale_string (p); |
164 | free (p); | 164 | free (p); |
165 | return ret; | 165 | return ret; |
166 | } | 166 | } |
... | @@ -175,13 +175,13 @@ SCM_DEFINE (scm_mu_folder_directory, "mu-folder-directory", 0, 1, 0, | ... | @@ -175,13 +175,13 @@ SCM_DEFINE (scm_mu_folder_directory, "mu-folder-directory", 0, 1, 0, |
175 | if (!SCM_UNBNDP (URL)) | 175 | if (!SCM_UNBNDP (URL)) |
176 | { | 176 | { |
177 | char *s; | 177 | char *s; |
178 | 178 | ||
179 | SCM_ASSERT (scm_is_string (URL), URL, SCM_ARG1, FUNC_NAME); | 179 | SCM_ASSERT (scm_is_string (URL), URL, SCM_ARG1, FUNC_NAME); |
180 | s = scm_to_locale_string (URL); | 180 | s = scm_to_locale_string (URL); |
181 | mu_set_folder_directory (s); | 181 | mu_set_folder_directory (s); |
182 | free (s); | 182 | free (s); |
183 | } | 183 | } |
184 | return scm_makfrom0str (mu_folder_directory ()); | 184 | return scm_from_locale_string (mu_folder_directory ()); |
185 | } | 185 | } |
186 | #undef FUNC_NAME | 186 | #undef FUNC_NAME |
187 | 187 | ||
... | @@ -288,7 +288,7 @@ SCM_DEFINE (scm_mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0, | ... | @@ -288,7 +288,7 @@ SCM_DEFINE (scm_mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0, |
288 | "Cannot get mailbox url", | 288 | "Cannot get mailbox url", |
289 | SCM_BOOL_F); | 289 | SCM_BOOL_F); |
290 | 290 | ||
291 | return scm_makfrom0str (mu_url_to_string (url)); | 291 | return scm_from_locale_string (mu_url_to_string (url)); |
292 | } | 292 | } |
293 | #undef FUNC_NAME | 293 | #undef FUNC_NAME |
294 | 294 | ||
... | @@ -364,7 +364,7 @@ SCM_DEFINE (scm_mu_mailbox_messages_count, "mu-mailbox-messages-count", 1, 0, 0, | ... | @@ -364,7 +364,7 @@ SCM_DEFINE (scm_mu_mailbox_messages_count, "mu-mailbox-messages-count", 1, 0, 0, |
364 | mu_scm_error (FUNC_NAME, status, | 364 | mu_scm_error (FUNC_NAME, status, |
365 | "Cannot count messages in mailbox ~A", | 365 | "Cannot count messages in mailbox ~A", |
366 | scm_list_1 (MBOX)); | 366 | scm_list_1 (MBOX)); |
367 | return mu_scm_makenum (nmesg); | 367 | return scm_from_size_t (nmesg); |
368 | } | 368 | } |
369 | #undef FUNC_NAME | 369 | #undef FUNC_NAME |
370 | 370 | ... | ... |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | 19 | ||
20 | #include "mu_scm.h" | 20 | #include "mu_scm.h" |
21 | 21 | ||
22 | long message_tag; | 22 | static scm_t_bits message_tag; |
23 | 23 | ||
24 | struct mu_message | 24 | struct mu_message |
25 | { | 25 | { |
... | @@ -147,13 +147,13 @@ mu_scm_message_add_owner (SCM MESG, SCM owner) | ... | @@ -147,13 +147,13 @@ mu_scm_message_add_owner (SCM MESG, SCM owner) |
147 | struct mu_message *mum = (struct mu_message *) SCM_CDR (MESG); | 147 | struct mu_message *mum = (struct mu_message *) SCM_CDR (MESG); |
148 | SCM cell; | 148 | SCM cell; |
149 | 149 | ||
150 | if (SCM_IMP (mum->mbox) && SCM_BOOLP (mum->mbox)) | 150 | if (scm_is_bool (mum->mbox)) |
151 | { | 151 | { |
152 | mum->mbox = owner; | 152 | mum->mbox = owner; |
153 | return; | 153 | return; |
154 | } | 154 | } |
155 | 155 | ||
156 | if (SCM_NIMP (mum->mbox) && SCM_CONSP (mum->mbox)) | 156 | if (scm_is_pair (mum->mbox)) |
157 | cell = scm_cons (owner, mum->mbox); | 157 | cell = scm_cons (owner, mum->mbox); |
158 | else | 158 | else |
159 | cell = scm_cons (owner, scm_cons (mum->mbox, SCM_EOL)); | 159 | cell = scm_cons (owner, scm_cons (mum->mbox, SCM_EOL)); |
... | @@ -281,7 +281,7 @@ SCM_DEFINE (scm_mu_message_set_header, "mu-message-set-header", 3, 1, 0, | ... | @@ -281,7 +281,7 @@ SCM_DEFINE (scm_mu_message_set_header, "mu-message-set-header", 3, 1, 0, |
281 | msg = mu_scm_message_get (MESG); | 281 | msg = mu_scm_message_get (MESG); |
282 | SCM_ASSERT (scm_is_string (HEADER), HEADER, SCM_ARG2, FUNC_NAME); | 282 | SCM_ASSERT (scm_is_string (HEADER), HEADER, SCM_ARG2, FUNC_NAME); |
283 | 283 | ||
284 | if (SCM_IMP (VALUE) && SCM_BOOLP (VALUE)) | 284 | if (scm_is_bool (VALUE)) |
285 | return SCM_UNSPECIFIED; | 285 | return SCM_UNSPECIFIED; |
286 | 286 | ||
287 | SCM_ASSERT (scm_is_string (VALUE), VALUE, SCM_ARG2, FUNC_NAME); | 287 | SCM_ASSERT (scm_is_string (VALUE), VALUE, SCM_ARG2, FUNC_NAME); |
... | @@ -317,10 +317,11 @@ SCM_DEFINE (scm_mu_message_get_size, "mu-message-get-size", 1, 0, 0, | ... | @@ -317,10 +317,11 @@ SCM_DEFINE (scm_mu_message_get_size, "mu-message-get-size", 1, 0, 0, |
317 | { | 317 | { |
318 | mu_message_t msg; | 318 | mu_message_t msg; |
319 | size_t size; | 319 | size_t size; |
320 | |||
320 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 321 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); |
321 | msg = mu_scm_message_get (MESG); | 322 | msg = mu_scm_message_get (MESG); |
322 | mu_message_size (msg, &size); | 323 | mu_message_size (msg, &size); |
323 | return mu_scm_makenum (size); | 324 | return scm_from_size_t (size); |
324 | } | 325 | } |
325 | #undef FUNC_NAME | 326 | #undef FUNC_NAME |
326 | 327 | ||
... | @@ -341,7 +342,7 @@ SCM_DEFINE (scm_mu_message_get_lines, "mu-message-get-lines", 1, 0, 0, | ... | @@ -341,7 +342,7 @@ SCM_DEFINE (scm_mu_message_get_lines, "mu-message-get-lines", 1, 0, 0, |
341 | "Cannot get number of lines in message ~A", | 342 | "Cannot get number of lines in message ~A", |
342 | scm_list_1 (MESG)); | 343 | scm_list_1 (MESG)); |
343 | 344 | ||
344 | return mu_scm_makenum (lines); | 345 | return scm_from_size_t (lines); |
345 | } | 346 | } |
346 | #undef FUNC_NAME | 347 | #undef FUNC_NAME |
347 | 348 | ||
... | @@ -426,7 +427,7 @@ SCM_DEFINE (scm_mu_message_get_envelope_date, "mu-message-get-envelope-date", 1, | ... | @@ -426,7 +427,7 @@ SCM_DEFINE (scm_mu_message_get_envelope_date, "mu-message-get-envelope-date", 1, |
426 | status = mu_parse_ctime_date_time (&sdate, &tm, &tz); | 427 | status = mu_parse_ctime_date_time (&sdate, &tm, &tz); |
427 | if (status) | 428 | if (status) |
428 | mu_scm_error (FUNC_NAME, status, "invalid envelope date", | 429 | mu_scm_error (FUNC_NAME, status, "invalid envelope date", |
429 | scm_list_1 (scm_makfrom0str (sdate))); | 430 | scm_list_1 (scm_from_locale_string (sdate))); |
430 | return filltime (&tm, tz.utc_offset, tz.tz_name); | 431 | return filltime (&tm, tz.utc_offset, tz.tz_name); |
431 | } | 432 | } |
432 | #undef FUNC_NAME | 433 | #undef FUNC_NAME |
... | @@ -447,7 +448,7 @@ SCM_DEFINE (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0, | ... | @@ -447,7 +448,7 @@ SCM_DEFINE (scm_mu_message_get_sender, "mu-message-get-sender", 1, 0, 0, |
447 | if (status == 0) | 448 | if (status == 0) |
448 | { | 449 | { |
449 | char *p = _get_envelope_sender (env); | 450 | char *p = _get_envelope_sender (env); |
450 | ret = scm_makfrom0str (p); | 451 | ret = scm_from_locale_string (p); |
451 | free (p); | 452 | free (p); |
452 | } | 453 | } |
453 | else | 454 | else |
... | @@ -484,7 +485,7 @@ SCM_DEFINE (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0, | ... | @@ -484,7 +485,7 @@ SCM_DEFINE (scm_mu_message_get_header, "mu-message-get-header", 2, 0, 0, |
484 | switch (status) | 485 | switch (status) |
485 | { | 486 | { |
486 | case 0: | 487 | case 0: |
487 | ret = scm_makfrom0str (value); | 488 | ret = scm_from_locale_string (value); |
488 | free (value); | 489 | free (value); |
489 | break; | 490 | break; |
490 | 491 | ||
... | @@ -533,8 +534,7 @@ SCM_DEFINE (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, | ... | @@ -533,8 +534,7 @@ SCM_DEFINE (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, |
533 | msg = mu_scm_message_get (MESG); | 534 | msg = mu_scm_message_get (MESG); |
534 | if (!SCM_UNBNDP (HEADERS)) | 535 | if (!SCM_UNBNDP (HEADERS)) |
535 | { | 536 | { |
536 | SCM_ASSERT (SCM_NIMP (HEADERS) && SCM_CONSP (HEADERS), | 537 | SCM_ASSERT (scm_is_pair (HEADERS), HEADERS, SCM_ARG2, FUNC_NAME); |
537 | HEADERS, SCM_ARG2, FUNC_NAME); | ||
538 | headers = HEADERS; | 538 | headers = HEADERS; |
539 | } | 539 | } |
540 | 540 | ||
... | @@ -558,7 +558,7 @@ SCM_DEFINE (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, | ... | @@ -558,7 +558,7 @@ SCM_DEFINE (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, |
558 | "Cannot get header field ~A, message ~A", | 558 | "Cannot get header field ~A, message ~A", |
559 | scm_list_2 (scm_from_size_t (i), MESG)); | 559 | scm_list_2 (scm_from_size_t (i), MESG)); |
560 | 560 | ||
561 | if (headers != SCM_EOL && string_sloppy_member (headers, name) == 0) | 561 | if (!scm_is_null (headers) && string_sloppy_member (headers, name) == 0) |
562 | continue; | 562 | continue; |
563 | status = mu_header_aget_field_value (hdr, i, &value); | 563 | status = mu_header_aget_field_value (hdr, i, &value); |
564 | if (status) | 564 | if (status) |
... | @@ -566,12 +566,12 @@ SCM_DEFINE (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, | ... | @@ -566,12 +566,12 @@ SCM_DEFINE (scm_mu_message_get_header_fields, "mu-message-get-header-fields", 1, |
566 | "Cannot get header value ~A, message ~A", | 566 | "Cannot get header value ~A, message ~A", |
567 | scm_list_2 (scm_from_size_t (i), MESG)); | 567 | scm_list_2 (scm_from_size_t (i), MESG)); |
568 | 568 | ||
569 | scm_name = scm_makfrom0str (name); | 569 | scm_name = scm_from_locale_string (name); |
570 | scm_value = scm_makfrom0str (value); | 570 | scm_value = scm_from_locale_string (value); |
571 | 571 | ||
572 | scm_new = scm_cons (scm_cons (scm_name, scm_value), SCM_EOL); | 572 | scm_new = scm_cons (scm_cons (scm_name, scm_value), SCM_EOL); |
573 | 573 | ||
574 | if (scm_first == SCM_EOL) | 574 | if (scm_is_null (scm_first)) |
575 | scm_first = scm_last = scm_new; | 575 | scm_first = scm_last = scm_new; |
576 | else | 576 | else |
577 | { | 577 | { |
... | @@ -601,13 +601,11 @@ SCM_DEFINE (scm_mu_message_set_header_fields, "mu-message-set-header-fields", 2, | ... | @@ -601,13 +601,11 @@ SCM_DEFINE (scm_mu_message_set_header_fields, "mu-message-set-header-fields", 2, |
601 | 601 | ||
602 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); | 602 | SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG1, FUNC_NAME); |
603 | msg = mu_scm_message_get (MESG); | 603 | msg = mu_scm_message_get (MESG); |
604 | SCM_ASSERT (((SCM_IMP (LIST) && SCM_EOL == LIST) || | 604 | SCM_ASSERT (scm_is_null (LIST) || scm_is_pair (LIST), |
605 | (SCM_NIMP (LIST) && SCM_CONSP (LIST))), | ||
606 | LIST, SCM_ARG2, FUNC_NAME); | 605 | LIST, SCM_ARG2, FUNC_NAME); |
607 | if (!SCM_UNBNDP (REPLACE)) | 606 | if (!SCM_UNBNDP (REPLACE)) |
608 | { | 607 | { |
609 | SCM_ASSERT (SCM_IMP (REPLACE) && SCM_BOOLP (REPLACE), | 608 | SCM_ASSERT (scm_is_bool (REPLACE), REPLACE, SCM_ARG3, FUNC_NAME); |
610 | REPLACE, SCM_ARG3, FUNC_NAME); | ||
611 | replace = REPLACE == SCM_BOOL_T; | 609 | replace = REPLACE == SCM_BOOL_T; |
612 | } | 610 | } |
613 | 611 | ||
... | @@ -616,14 +614,13 @@ SCM_DEFINE (scm_mu_message_set_header_fields, "mu-message-set-header-fields", 2, | ... | @@ -616,14 +614,13 @@ SCM_DEFINE (scm_mu_message_set_header_fields, "mu-message-set-header-fields", 2, |
616 | mu_scm_error (FUNC_NAME, status, | 614 | mu_scm_error (FUNC_NAME, status, |
617 | "Cannot get message headers", SCM_BOOL_F); | 615 | "Cannot get message headers", SCM_BOOL_F); |
618 | 616 | ||
619 | for (list = LIST; list != SCM_EOL; list = SCM_CDR (list)) | 617 | for (list = LIST; !scm_is_null (list); list = SCM_CDR (list)) |
620 | { | 618 | { |
621 | SCM cell = SCM_CAR (list); | 619 | SCM cell = SCM_CAR (list); |
622 | SCM car, cdr; | 620 | SCM car, cdr; |
623 | char *hdr_c, *val_c; | 621 | char *hdr_c, *val_c; |
624 | 622 | ||
625 | SCM_ASSERT (SCM_NIMP (cell) && SCM_CONSP (cell), | 623 | SCM_ASSERT (scm_is_pair (cell), cell, SCM_ARGn, FUNC_NAME); |
626 | cell, SCM_ARGn, FUNC_NAME); | ||
627 | car = SCM_CAR (cell); | 624 | car = SCM_CAR (cell); |
628 | cdr = SCM_CDR (cell); | 625 | cdr = SCM_CDR (cell); |
629 | SCM_ASSERT (scm_is_string (car), car, SCM_ARGn, FUNC_NAME); | 626 | SCM_ASSERT (scm_is_string (car), car, SCM_ARGn, FUNC_NAME); |
... | @@ -659,8 +656,7 @@ SCM_DEFINE (scm_mu_message_delete, "mu-message-delete", 1, 1, 0, | ... | @@ -659,8 +656,7 @@ SCM_DEFINE (scm_mu_message_delete, "mu-message-delete", 1, 1, 0, |
659 | msg = mu_scm_message_get (MESG); | 656 | msg = mu_scm_message_get (MESG); |
660 | if (!SCM_UNBNDP (FLAG)) | 657 | if (!SCM_UNBNDP (FLAG)) |
661 | { | 658 | { |
662 | SCM_ASSERT (SCM_IMP (FLAG) && SCM_BOOLP (FLAG), | 659 | SCM_ASSERT (scm_is_bool (FLAG), FLAG, SCM_ARG2, FUNC_NAME); |
663 | FLAG, SCM_ARG2, FUNC_NAME); | ||
664 | delete = FLAG == SCM_BOOL_T; | 660 | delete = FLAG == SCM_BOOL_T; |
665 | } | 661 | } |
666 | status = mu_message_get_attribute (msg, &attr); | 662 | status = mu_message_get_attribute (msg, &attr); |
... | @@ -759,8 +755,7 @@ SCM_DEFINE (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0, | ... | @@ -759,8 +755,7 @@ SCM_DEFINE (scm_mu_message_set_flag, "mu-message-set-flag", 2, 1, 0, |
759 | 755 | ||
760 | if (!SCM_UNBNDP (VALUE)) | 756 | if (!SCM_UNBNDP (VALUE)) |
761 | { | 757 | { |
762 | SCM_ASSERT (SCM_IMP (VALUE) && SCM_BOOLP (VALUE), | 758 | SCM_ASSERT (scm_is_bool (VALUE), VALUE, SCM_ARG3, FUNC_NAME); |
763 | VALUE, SCM_ARG3, FUNC_NAME); | ||
764 | value = VALUE == SCM_BOOL_T; | 759 | value = VALUE == SCM_BOOL_T; |
765 | } | 760 | } |
766 | 761 | ||
... | @@ -880,8 +875,7 @@ SCM_DEFINE (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2, 1, 0, | ... | @@ -880,8 +875,7 @@ SCM_DEFINE (scm_mu_message_set_user_flag, "mu-message-set-user-flag", 2, 1, 0, |
880 | 875 | ||
881 | if (!SCM_UNBNDP (VALUE)) | 876 | if (!SCM_UNBNDP (VALUE)) |
882 | { | 877 | { |
883 | SCM_ASSERT (SCM_IMP (VALUE) && SCM_BOOLP (VALUE), | 878 | SCM_ASSERT (scm_is_bool (VALUE), VALUE, SCM_ARG3, FUNC_NAME); |
884 | VALUE, SCM_ARG3, FUNC_NAME); | ||
885 | set = VALUE == SCM_BOOL_T; | 879 | set = VALUE == SCM_BOOL_T; |
886 | } | 880 | } |
887 | 881 | ||
... | @@ -922,8 +916,7 @@ SCM_DEFINE (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, | ... | @@ -922,8 +916,7 @@ SCM_DEFINE (scm_mu_message_get_port, "mu-message-get-port", 2, 1, 0, |
922 | 916 | ||
923 | if (!SCM_UNBNDP (FULL)) | 917 | if (!SCM_UNBNDP (FULL)) |
924 | { | 918 | { |
925 | SCM_ASSERT (SCM_IMP (FULL) && SCM_BOOLP (FULL), | 919 | SCM_ASSERT (scm_is_bool (FULL), FULL, SCM_ARG3, FUNC_NAME); |
926 | FULL, SCM_ARG3, FUNC_NAME); | ||
927 | if (FULL == SCM_BOOL_T) | 920 | if (FULL == SCM_BOOL_T) |
928 | { | 921 | { |
929 | status = mu_message_get_stream (msg, &stream); | 922 | status = mu_message_get_stream (msg, &stream); |
... | @@ -1010,7 +1003,7 @@ SCM_DEFINE (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, 0, 0, | ... | @@ -1010,7 +1003,7 @@ SCM_DEFINE (scm_mu_message_get_num_parts, "mu-message-get-num-parts", 1, 0, 0, |
1010 | mu_scm_error (FUNC_NAME, status, | 1003 | mu_scm_error (FUNC_NAME, status, |
1011 | "Cannot get number of parts in the message ~A", | 1004 | "Cannot get number of parts in the message ~A", |
1012 | scm_list_1 (MESG)); | 1005 | scm_list_1 (MESG)); |
1013 | return mu_scm_makenum (nparts); | 1006 | return scm_from_size_t (nparts); |
1014 | } | 1007 | } |
1015 | #undef FUNC_NAME | 1008 | #undef FUNC_NAME |
1016 | 1009 | ... | ... |
... | @@ -19,7 +19,7 @@ | ... | @@ -19,7 +19,7 @@ |
19 | 19 | ||
20 | #include "mu_scm.h" | 20 | #include "mu_scm.h" |
21 | 21 | ||
22 | long mime_tag; | 22 | static scm_t_bits mime_tag; |
23 | 23 | ||
24 | struct mu_mime | 24 | struct mu_mime |
25 | { | 25 | { |
... | @@ -101,7 +101,7 @@ SCM_DEFINE (scm_mu_mime_create, "mu-mime-create", 0, 2, 0, | ... | @@ -101,7 +101,7 @@ SCM_DEFINE (scm_mu_mime_create, "mu-mime-create", 0, 2, 0, |
101 | int flags; | 101 | int flags; |
102 | int status; | 102 | int status; |
103 | 103 | ||
104 | if (SCM_IMP (FLAGS) && SCM_BOOLP (FLAGS)) | 104 | if (scm_is_bool (FLAGS)) |
105 | { | 105 | { |
106 | /*if (FLAGS == SCM_BOOL_F)*/ | 106 | /*if (FLAGS == SCM_BOOL_F)*/ |
107 | flags = 0; | 107 | flags = 0; |
... | @@ -152,7 +152,7 @@ SCM_DEFINE (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0, | ... | @@ -152,7 +152,7 @@ SCM_DEFINE (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0, |
152 | if (status) | 152 | if (status) |
153 | mu_scm_error (FUNC_NAME, status, | 153 | mu_scm_error (FUNC_NAME, status, |
154 | "Cannot count MIME parts", SCM_BOOL_F); | 154 | "Cannot count MIME parts", SCM_BOOL_F); |
155 | return mu_scm_makenum (nparts); | 155 | return scm_from_size_t (nparts); |
156 | } | 156 | } |
157 | #undef FUNC_NAME | 157 | #undef FUNC_NAME |
158 | 158 | ... | ... |
... | @@ -29,36 +29,11 @@ mu_scm_error (const char *func_name, int status, | ... | @@ -29,36 +29,11 @@ mu_scm_error (const char *func_name, int status, |
29 | { | 29 | { |
30 | scm_error_scm (scm_from_locale_symbol ("mailutils-error"), | 30 | scm_error_scm (scm_from_locale_symbol ("mailutils-error"), |
31 | func_name ? scm_from_locale_string (func_name) : SCM_BOOL_F, | 31 | func_name ? scm_from_locale_string (func_name) : SCM_BOOL_F, |
32 | scm_makfrom0str (fmt), | 32 | scm_from_locale_string (fmt), |
33 | args, | 33 | args, |
34 | scm_list_1 (scm_from_int (status))); | 34 | scm_list_1 (scm_from_int (status))); |
35 | } | 35 | } |
36 | 36 | ||
37 | SCM | ||
38 | mu_scm_makenum (unsigned long val) | ||
39 | #ifndef HAVE_SCM_LONG2NUM | ||
40 | { | ||
41 | if (SCM_FIXABLE ((long) val)) | ||
42 | return scm_from_int (val); | ||
43 | |||
44 | #ifdef SCM_BIGDIG | ||
45 | return scm_long2big (val); | ||
46 | #else /* SCM_BIGDIG */ | ||
47 | return scm_make_real ((double) val); | ||
48 | #endif /* SCM_BIGDIG */ | ||
49 | } | ||
50 | #else | ||
51 | { | ||
52 | return scm_long2num (val); | ||
53 | } | ||
54 | #endif | ||
55 | |||
56 | void | ||
57 | mu_set_variable (const char *name, SCM value) | ||
58 | { | ||
59 | scm_c_define (name, value); | ||
60 | } | ||
61 | |||
62 | SCM _mu_scm_package_string; /* STRING: PACKAGE_STRING */ | 37 | SCM _mu_scm_package_string; /* STRING: PACKAGE_STRING */ |
63 | SCM _mu_scm_package; /* STRING: PACKAGE */ | 38 | SCM _mu_scm_package; /* STRING: PACKAGE */ |
64 | SCM _mu_scm_version; /* STRING: VERSION */ | 39 | SCM _mu_scm_version; /* STRING: VERSION */ |
... | @@ -133,7 +108,7 @@ SCM_DEFINE (scm_mu_register_format, "mu-register-format", 0, 0, 1, | ... | @@ -133,7 +108,7 @@ SCM_DEFINE (scm_mu_register_format, "mu-register-format", 0, 0, 1, |
133 | { | 108 | { |
134 | int status; | 109 | int status; |
135 | 110 | ||
136 | if (REST == SCM_EOL) | 111 | if (scm_is_null (REST)) |
137 | { | 112 | { |
138 | status = register_format (NULL); | 113 | status = register_format (NULL); |
139 | if (status) | 114 | if (status) |
... | @@ -143,7 +118,7 @@ SCM_DEFINE (scm_mu_register_format, "mu-register-format", 0, 0, 1, | ... | @@ -143,7 +118,7 @@ SCM_DEFINE (scm_mu_register_format, "mu-register-format", 0, 0, 1, |
143 | } | 118 | } |
144 | else | 119 | else |
145 | { | 120 | { |
146 | for (; REST != SCM_EOL; REST = SCM_CDR (REST)) | 121 | for (; !scm_is_null (REST); REST = SCM_CDR (REST)) |
147 | { | 122 | { |
148 | char *s; | 123 | char *s; |
149 | SCM scm = SCM_CAR (REST); | 124 | SCM scm = SCM_CAR (REST); |
... | @@ -168,7 +143,7 @@ SCM_DEFINE (scm_mu_strerror, "mu-strerror", 1, 0, 0, | ... | @@ -168,7 +143,7 @@ SCM_DEFINE (scm_mu_strerror, "mu-strerror", 1, 0, 0, |
168 | #define FUNC_NAME s_scm_mu_strerror | 143 | #define FUNC_NAME s_scm_mu_strerror |
169 | { | 144 | { |
170 | SCM_ASSERT (scm_is_integer (ERR), ERR, SCM_ARG1, FUNC_NAME); | 145 | SCM_ASSERT (scm_is_integer (ERR), ERR, SCM_ARG1, FUNC_NAME); |
171 | return scm_makfrom0str (mu_strerror (scm_to_int (ERR))); | 146 | return scm_from_locale_string (mu_strerror (scm_to_int (ERR))); |
172 | } | 147 | } |
173 | #undef FUNC_NAME | 148 | #undef FUNC_NAME |
174 | 149 | ||
... | @@ -194,20 +169,20 @@ mu_scm_init () | ... | @@ -194,20 +169,20 @@ mu_scm_init () |
194 | { | 169 | { |
195 | int i; | 170 | int i; |
196 | 171 | ||
197 | _mu_scm_mailer = scm_makfrom0str ("sendmail:" PATH_SENDMAIL); | 172 | _mu_scm_mailer = scm_from_locale_string ("sendmail:" PATH_SENDMAIL); |
198 | mu_set_variable ("mu-mailer", _mu_scm_mailer); | 173 | scm_c_define ("mu-mailer", _mu_scm_mailer); |
199 | 174 | ||
200 | _mu_scm_debug = mu_scm_makenum(0); | 175 | _mu_scm_debug = scm_from_int (0); |
201 | mu_set_variable ("mu-debug", _mu_scm_debug); | 176 | scm_c_define ("mu-debug", _mu_scm_debug); |
202 | 177 | ||
203 | _mu_scm_package = scm_makfrom0str (PACKAGE); | 178 | _mu_scm_package = scm_from_locale_string (PACKAGE); |
204 | mu_set_variable ("mu-package", _mu_scm_package); | 179 | scm_c_define ("mu-package", _mu_scm_package); |
205 | 180 | ||
206 | _mu_scm_version = scm_makfrom0str (VERSION); | 181 | _mu_scm_version = scm_from_locale_string (VERSION); |
207 | mu_set_variable ("mu-version", _mu_scm_version); | 182 | scm_c_define ("mu-version", _mu_scm_version); |
208 | 183 | ||
209 | _mu_scm_package_string = scm_makfrom0str (PACKAGE_STRING); | 184 | _mu_scm_package_string = scm_from_locale_string (PACKAGE_STRING); |
210 | mu_set_variable ("mu-package-string", _mu_scm_package_string); | 185 | scm_c_define ("mu-package-string", _mu_scm_package_string); |
211 | 186 | ||
212 | /* Create MU- attribute names */ | 187 | /* Create MU- attribute names */ |
213 | for (i = 0; attr_kw[i].name; i++) | 188 | for (i = 0; attr_kw[i].name; i++) | ... | ... |
... | @@ -56,20 +56,14 @@ SCM_DEFINE (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, | ... | @@ -56,20 +56,14 @@ SCM_DEFINE (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, |
56 | mu_scm_error (FUNC_NAME, errno, | 56 | mu_scm_error (FUNC_NAME, errno, |
57 | "Cannot get user credentials", SCM_BOOL_F); | 57 | "Cannot get user credentials", SCM_BOOL_F); |
58 | 58 | ||
59 | ve[0] = scm_makfrom0str (entry->name); | 59 | ve[0] = scm_from_locale_string (entry->name); |
60 | ve[1] = scm_makfrom0str (entry->passwd); | 60 | ve[1] = scm_from_locale_string (entry->passwd); |
61 | ve[2] = scm_ulong2num ((unsigned long) entry->uid); | 61 | ve[2] = scm_from_ulong ((unsigned long) entry->uid); |
62 | ve[3] = scm_ulong2num ((unsigned long) entry->gid); | 62 | ve[3] = scm_from_ulong ((unsigned long) entry->gid); |
63 | ve[4] = scm_makfrom0str (entry->gecos); | 63 | ve[4] = scm_from_locale_string (entry->gecos); |
64 | if (!entry->dir) | 64 | ve[5] = scm_from_locale_string (entry->dir ? entry->dir : ""); |
65 | ve[5] = scm_makfrom0str (""); | 65 | ve[6] = scm_from_locale_string (entry->shell ? entry->shell : ""); |
66 | else | 66 | ve[7] = scm_from_locale_string (entry->mailbox); |
67 | ve[5] = scm_makfrom0str (entry->dir); | ||
68 | if (!entry->shell) | ||
69 | ve[6] = scm_makfrom0str (""); | ||
70 | else | ||
71 | ve[6] = scm_makfrom0str (entry->shell); | ||
72 | ve[7] = scm_makfrom0str (entry->mailbox); | ||
73 | 67 | ||
74 | scm_array_handle_release (&handle); | 68 | scm_array_handle_release (&handle); |
75 | 69 | ... | ... |
-
Please register or sign in to post a comment