1/* $NetBSD$ */ 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 55extern "C" { 56#endif 57 58struct rtbl_data; 59typedef 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 67ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 68rtbl_add_column (rtbl_t, const char*, unsigned int); 69 70ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 71rtbl_add_column_by_id (rtbl_t, unsigned int, const char*, unsigned int); 72 73ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 74rtbl_add_column_entryv_by_id (rtbl_t table, unsigned int id, 75 const char *fmt, ...) 76 __attribute__ ((format (printf, 3, 0))); 77 78ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 79rtbl_add_column_entry (rtbl_t, const char*, const char*); 80 81ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 82rtbl_add_column_entryv (rtbl_t, const char*, const char*, ...) 83 __attribute__ ((format (printf, 3, 0))); 84 85ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 86rtbl_add_column_entry_by_id (rtbl_t, unsigned int, const char*); 87 88ROKEN_LIB_FUNCTION rtbl_t ROKEN_LIB_CALL 89rtbl_create (void); 90 91ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 92rtbl_destroy (rtbl_t); 93 94ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 95rtbl_format (rtbl_t, FILE*); 96 97ROKEN_LIB_FUNCTION unsigned int ROKEN_LIB_CALL 98rtbl_get_flags (rtbl_t); 99 100ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 101rtbl_new_row (rtbl_t); 102 103ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 104rtbl_set_column_affix_by_id (rtbl_t, unsigned int, const char*, const char*); 105 106ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 107rtbl_set_column_prefix (rtbl_t, const char*, const char*); 108 109ROKEN_LIB_FUNCTION void ROKEN_LIB_CALL 110rtbl_set_flags (rtbl_t, unsigned int); 111 112ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 113rtbl_set_prefix (rtbl_t, const char*); 114 115ROKEN_LIB_FUNCTION int ROKEN_LIB_CALL 116rtbl_set_separator (rtbl_t, const char*); 117 118#ifdef __cplusplus 119} 120#endif 121 122#endif /* __rtbl_h__ */ 123