Added mu-mailbox-get-port.
Showing
1 changed file
with
23 additions
and
1 deletions
... | @@ -93,7 +93,7 @@ mu_scm_is_mailbox (SCM scm) | ... | @@ -93,7 +93,7 @@ mu_scm_is_mailbox (SCM scm) |
93 | return SCM_NIMP (scm) && SCM_CAR (scm) == mailbox_tag; | 93 | return SCM_NIMP (scm) && SCM_CAR (scm) == mailbox_tag; |
94 | } | 94 | } |
95 | 95 | ||
96 | /* ************************************************************************** */ | 96 | /* ************************************************************************* */ |
97 | /* Guile primitives */ | 97 | /* Guile primitives */ |
98 | 98 | ||
99 | SCM_DEFINE (mu_mailbox_open, "mu-mailbox-open", 2, 0, 0, | 99 | SCM_DEFINE (mu_mailbox_open, "mu-mailbox-open", 2, 0, 0, |
... | @@ -171,6 +171,28 @@ SCM_DEFINE (mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0, | ... | @@ -171,6 +171,28 @@ SCM_DEFINE (mu_mailbox_get_url, "mu-mailbox-get-url", 1, 0, 0, |
171 | } | 171 | } |
172 | #undef FUNC_NAME | 172 | #undef FUNC_NAME |
173 | 173 | ||
174 | SCM_DEFINE (mu_mailbox_get_port, "mu-mailbox-get-port", 2, 0, 0, | ||
175 | (SCM MBOX, SCM MODE), | ||
176 | "Returns a port associated with the contents of the MBOX.\n" | ||
177 | "MODE is a string defining operation mode of the stream. It may\n" | ||
178 | "contain any of the two characters: \"r\" for reading, \"w\" for\n" | ||
179 | "writing.\n") | ||
180 | #define FUNC_NAME s_mu_mailbox_get_port | ||
181 | { | ||
182 | struct mu_mailbox *mum; | ||
183 | stream_t stream; | ||
184 | |||
185 | SCM_ASSERT (mu_scm_is_mailbox (MBOX), MBOX, SCM_ARG1, FUNC_NAME); | ||
186 | SCM_ASSERT (SCM_NIMP (MODE) && SCM_STRINGP (MODE), | ||
187 | MODE, SCM_ARG2, FUNC_NAME); | ||
188 | mum = (struct mu_mailbox *) SCM_CDR (MBOX); | ||
189 | if (mailbox_get_stream (mum->mbox, &stream)) | ||
190 | return SCM_BOOL_F; | ||
191 | return mu_port_make_from_stream (MBOX, stream, | ||
192 | scm_mode_bits (SCM_CHARS (MODE))); | ||
193 | } | ||
194 | #undef FUNC_NAME | ||
195 | |||
174 | SCM_DEFINE (mu_mailbox_get_message, "mu-mailbox-get-message", 2, 0, 0, | 196 | SCM_DEFINE (mu_mailbox_get_message, "mu-mailbox-get-message", 2, 0, 0, |
175 | (SCM MBOX, SCM MSGNO), "Retrieve from MBOX message # MSGNO.") | 197 | (SCM MBOX, SCM MSGNO), "Retrieve from MBOX message # MSGNO.") |
176 | #define FUNC_NAME s_mu_mailbox_get_message | 198 | #define FUNC_NAME s_mu_mailbox_get_message | ... | ... |
-
Please register or sign in to post a comment