xref: /netbsd-src/usr.bin/mail/thread.h (revision 8b0f9554ff8762542c4defc4f70e1eb76fb508fa)
1 /*	$NetBSD: thread.h,v 1.1 2006/11/28 18:45:32 christos Exp $	*/
2 
3 /*-
4  * Copyright (c) 2006 The NetBSD Foundation, Inc.
5  * All rights reserved.
6  *
7  * This code is derived from software contributed to The NetBSD Foundation
8  * by Anon Ymous.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  * 1. Redistributions of source code must retain the above copyright
14  *    notice, this list of conditions and the following disclaimer.
15  * 2. Redistributions in binary form must reproduce the above copyright
16  *    notice, this list of conditions and the following disclaimer in the
17  *    documentation and/or other materials provided with the distribution.
18  * 3. All advertising materials mentioning features or use of this software
19  *    must display the following acknowledgement:
20  *        This product includes software developed by the NetBSD
21  *        Foundation, Inc. and its contributors.
22  * 4. Neither the name of The NetBSD Foundation nor the names of its
23  *    contributors may be used to endorse or promote products derived
24  *    from this software without specific prior written permission.
25  *
26  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
27  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
28  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
29  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
30  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36  * POSSIBILITY OF SUCH DAMAGE.
37  */
38 
39 #ifdef THREAD_SUPPORT
40 
41 #ifndef __THREAD_H__
42 #define __THREAD_H__
43 
44 #if 0
45 #define NDEBUG	/* disable the asserts */
46 #endif
47 
48 /*
49  * The core message control routines.  Without thread support, they
50  * live in fio.c.
51  */
52 struct message *next_message(struct message *);
53 struct message *prev_message(struct message *);
54 struct message *get_message(int);
55 int	 get_msgnum(struct message *);
56 int	 get_msgCount(void);
57 
58 /* These give special access to the message array needed in lex.c */
59 struct message *get_abs_message(int);
60 struct message *next_abs_message(struct message *);
61 int	 get_abs_msgCount(void);
62 
63 /*
64  * Support hooks used by other modules.
65  */
66 void	 thread_fix_old_links(struct message *, struct message *, int);
67 void	 thread_fix_new_links(struct message *, int, int);
68 int	 thread_hidden(void);
69 int	 thread_depth(void);
70 int	 do_recursion(void);
71 int	 thread_recursion(struct message *, int (*)(struct message *, void *), void *);
72 const char *thread_next_key_name(const void **);
73 
74 /*
75  * Commands.
76  */
77 /* thread setup */
78 int	 flattencmd(void *);
79 int	 reversecmd(void *v);
80 int	 sortcmd(void *);
81 int	 threadcmd(void *);
82 int	 unthreadcmd(void *);
83 
84 /* thread navigation */
85 int	 downcmd(void *);
86 int	 tsetcmd(void *);
87 int	 upcmd(void *);
88 
89 /* thread display */
90 int	 exposecmd(void *);
91 int	 hidecmd(void *);
92 
93 /* tag commands */
94 int	 invtagscmd(void *);
95 int	 tagbelowcmd(void *);
96 int	 tagcmd(void *);
97 int	 untagcmd(void *);
98 
99 /* tag display */
100 int	 hidetagscmd(void *);
101 int	 showtagscmd(void *);
102 
103 /* something special */
104 int	 deldupscmd(void *);
105 
106 #define ENAME_RECURSIVE_CMDS	"recursive-commands"
107 
108 /*
109  * Debugging stuff that should go away.
110  */
111 #define THREAD_DEBUG
112 #ifdef THREAD_DEBUG
113 int	 thread_showcmd(void *);
114 #endif /* THREAD_DEBUG */
115 
116 #endif /* __THREAD_H__ */
117 #endif /* THREAD_SUPPORT */
118