Merge Fix: Spills have ProjMs now
[libfirm] / ir / libcore / lc_opts_t.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 #ifndef _OPTS_T_H
23 #define _OPTS_T_H
24
25 #include <stdlib.h>
26
27 #include "lc_opts.h"
28 #include "list.h"
29
30 #include "lc_defines.h"
31
32 typedef struct {
33         struct list_head opts;
34         struct list_head grps;
35 } lc_grp_special_t;
36
37 typedef struct {
38         lc_opt_type_t type;
39         lc_opt_callback_t *cb;
40         lc_opt_dump_t *dump;
41         lc_opt_dump_vals_t *dump_vals;
42         void *value;
43         size_t length;
44         unsigned is_set : 1;
45 } lc_opt_special_t;
46
47 struct lc_opt_entry_t {
48         unsigned hash;
49         const char *name;
50         const char *desc;
51         struct lc_opt_entry_t *parent;
52
53         unsigned is_grp : 1;
54
55         struct list_head list;
56
57         union {
58                 lc_grp_special_t grp;
59                 lc_opt_special_t opt;
60         } v;
61 };
62
63 #define lc_get_opt_special(ent) (&(ent)->v.opt)
64 #define lc_get_grp_special(ent) (&(ent)->v.grp)
65
66 int lc_opt_raise_error(const lc_opt_err_info_t *err,
67                                            lc_opt_error_handler_t *handler,
68                                            const char *fmt, ...);
69
70 #endif