Commit 94adc8f4 94adc8f49244e0abfd3ac47e0cfb2af2a063adc5 by Sergey Poznyakoff

Further improvements in the Guile-related code.

* gint: Upgrade.
* libmu_scm/Makefile.am: Initialize BUILT_SOURCES.
* libmu_scm/mu_address.c (address_get_fp): Change
signature to match those of mu_address_aget family.
(all functions): Use functions from mu_address_aget family.
Downcase argument names. Refer to them in the docstring
using @var notation.
* libmu_scm/mu_body.c: Downcase argument names. Refer to them
in the docstring using @var notation.
* libmu_scm/mu_logger.c: Likewise.
* libmu_scm/mu_mailbox.c: Likewise.
* libmu_scm/mu_message.c: Likewise.
* libmu_scm/mu_mime.c: Likewise.
* libmu_scm/mu_scm.c: Likewise.
* libmu_scm/mu_util.c: Likewise.
1 parent 49e121ac
gint @ 4254b059
1 Subproject commit c6a7620deb7e3e139329e2daad31d4071f01b43b 1 Subproject commit 4254b0590e609b82dac3d688ecb401c9eefb7e25
......
...@@ -98,4 +98,5 @@ install-data-hook: ...@@ -98,4 +98,5 @@ install-data-hook:
98 sitedir = @GUILE_SITE@/$(PACKAGE) 98 sitedir = @GUILE_SITE@/$(PACKAGE)
99 site_DATA = mailutils.scm 99 site_DATA = mailutils.scm
100 SUFFIXES= 100 SUFFIXES=
101 BUILT_SOURCES=
101 include ../gint/gint.mk 102 include ../gint/gint.mk
......
...@@ -19,30 +19,29 @@ ...@@ -19,30 +19,29 @@
19 19
20 #include "mu_scm.h" 20 #include "mu_scm.h"
21 21
22 typedef int (*address_get_fp) (mu_address_t, size_t, char *, size_t, size_t *); 22 typedef int (*address_get_fp) (mu_address_t, size_t, char **);
23 23
24 static SCM 24 static SCM
25 _get_address_part (const char *func_name, address_get_fp fun, 25 _get_address_part (const char *func_name, address_get_fp fun,
26 SCM ADDRESS, SCM NUM) 26 SCM address, SCM num)
27 { 27 {
28 mu_address_t addr; 28 mu_address_t addr;
29 int length;
30 char *str; 29 char *str;
31 SCM ret; 30 SCM ret;
32 int num; 31 int n;
33 int status; 32 int status;
34 33
35 SCM_ASSERT (scm_is_string (ADDRESS), ADDRESS, SCM_ARG1, func_name); 34 SCM_ASSERT (scm_is_string (address), address, SCM_ARG1, func_name);
36 35
37 if (!SCM_UNBNDP (NUM)) 36 if (!SCM_UNBNDP (num))
38 { 37 {
39 SCM_ASSERT (scm_is_integer (NUM), NUM, SCM_ARG1, func_name); 38 SCM_ASSERT (scm_is_integer (num), num, SCM_ARG1, func_name);
40 num = scm_to_int (NUM); 39 n = scm_to_int (num);
41 } 40 }
42 else 41 else
43 num = 1; 42 n = 1;
44 43
45 str = scm_to_locale_string (ADDRESS); 44 str = scm_to_locale_string (address);
46 if (!str[0]) 45 if (!str[0])
47 { 46 {
48 free (str); 47 free (str);
...@@ -54,15 +53,7 @@ _get_address_part (const char *func_name, address_get_fp fun, ...@@ -54,15 +53,7 @@ _get_address_part (const char *func_name, address_get_fp fun,
54 if (status) 53 if (status)
55 mu_scm_error (func_name, status, "Cannot create address", SCM_BOOL_F); 54 mu_scm_error (func_name, status, "Cannot create address", SCM_BOOL_F);
56 55
57 str = malloc (length + 1); 56 status = (*fun) (addr, n, &str);
58 if (!str)
59 {
60 mu_address_destroy (&addr);
61 mu_scm_error (func_name, ENOMEM,
62 "Cannot allocate memory", SCM_BOOL_F);
63 }
64
65 status = (*fun) (addr, num, str, length + 1, NULL);
66 mu_address_destroy (&addr); 57 mu_address_destroy (&addr);
67 58
68 if (status == 0) 59 if (status == 0)
...@@ -79,58 +70,58 @@ _get_address_part (const char *func_name, address_get_fp fun, ...@@ -79,58 +70,58 @@ _get_address_part (const char *func_name, address_get_fp fun,
79 } 70 }
80 71
81 SCM_DEFINE_PUBLIC (scm_mu_address_get_personal, "mu-address-get-personal", 1, 1, 0, 72 SCM_DEFINE_PUBLIC (scm_mu_address_get_personal, "mu-address-get-personal", 1, 1, 0,
82 (SCM ADDRESS, SCM NUM), 73 (SCM address, SCM num),
83 "Return personal part of the NUMth email address from ADDRESS.\n") 74 "Return personal part of the @var{num}th email address from @var{address}.\n")
84 #define FUNC_NAME s_scm_mu_address_get_personal 75 #define FUNC_NAME s_scm_mu_address_get_personal
85 { 76 {
86 return _get_address_part (FUNC_NAME, 77 return _get_address_part (FUNC_NAME,
87 mu_address_get_personal, ADDRESS, NUM); 78 mu_address_aget_personal, address, num);
88 } 79 }
89 #undef FUNC_NAME 80 #undef FUNC_NAME
90 81
91 SCM_DEFINE_PUBLIC (scm_mu_address_get_comments, "mu-address-get-comments", 1, 1, 0, 82 SCM_DEFINE_PUBLIC (scm_mu_address_get_comments, "mu-address-get-comments", 1, 1, 0,
92 (SCM ADDRESS, SCM NUM), 83 (SCM address, SCM num),
93 "Return comment part of the NUMth email address from ADDRESS.\n") 84 "Return comment part of the @var{num}th email address from @var{address}.\n")
94 #define FUNC_NAME s_scm_mu_address_get_comments 85 #define FUNC_NAME s_scm_mu_address_get_comments
95 { 86 {
96 return _get_address_part (FUNC_NAME, 87 return _get_address_part (FUNC_NAME,
97 mu_address_get_comments, ADDRESS, NUM); 88 mu_address_aget_comments, address, num);
98 } 89 }
99 #undef FUNC_NAME 90 #undef FUNC_NAME
100 91
101 SCM_DEFINE_PUBLIC (scm_mu_address_get_email, "mu-address-get-email", 1, 1, 0, 92 SCM_DEFINE_PUBLIC (scm_mu_address_get_email, "mu-address-get-email", 1, 1, 0,
102 (SCM ADDRESS, SCM NUM), 93 (SCM address, SCM num),
103 "Return email part of the NUMth email address from ADDRESS.\n") 94 "Return email part of the @var{num}th email address from @var{address}.\n")
104 #define FUNC_NAME s_scm_mu_address_get_email 95 #define FUNC_NAME s_scm_mu_address_get_email
105 { 96 {
106 return _get_address_part (FUNC_NAME, 97 return _get_address_part (FUNC_NAME,
107 mu_address_get_email, ADDRESS, NUM); 98 mu_address_aget_email, address, num);
108 } 99 }
109 #undef FUNC_NAME 100 #undef FUNC_NAME
110 101
111 SCM_DEFINE_PUBLIC (scm_mu_address_get_domain, "mu-address-get-domain", 1, 1, 0, 102 SCM_DEFINE_PUBLIC (scm_mu_address_get_domain, "mu-address-get-domain", 1, 1, 0,
112 (SCM ADDRESS, SCM NUM), 103 (SCM address, SCM num),
113 "Return domain part of the NUMth email address from ADDRESS.\n") 104 "Return domain part of the @var{num}th email address from @var{address}.\n")
114 #define FUNC_NAME s_scm_mu_address_get_domain 105 #define FUNC_NAME s_scm_mu_address_get_domain
115 { 106 {
116 return _get_address_part (FUNC_NAME, 107 return _get_address_part (FUNC_NAME,
117 mu_address_get_domain, ADDRESS, NUM); 108 mu_address_aget_domain, address, num);
118 } 109 }
119 #undef FUNC_NAME 110 #undef FUNC_NAME
120 111
121 SCM_DEFINE_PUBLIC (scm_mu_address_get_local, "mu-address-get-local", 1, 1, 0, 112 SCM_DEFINE_PUBLIC (scm_mu_address_get_local, "mu-address-get-local", 1, 1, 0,
122 (SCM ADDRESS, SCM NUM), 113 (SCM address, SCM num),
123 "Return local part of the NUMth email address from ADDRESS.\n") 114 "Return local part of the @var{num}th email address from @var{address}.\n")
124 #define FUNC_NAME s_scm_mu_address_get_local 115 #define FUNC_NAME s_scm_mu_address_get_local
125 { 116 {
126 return _get_address_part (FUNC_NAME, 117 return _get_address_part (FUNC_NAME,
127 mu_address_get_local_part, ADDRESS, NUM); 118 mu_address_aget_local_part, address, num);
128 } 119 }
129 #undef FUNC_NAME 120 #undef FUNC_NAME
130 121
131 SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, 122 SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0,
132 (SCM ADDRESS), 123 (SCM address),
133 "Return number of parts in email address ADDRESS.\n") 124 "Return number of parts in email address @var{address}.\n")
134 #define FUNC_NAME s_scm_mu_address_get_count 125 #define FUNC_NAME s_scm_mu_address_get_count
135 { 126 {
136 mu_address_t addr; 127 mu_address_t addr;
...@@ -138,15 +129,15 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, ...@@ -138,15 +129,15 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0,
138 int status; 129 int status;
139 char *str; 130 char *str;
140 131
141 SCM_ASSERT (scm_is_string (ADDRESS), ADDRESS, SCM_ARG1, FUNC_NAME); 132 SCM_ASSERT (scm_is_string (address), address, SCM_ARG1, FUNC_NAME);
142 133
143 str = scm_to_locale_string (ADDRESS); 134 str = scm_to_locale_string (address);
144 status = mu_address_create (&addr, str); 135 status = mu_address_create (&addr, str);
145 free (str); 136 free (str);
146 if (status) 137 if (status)
147 mu_scm_error (FUNC_NAME, status, 138 mu_scm_error (FUNC_NAME, status,
148 "Cannot create address for ~A", 139 "Cannot create address for ~A",
149 scm_list_1 (ADDRESS)); 140 scm_list_1 (address));
150 141
151 mu_address_get_count (addr, &count); 142 mu_address_get_count (addr, &count);
152 mu_address_destroy (&addr); 143 mu_address_destroy (&addr);
...@@ -155,29 +146,29 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0, ...@@ -155,29 +146,29 @@ SCM_DEFINE_PUBLIC (scm_mu_address_get_count, "mu-address-get-count", 1, 0, 0,
155 #undef FUNC_NAME 146 #undef FUNC_NAME
156 147
157 SCM_DEFINE_PUBLIC (scm_mu_username_to_email, "mu-username->email", 0, 1, 0, 148 SCM_DEFINE_PUBLIC (scm_mu_username_to_email, "mu-username->email", 0, 1, 0,
158 (SCM NAME), 149 (SCM name),
159 "Deduce user's email address from his username. If NAME is omitted, \n" 150 "Deduce user's email address from his username. If @var{name} is omitted, \n"
160 "current username is assumed\n") 151 "current username is assumed\n")
161 #define FUNC_NAME s_scm_mu_username_to_email 152 #define FUNC_NAME s_scm_mu_username_to_email
162 { 153 {
163 char *name; 154 char *username;
164 char *email; 155 char *email;
165 SCM ret; 156 SCM ret;
166 157
167 if (SCM_UNBNDP (NAME)) 158 if (SCM_UNBNDP (name))
168 name = NULL; 159 username = NULL;
169 else 160 else
170 { 161 {
171 SCM_ASSERT (scm_is_string (NAME), NAME, SCM_ARG1, FUNC_NAME); 162 SCM_ASSERT (scm_is_string (name), name, SCM_ARG1, FUNC_NAME);
172 name = scm_to_locale_string (NAME); 163 username = scm_to_locale_string (name);
173 } 164 }
174 165
175 email = mu_get_user_email (name); 166 email = mu_get_user_email (username);
176 free (name); 167 free (username);
177 if (!email) 168 if (!email)
178 mu_scm_error (FUNC_NAME, 0, 169 mu_scm_error (FUNC_NAME, 0,
179 "Cannot get user email for ~A", 170 "Cannot get user email for ~A",
180 scm_list_1 (NAME)); 171 scm_list_1 (name));
181 172
182 ret = scm_from_locale_string (email); 173 ret = scm_from_locale_string (email);
183 free (email); 174 free (email);
......
...@@ -103,16 +103,16 @@ mu_scm_body_create (SCM msg, mu_body_t body) ...@@ -103,16 +103,16 @@ mu_scm_body_create (SCM msg, mu_body_t body)
103 /* Guile primitives */ 103 /* Guile primitives */
104 104
105 SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0, 105 SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0,
106 (SCM BODY), 106 (SCM body),
107 "Read next line from the BODY.") 107 "Read next line from the @var{body}.")
108 #define FUNC_NAME s_scm_mu_body_read_line 108 #define FUNC_NAME s_scm_mu_body_read_line
109 { 109 {
110 struct mu_body *mbp; 110 struct mu_body *mbp;
111 size_t n, nread; 111 size_t n, nread;
112 int status; 112 int status;
113 113
114 SCM_ASSERT (mu_scm_is_body (BODY), BODY, SCM_ARG1, FUNC_NAME); 114 SCM_ASSERT (mu_scm_is_body (body), body, SCM_ARG1, FUNC_NAME);
115 mbp = (struct mu_body *) SCM_CDR (BODY); 115 mbp = (struct mu_body *) SCM_CDR (body);
116 116
117 if (!mbp->stream) 117 if (!mbp->stream)
118 { 118 {
...@@ -164,8 +164,8 @@ SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0, ...@@ -164,8 +164,8 @@ SCM_DEFINE_PUBLIC (scm_mu_body_read_line, "mu-body-read-line", 1, 0, 0,
164 #undef FUNC_NAME 164 #undef FUNC_NAME
165 165
166 SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, 166 SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0,
167 (SCM BODY, SCM TEXT), 167 (SCM body, SCM text),
168 "Append TEXT to message BODY.") 168 "Append @var{text} to message @var{body}.")
169 #define FUNC_NAME s_scm_mu_body_write 169 #define FUNC_NAME s_scm_mu_body_write
170 { 170 {
171 char *ptr; 171 char *ptr;
...@@ -173,9 +173,9 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, ...@@ -173,9 +173,9 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0,
173 struct mu_body *mbp; 173 struct mu_body *mbp;
174 int status; 174 int status;
175 175
176 SCM_ASSERT (mu_scm_is_body (BODY), BODY, SCM_ARG1, FUNC_NAME); 176 SCM_ASSERT (mu_scm_is_body (body), body, SCM_ARG1, FUNC_NAME);
177 mbp = (struct mu_body *) SCM_CDR (BODY); 177 mbp = (struct mu_body *) SCM_CDR (body);
178 SCM_ASSERT (scm_is_string (TEXT), TEXT, SCM_ARG2, FUNC_NAME); 178 SCM_ASSERT (scm_is_string (text), text, SCM_ARG2, FUNC_NAME);
179 179
180 if (!mbp->stream) 180 if (!mbp->stream)
181 { 181 {
...@@ -185,9 +185,10 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0, ...@@ -185,9 +185,10 @@ SCM_DEFINE_PUBLIC (scm_mu_body_write, "mu-body-write", 2, 0, 0,
185 "Cannot get body stream", SCM_BOOL_F); 185 "Cannot get body stream", SCM_BOOL_F);
186 } 186 }
187 187
188 ptr = SCM_STRING_CHARS (TEXT); 188 ptr = scm_to_locale_string (text);
189 len = strlen (ptr); 189 len = strlen (ptr);
190 status = mu_stream_write (mbp->stream, ptr, len, mbp->offset, &n); 190 status = mu_stream_write (mbp->stream, ptr, len, mbp->offset, &n);
191 free (ptr);
191 mu_scm_error (FUNC_NAME, status, 192 mu_scm_error (FUNC_NAME, status,
192 "Error writing to stream", SCM_BOOL_F); 193 "Error writing to stream", SCM_BOOL_F);
193 mbp->offset += n; 194 mbp->offset += n;
......
...@@ -24,37 +24,37 @@ ...@@ -24,37 +24,37 @@
24 static char *log_tag; 24 static char *log_tag;
25 25
26 SCM_DEFINE_PUBLIC (scm_mu_openlog, "mu-openlog", 3, 0, 0, 26 SCM_DEFINE_PUBLIC (scm_mu_openlog, "mu-openlog", 3, 0, 0,
27 (SCM IDENT, SCM OPTION, SCM FACILITY), 27 (SCM ident, SCM option, SCM facility),
28 "Opens a connection to the system logger for Guile program.\n" 28 "Opens a connection to the system logger for Guile program.\n"
29 "IDENT, OPTION and FACILITY have the same meaning as in openlog(3)") 29 "@var{ident}, @var{option} and @var{facility} have the same meaning as in openlog(3)")
30 #define FUNC_NAME s_scm_mu_openlog 30 #define FUNC_NAME s_scm_mu_openlog
31 { 31 {
32 SCM_ASSERT (scm_is_string (IDENT), IDENT, SCM_ARG1, FUNC_NAME); 32 SCM_ASSERT (scm_is_string (ident), ident, SCM_ARG1, FUNC_NAME);
33 if (log_tag) 33 if (log_tag)
34 free (log_tag); 34 free (log_tag);
35 log_tag = scm_to_locale_string(IDENT); 35 log_tag = scm_to_locale_string (ident);
36 36
37 SCM_ASSERT (scm_is_integer (OPTION), OPTION, SCM_ARG2, FUNC_NAME); 37 SCM_ASSERT (scm_is_integer (option), option, SCM_ARG2, FUNC_NAME);
38 SCM_ASSERT (scm_is_integer (FACILITY), FACILITY, SCM_ARG3, FUNC_NAME); 38 SCM_ASSERT (scm_is_integer (facility), facility, SCM_ARG3, FUNC_NAME);
39 openlog (log_tag, scm_to_int (OPTION), scm_to_int (FACILITY)); 39 openlog (log_tag, scm_to_int (option), scm_to_int (facility));
40 return SCM_UNSPECIFIED; 40 return SCM_UNSPECIFIED;
41 } 41 }
42 #undef FUNC_NAME 42 #undef FUNC_NAME
43 43
44 SCM_DEFINE_PUBLIC (scm_mu_logger, "mu-logger", 2, 0, 0, 44 SCM_DEFINE_PUBLIC (scm_mu_logger, "mu-logger", 2, 0, 0,
45 (SCM PRIO, SCM TEXT), 45 (SCM prio, SCM text),
46 "Distributes TEXT via syslogd priority PRIO.") 46 "Distributes @var{text} via the syslog priority @var{prio}.")
47 #define FUNC_NAME s_scm_mu_logger 47 #define FUNC_NAME s_scm_mu_logger
48 { 48 {
49 int prio; 49 int nprio;
50 char *str; 50 char *str;
51 51
52 SCM_ASSERT (scm_is_integer (PRIO), PRIO, SCM_ARG1, FUNC_NAME); 52 SCM_ASSERT (scm_is_integer (prio), prio, SCM_ARG1, FUNC_NAME);
53 prio = scm_to_int (PRIO); 53 nprio = scm_to_int (prio);
54 54
55 SCM_ASSERT (scm_is_string (TEXT), TEXT, SCM_ARG2, FUNC_NAME); 55 SCM_ASSERT (scm_is_string (text), text, SCM_ARG2, FUNC_NAME);
56 str = scm_to_locale_string (TEXT); 56 str = scm_to_locale_string (text);
57 syslog (prio, "%s", str); 57 syslog (nprio, "%s", str);
58 free (str); 58 free (str);
59 return SCM_UNSPECIFIED; 59 return SCM_UNSPECIFIED;
60 } 60 }
......
...@@ -90,65 +90,66 @@ mu_scm_is_mime (SCM scm) ...@@ -90,65 +90,66 @@ mu_scm_is_mime (SCM scm)
90 /* Guile primitives */ 90 /* Guile primitives */
91 91
92 SCM_DEFINE_PUBLIC (scm_mu_mime_create, "mu-mime-create", 0, 2, 0, 92 SCM_DEFINE_PUBLIC (scm_mu_mime_create, "mu-mime-create", 0, 2, 0,
93 (SCM FLAGS, SCM MESG), 93 (SCM flags, SCM mesg),
94 "Creates a new @acronym{MIME} object. Both arguments are optional.\n" 94 "Creates a new @acronym{MIME} object. Both arguments are optional.\n"
95 "FLAGS specifies the type of the object to create (@samp{0} is a reasonable\n" 95 "@var{Flags} specifies the type of the object to create (@samp{0} is a\n"
96 "value). MESG gives the message to create the @acronym{MIME} object from.") 96 "reasonable value). @var{mesg} gives the message to create the\n"
97 "@acronym{MIME} object from.")
97 #define FUNC_NAME s_scm_mu_mime_create 98 #define FUNC_NAME s_scm_mu_mime_create
98 { 99 {
99 mu_message_t msg = NULL; 100 mu_message_t msg = NULL;
100 mu_mime_t mime; 101 mu_mime_t mime;
101 int flags; 102 int fl;
102 int status; 103 int status;
103 104
104 if (scm_is_bool (FLAGS)) 105 if (scm_is_bool (flags))
105 { 106 {
106 /*if (FLAGS == SCM_BOOL_F)*/ 107 /*if (flags == SCM_BOOL_F)*/
107 flags = 0; 108 fl = 0;
108 } 109 }
109 else 110 else
110 { 111 {
111 SCM_ASSERT (scm_is_integer (FLAGS), FLAGS, SCM_ARG1, FUNC_NAME); 112 SCM_ASSERT (scm_is_integer (flags), flags, SCM_ARG1, FUNC_NAME);
112 flags = scm_to_int32 (FLAGS); 113 fl = scm_to_int (flags);
113 } 114 }
114 115
115 if (!SCM_UNBNDP (MESG)) 116 if (!SCM_UNBNDP (mesg))
116 { 117 {
117 SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG2, FUNC_NAME); 118 SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG2, FUNC_NAME);
118 msg = mu_scm_message_get (MESG); 119 msg = mu_scm_message_get (mesg);
119 } 120 }
120 121
121 status = mu_mime_create (&mime, msg, flags); 122 status = mu_mime_create (&mime, msg, fl);
122 if (status) 123 if (status)
123 mu_scm_error (FUNC_NAME, status, 124 mu_scm_error (FUNC_NAME, status,
124 "Cannot create MIME object", SCM_BOOL_F); 125 "Cannot create MIME object", SCM_BOOL_F);
125 126
126 return mu_scm_mime_create (MESG, mime); 127 return mu_scm_mime_create (mesg, mime);
127 } 128 }
128 #undef FUNC_NAME 129 #undef FUNC_NAME
129 130
130 SCM_DEFINE_PUBLIC (scm_mu_mime_multipart_p, "mu-mime-multipart?", 1, 0, 0, 131 SCM_DEFINE_PUBLIC (scm_mu_mime_multipart_p, "mu-mime-multipart?", 1, 0, 0,
131 (SCM MIME), 132 (SCM mime),
132 "Returns @code{#t} if MIME is a multipart object.\n") 133 "Returns @code{#t} if @var{mime} is a multipart object.\n")
133 #define FUNC_NAME s_scm_mu_mime_multipart_p 134 #define FUNC_NAME s_scm_mu_mime_multipart_p
134 { 135 {
135 SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); 136 SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
136 return mu_mime_is_multipart (mu_scm_mime_get (MIME)) ? SCM_BOOL_T : SCM_BOOL_F; 137 return mu_mime_is_multipart (mu_scm_mime_get (mime)) ? SCM_BOOL_T : SCM_BOOL_F;
137 } 138 }
138 #undef FUNC_NAME 139 #undef FUNC_NAME
139 140
140 SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0, 141 SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0,
141 (SCM MIME), 142 (SCM mime),
142 "Returns number of parts in the @sc{mime} object MIME.") 143 "Returns number of parts in the @acronym{MIME} object @var{mime}.")
143 #define FUNC_NAME s_scm_mu_mime_get_num_parts 144 #define FUNC_NAME s_scm_mu_mime_get_num_parts
144 { 145 {
145 mu_mime_t mime; 146 mu_mime_t mimeobj;
146 size_t nparts; 147 size_t nparts;
147 int status; 148 int status;
148 149
149 SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); 150 SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
150 mime = mu_scm_mime_get (MIME); 151 mimeobj = mu_scm_mime_get (mime);
151 status = mu_mime_get_num_parts (mime, &nparts); 152 status = mu_mime_get_num_parts (mimeobj, &nparts);
152 if (status) 153 if (status)
153 mu_scm_error (FUNC_NAME, status, 154 mu_scm_error (FUNC_NAME, status,
154 "Cannot count MIME parts", SCM_BOOL_F); 155 "Cannot count MIME parts", SCM_BOOL_F);
...@@ -157,71 +158,71 @@ SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0, ...@@ -157,71 +158,71 @@ SCM_DEFINE_PUBLIC (scm_mu_mime_get_num_parts, "mu-mime-get-num-parts", 1, 0, 0,
157 #undef FUNC_NAME 158 #undef FUNC_NAME
158 159
159 SCM_DEFINE_PUBLIC (scm_mu_mime_get_part, "mu-mime-get-part", 2, 0, 0, 160 SCM_DEFINE_PUBLIC (scm_mu_mime_get_part, "mu-mime-get-part", 2, 0, 0,
160 (SCM MIME, SCM NUM), 161 (SCM mime, SCM num),
161 "Returns NUMth part from the @sc{mime} object MIME.") 162 "Returns @var{num}th part from the @acronym{MIME} object @var{mime}.")
162 #define FUNC_NAME s_scm_mu_mime_get_part 163 #define FUNC_NAME s_scm_mu_mime_get_part
163 { 164 {
164 mu_message_t msg = NULL; 165 mu_message_t msg = NULL;
165 int status; 166 int status;
166 167
167 SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); 168 SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
168 SCM_ASSERT (scm_is_integer (NUM), NUM, SCM_ARG2, FUNC_NAME); 169 SCM_ASSERT (scm_is_integer (num), num, SCM_ARG2, FUNC_NAME);
169 170
170 status = mu_mime_get_part (mu_scm_mime_get (MIME), 171 status = mu_mime_get_part (mu_scm_mime_get (mime),
171 scm_to_int32 (NUM), &msg); 172 scm_to_int (num), &msg);
172 if (status) 173 if (status)
173 mu_scm_error (FUNC_NAME, status, 174 mu_scm_error (FUNC_NAME, status,
174 "Cannot get part ~A from MIME object ~A", 175 "Cannot get part ~A from MIME object ~A",
175 scm_list_2 (NUM, MIME)); 176 scm_list_2 (num, mime));
176 177
177 return mu_scm_message_create (MIME, msg); 178 return mu_scm_message_create (mime, msg);
178 } 179 }
179 #undef FUNC_NAME 180 #undef FUNC_NAME
180 181
181 SCM_DEFINE_PUBLIC (scm_mu_mime_add_part, "mu-mime-add-part", 2, 0, 0, 182 SCM_DEFINE_PUBLIC (scm_mu_mime_add_part, "mu-mime-add-part", 2, 0, 0,
182 (SCM MIME, SCM MESG), 183 (SCM mime, SCM mesg),
183 "Adds MESG to the @sc{mime} object MIME.") 184 "Adds message @var{mesg} to the @acronym{MIME} object @var{mime}.")
184 #define FUNC_NAME s_scm_mu_mime_add_part 185 #define FUNC_NAME s_scm_mu_mime_add_part
185 { 186 {
186 mu_mime_t mime; 187 mu_mime_t mimeobj;
187 mu_message_t msg; 188 mu_message_t msg;
188 int status; 189 int status;
189 190
190 SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); 191 SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
191 SCM_ASSERT (mu_scm_is_message (MESG), MESG, SCM_ARG2, FUNC_NAME); 192 SCM_ASSERT (mu_scm_is_message (mesg), mesg, SCM_ARG2, FUNC_NAME);
192 mime = mu_scm_mime_get (MIME); 193 mimeobj = mu_scm_mime_get (mime);
193 msg = mu_scm_message_get (MESG); 194 msg = mu_scm_message_get (mesg);
194 195
195 status = mu_mime_add_part (mime, msg); 196 status = mu_mime_add_part (mimeobj, msg);
196 if (status) 197 if (status)
197 mu_scm_error (FUNC_NAME, status, 198 mu_scm_error (FUNC_NAME, status,
198 "Cannot add new part to MIME object ~A", 199 "Cannot add new part to MIME object ~A",
199 scm_list_1 (MIME)); 200 scm_list_1 (mime));
200 201
201 mu_scm_message_add_owner (MESG, MIME); 202 mu_scm_message_add_owner (mesg, mime);
202 203
203 return SCM_BOOL_T; 204 return SCM_BOOL_T;
204 } 205 }
205 #undef FUNC_NAME 206 #undef FUNC_NAME
206 207
207 SCM_DEFINE_PUBLIC (scm_mu_mime_get_message, "mu-mime-get-message", 1, 0, 0, 208 SCM_DEFINE_PUBLIC (scm_mu_mime_get_message, "mu-mime-get-message", 1, 0, 0,
208 (SCM MIME), 209 (SCM mime),
209 "Converts @sc{mime} object MIME to a message.\n") 210 "Converts @acronym{MIME} object @var{mime} to a message.\n")
210 #define FUNC_NAME s_scm_mu_mime_get_message 211 #define FUNC_NAME s_scm_mu_mime_get_message
211 { 212 {
212 mu_mime_t mime; 213 mu_mime_t mimeobj;
213 mu_message_t msg; 214 mu_message_t msg;
214 int status; 215 int status;
215 216
216 SCM_ASSERT (mu_scm_is_mime (MIME), MIME, SCM_ARG1, FUNC_NAME); 217 SCM_ASSERT (mu_scm_is_mime (mime), mime, SCM_ARG1, FUNC_NAME);
217 mime = mu_scm_mime_get (MIME); 218 mimeobj = mu_scm_mime_get (mime);
218 status = mu_mime_get_message (mime, &msg); 219 status = mu_mime_get_message (mimeobj, &msg);
219 if (status) 220 if (status)
220 mu_scm_error (FUNC_NAME, status, 221 mu_scm_error (FUNC_NAME, status,
221 "Cannot get message from MIME object ~A", 222 "Cannot get message from MIME object ~A",
222 scm_list_1 (MIME)); 223 scm_list_1 (mime));
223 224
224 return mu_scm_message_create (MIME, msg); 225 return mu_scm_message_create (mime, msg);
225 } 226 }
226 #undef FUNC_NAME 227 #undef FUNC_NAME
227 228
......
...@@ -89,7 +89,7 @@ register_format (const char *name) ...@@ -89,7 +89,7 @@ register_format (const char *name)
89 89
90 90
91 SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, 91 SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1,
92 (SCM REST), 92 (SCM rest),
93 "Registers desired mailutils formats. Any number of arguments can be given.\n" 93 "Registers desired mailutils formats. Any number of arguments can be given.\n"
94 "Each argument must be one of the following strings:\n\n" 94 "Each argument must be one of the following strings:\n\n"
95 "@multitable @columnfractions 0.3 0.6\n" 95 "@multitable @columnfractions 0.3 0.6\n"
...@@ -108,7 +108,7 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, ...@@ -108,7 +108,7 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1,
108 { 108 {
109 int status; 109 int status;
110 110
111 if (scm_is_null (REST)) 111 if (scm_is_null (rest))
112 { 112 {
113 status = register_format (NULL); 113 status = register_format (NULL);
114 if (status) 114 if (status)
...@@ -118,10 +118,10 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, ...@@ -118,10 +118,10 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1,
118 } 118 }
119 else 119 else
120 { 120 {
121 for (; !scm_is_null (REST); REST = SCM_CDR (REST)) 121 for (; !scm_is_null (rest); rest = SCM_CDR (rest))
122 { 122 {
123 char *s; 123 char *s;
124 SCM scm = SCM_CAR (REST); 124 SCM scm = SCM_CAR (rest);
125 SCM_ASSERT (scm_is_string (scm), scm, SCM_ARGn, FUNC_NAME); 125 SCM_ASSERT (scm_is_string (scm), scm, SCM_ARGn, FUNC_NAME);
126 s = scm_to_locale_string (scm); 126 s = scm_to_locale_string (scm);
127 status = register_format (s); 127 status = register_format (s);
...@@ -137,13 +137,13 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1, ...@@ -137,13 +137,13 @@ SCM_DEFINE_PUBLIC (scm_mu_register_format, "mu-register-format", 0, 0, 1,
137 #undef FUNC_NAME 137 #undef FUNC_NAME
138 138
139 SCM_DEFINE_PUBLIC (scm_mu_strerror, "mu-strerror", 1, 0, 0, 139 SCM_DEFINE_PUBLIC (scm_mu_strerror, "mu-strerror", 1, 0, 0,
140 (SCM ERR), 140 (SCM err),
141 "Return the error message corresponding to ERR, which must be\n" 141 "Return the error message corresponding to @var{err}, which must be\n"
142 "an integer value.\n") 142 "an integer value.\n")
143 #define FUNC_NAME s_scm_mu_strerror 143 #define FUNC_NAME s_scm_mu_strerror
144 { 144 {
145 SCM_ASSERT (scm_is_integer (ERR), ERR, SCM_ARG1, FUNC_NAME); 145 SCM_ASSERT (scm_is_integer (err), err, SCM_ARG1, FUNC_NAME);
146 return scm_from_locale_string (mu_strerror (scm_to_int (ERR))); 146 return scm_from_locale_string (mu_strerror (scm_to_int (err)));
147 } 147 }
148 #undef FUNC_NAME 148 #undef FUNC_NAME
149 149
......
...@@ -20,8 +20,8 @@ ...@@ -20,8 +20,8 @@
20 #include "mu_scm.h" 20 #include "mu_scm.h"
21 21
22 SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, 22 SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0,
23 (SCM USER), 23 (SCM user),
24 "Look up an entry in the user database. USER can be an integer,\n" 24 "Look up an entry in the user database. @var{User} can be an integer,\n"
25 "or a string, giving the behaviour of @code{mu_get_auth_by_uid} or\n" 25 "or a string, giving the behaviour of @code{mu_get_auth_by_uid} or\n"
26 "@code{mu_get_auth_by_name} respectively.\n" 26 "@code{mu_get_auth_by_name} respectively.\n"
27 "\n" 27 "\n"
...@@ -39,16 +39,16 @@ SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0, ...@@ -39,16 +39,16 @@ SCM_DEFINE_PUBLIC (scm_mu_getpwuid, "mu-getpwuid", 1, 0, 0,
39 &handle, 39 &handle,
40 NULL, NULL); 40 NULL, NULL);
41 41
42 if (scm_is_integer (USER)) 42 if (scm_is_integer (user))
43 { 43 {
44 entry = mu_get_auth_by_uid (scm_to_int32 (USER)); 44 entry = mu_get_auth_by_uid (scm_to_int (user));
45 } 45 }
46 else 46 else
47 { 47 {
48 char *s; 48 char *s;
49 49
50 SCM_VALIDATE_STRING (1, USER); 50 SCM_VALIDATE_STRING (1, user);
51 s = scm_to_locale_string (USER); 51 s = scm_to_locale_string (user);
52 entry = mu_get_auth_by_name (s); 52 entry = mu_get_auth_by_name (s);
53 free (s); 53 free (s);
54 } 54 }
......