libmu_scm.texi
2.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
@c This is part of the GNU Mailutils manual.
@c Copyright (C) 1999,2000,2001,2002,2003,2004,2006 Free Software Foundation, Inc.
@c See file mailutils.texi for copying conditions.
@comment *******************************************************************
The library @file{libmu_scm} provides an interface between Mailutils
and Guile, allowing to access the Mailutils functionality from a
Scheme program. For more information about Guile, refer to
@ref{Top,,Overview,guile,The Guile Reference Manual}. For information
about Scheme programming language, @xref{Top,,,r4rs,Revised(4) Report on
the Algorithmic Language Scheme}.
@menu
Functions Provided by @file{libmu_scm}
* Address Functions::
* Mailbox Functions::
* Message Functions::
* MIME Functions::
* Logging Functions::
* Other Functions::
Using @file{libmu_scm}
* Direct Linking::
* Dynamic Linking::
@end menu
@node Address Functions
@subsection Address Functions
@include mu_address.texi
@node Mailbox Functions
@subsection Mailbox Functions
@include mu_mailbox.texi
@node Message Functions
@subsection Message Functions
@include mu_message.texi
@include mu_body.texi
@node MIME Functions
@subsection MIME Functions
@include mu_mime.texi
@node Logging Functions
@subsection Logging Functions
@include mu_logger.texi
@node Other Functions
@subsection Other Functions
@include mu_scm.texi
@node Direct Linking
@subsection Direct Linking
If you plan to link your program directly to @file{libguile}, it will
probably make sense to link @file{libmu_scm} directly as well. The
arguments to the program loader may be obtained by running
@smallexample
mailutils-config --link guile
@end smallexample
@noindent
@xref{mailutils-config}, for more information about this utility.
Here is a sample Makefile fragment:
@smallexample
MU_LDFLAGS=`mailutils-config --link guile`
MU_INCLUDES=`mailutils-config --include`
myprog: myprog.c
$(CC) -omyprog $(CFLAGS) $(MU_INCLUDES) myprog.c $(MU_LDFLAGS)
@end smallexample
@node Dynamic Linking
@subsection Dynamic Linking
Dynamic linking is the preferred method of using @file{libmu_scm}. It
uses Guile ``use-modules'' mechanism. An interface module
@file{mailutils.scm} is provided in order to facilitate using this
method. This module is installed in the package data directory (by
default it is @file{@var{prefix}/share/mailutils}). A sample use of
this module is:
@smallexample
(set! %load-path (list "/usr/local/share/mailutils"))
(use-modules (mailutils))
# Now you may use mailutils functions:
(let ((mb (mu-mailbox-open "/var/spool/mail/gray" "r")))
...
@end smallexample
@emph{Note}, that you should explicitly modify the @code{%load-path}
before calling @code{use-modules}, otherwise Guile will not be able to
find @file{mailutils.scm}.