xref: /netbsd-src/tests/lib/libcurses/director/returns.h (revision cf012ad48f5bbc9b8b801c4e79fd24e2612abbe9)
1 /*	$NetBSD: returns.h,v 1.6 2021/02/13 08:14:46 rillig Exp $	*/
2 
3 /*-
4  * Copyright 2009 Brett Lymn <blymn@NetBSD.org>
5  * Copyright 2021 Roland Illig <rillig@NetBSD.org>
6  *
7  * All rights reserved.
8  *
9  * This code has been donated to The NetBSD Foundation by the Author.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted provided that the following conditions
13  * are met:
14  * 1. Redistributions of source code must retain the above copyright
15  *    notice, this list of conditions and the following disclaimer.
16  * 2. The name of the author may not be used to endorse or promote products
17  *    derived from this software without specific prior written permission
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
20  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
21  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
22  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
23  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
28  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef CTF_RETURNS_H
32 #define CTF_RETURNS_H
33 
34 typedef enum {
35 	data_number = 1,
36 	data_static,
37 	data_string,
38 	data_byte,
39 	data_cchar,
40 	data_wchar,
41 	data_err,
42 	data_ok,
43 	data_null,
44 	data_nonnull,
45 	data_var,
46 	data_ref,
47 	data_count,
48 	data_slave_error
49 } data_enum_t;
50 
51 typedef struct {
52 	data_enum_t	data_type;
53 	void		*data_value;	/* used if data_type is data_num
54 					   or data_byte or data_string */
55 	size_t		data_len;	/* number of bytes in return_value iff
56 					   return_type is data_byte */
57 	int		data_index;	/* index into var array for return
58 					   if data_type is data_var */
59 } ct_data_t;
60 
61 typedef struct {
62 	size_t	count;
63 	size_t	allocated;
64 	size_t	readp;
65 	char	*data;
66 } saved_data_t;
67 
68 #endif
69