Implemented floating point lowering to Calls into a soft float library.
[libfirm] / ir / libcore / lc_appendable.h
1 /*
2   libcore: library for basic data structures and algorithms.
3   Copyright (C) 2005  IPD Goos, Universit"at Karlsruhe, Germany
4
5   This library is free software; you can redistribute it and/or
6   modify it under the terms of the GNU Lesser General Public
7   License as published by the Free Software Foundation; either
8   version 2.1 of the License, or (at your option) any later version.
9
10   This library is distributed in the hope that it will be useful,
11   but WITHOUT ANY WARRANTY; without even the implied warranty of
12   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13   Lesser General Public License for more details.
14
15   You should have received a copy of the GNU Lesser General Public
16   License along with this library; if not, write to the Free Software
17   Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
18 */
19
20
21
22 /**
23  * Something to which can be appended.
24  * @author Sebastian Hack
25  * @date 3.1.2005
26  */
27
28 #ifndef _LIBCORE_APPENDABLE_H
29 #define _LIBCORE_APPENDABLE_H
30
31 #include <stddef.h>
32
33 struct lc_appendable_funcs_t;
34
35 typedef struct lc_appendable_t {
36         void *obj;
37         size_t written;
38         size_t limit;
39         const struct lc_appendable_funcs_t *app;
40 } lc_appendable_t;
41
42 typedef struct lc_appendable_funcs_t {
43         void (*init)(lc_appendable_t *obj);
44         void (*finish)(lc_appendable_t *obj);
45         int (*snadd)(lc_appendable_t *obj, const char *str, size_t len);
46         int (*chadd)(lc_appendable_t *obj, int ch);
47 } lc_appendable_funcs_t;
48
49 #define lc_appendable_snadd(obj,str,len) ((obj)->app->snadd(obj, str, len))
50 #define lc_appendable_chadd(obj,ch) ((obj)->app->chadd(obj, ch))
51 #define lc_appendable_finish(obj) ((obj)->app->finish(obj))
52
53 extern void lc_appendable_init(lc_appendable_t *app, const lc_appendable_funcs_t *funcs,
54                 void *obj, size_t limit);
55
56 extern int lc_appendable_snwadd(lc_appendable_t *app, const char *str,
57                 size_t len, unsigned int width, int left_just, char pad);
58
59 extern const lc_appendable_funcs_t *lc_appendable_file;
60 extern const lc_appendable_funcs_t *lc_appendable_string;
61 extern const lc_appendable_funcs_t *lc_appendable_obstack;
62
63 #endif