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