1/*	$NetBSD: thread.h,v 1.3 2023/08/10 20:36:28 mrg 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 *
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
30 */
31
32#ifdef THREAD_SUPPORT
33
34#ifndef __THREAD_H__
35#define __THREAD_H__
36
37#if 0
38#define NDEBUG	/* disable the asserts */
39#endif
40
41/*
42 * The core message control routines.  Without thread support, they
43 * live in fio.c.
44 */
45struct message *next_message(struct message *);
46struct message *prev_message(struct message *);
47struct message *get_message(int);
48int	 get_msgnum(struct message *);
49int	 get_msgCount(void);
50
51/* These give special access to the message array needed in lex.c */
52struct message *get_abs_message(int);
53struct message *next_abs_message(struct message *);
54int	 get_abs_msgCount(void);
55
56/*
57 * Support hooks used by other modules.
58 */
59void	 thread_fix_old_links(struct message *, ptrdiff_t, int);
60void	 thread_fix_new_links(struct message *, int, int);
61int	 thread_hidden(void);
62int	 thread_depth(void);
63int	 do_recursion(void);
64int	 thread_recursion(struct message *, int (*)(struct message *, void *), void *);
65const char *thread_next_key_name(const void **);
66
67/*
68 * Commands.
69 */
70/* thread setup */
71int	 flattencmd(void *);
72int	 reversecmd(void *v);
73int	 sortcmd(void *);
74int	 threadcmd(void *);
75int	 unthreadcmd(void *);
76
77/* thread navigation */
78int	 downcmd(void *);
79int	 tsetcmd(void *);
80int	 upcmd(void *);
81
82/* thread display */
83int	 exposecmd(void *);
84int	 hidecmd(void *);
85
86/* tag commands */
87int	 invtagscmd(void *);
88int	 tagbelowcmd(void *);
89int	 tagcmd(void *);
90int	 untagcmd(void *);
91
92/* tag display */
93int	 hidetagscmd(void *);
94int	 showtagscmd(void *);
95
96/* something special */
97int	 deldupscmd(void *);
98
99#define ENAME_RECURSIVE_CMDS	"recursive-commands"
100
101/*
102 * Debugging stuff that should go away.
103 */
104#define THREAD_DEBUG
105#ifdef THREAD_DEBUG
106int	 thread_showcmd(void *);
107#endif /* THREAD_DEBUG */
108
109#endif /* __THREAD_H__ */
110#endif /* THREAD_SUPPORT */
111