1 /*	$NetBSD: rtbl.h,v 1.1.1.2 2011/04/14 14:09:31 elric Exp $	*/
2 
3 /*
4  * Copyright (c) 2000,2004 Kungliga Tekniska Högskolan
5  * (Royal Institute of Technology, Stockholm, Sweden).
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions
10  * are met:
11  *
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  *
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  * 3. Neither the name of the Institute nor the names of its contributors
20  *    may be used to endorse or promote products derived from this software
21  *    without specific prior written permission.
22  *
23  * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
24  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26  * ARE DISCLAIMED.  IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
27  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33  * SUCH DAMAGE.
34  */
35 /* Id */
36 
37 #ifndef __rtbl_h__
38 #define __rtbl_h__
39 
40 #ifndef ROKEN_LIB_FUNCTION
41 #ifdef _WIN32
42 #define ROKEN_LIB_FUNCTION
43 #define ROKEN_LIB_CALL     __cdecl
44 #else
45 #define ROKEN_LIB_FUNCTION
46 #define ROKEN_LIB_CALL
47 #endif
48 #endif
49 
50 #if !defined(__GNUC__) && !defined(__attribute__)
51 #define __attribute__(x)
52 #endif
53 
54 #ifdef __cplusplus
55 extern "C" {
56 #endif
57 
58 struct rtbl_data;
59 typedef struct rtbl_data *rtbl_t;
60 
61 #define RTBL_ALIGN_LEFT		0
62 #define RTBL_ALIGN_RIGHT	1
63 
64 /* flags */
65 #define RTBL_HEADER_STYLE_NONE	1
66 
67 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
68 rtbl_add_column (rtbl_t, const char*, unsigned int);
69 
70 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
71 rtbl_add_column_by_id (rtbl_t, unsigned int, const char*, unsigned int);
72 
73 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
74 rtbl_add_column_entryv_by_id (rtbl_t table, unsigned int id,
75 			      const char *fmt, ...)
76 	__attribute__ ((format (printf, 3, 0)));
77 
78 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
79 rtbl_add_column_entry (rtbl_t, const char*, const char*);
80 
81 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
82 rtbl_add_column_entryv (rtbl_t, const char*, const char*, ...)
83 	__attribute__ ((format (printf, 3, 0)));
84 
85 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
86 rtbl_add_column_entry_by_id (rtbl_t, unsigned int, const char*);
87 
88 ROKEN_LIB_FUNCTION rtbl_t ROKEN_LIB_CALL
89 rtbl_create (void);
90 
91 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
92 rtbl_destroy (rtbl_t);
93 
94 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
95 rtbl_format (rtbl_t, FILE*);
96 
97 ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL
98 rtbl_get_flags (rtbl_t);
99 
100 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
101 rtbl_new_row (rtbl_t);
102 
103 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
104 rtbl_set_column_affix_by_id (rtbl_t, unsigned int, const char*, const char*);
105 
106 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
107 rtbl_set_column_prefix (rtbl_t, const char*, const char*);
108 
109 ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL
110 rtbl_set_flags (rtbl_t, unsigned int);
111 
112 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
113 rtbl_set_prefix (rtbl_t, const char*);
114 
115 ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL
116 rtbl_set_separator (rtbl_t, const char*);
117 
118 #ifdef __cplusplus
119 }
120 #endif
121 
122 #endif /* __rtbl_h__ */
123