beloopana: Remove duplicate comments.
[libfirm] / ir / libcore / lc_opts_t.h
1 /*
2  * This file is part of libFirm.
3  * Copyright (C) 2012 IPD Goos, Universit"at Karlsruhe, Germany
4  */
5
6
7
8 #ifndef _OPTS_T_H
9 #define _OPTS_T_H
10
11 #include <stdlib.h>
12
13 #include "lc_opts.h"
14 #include "list.h"
15
16 typedef struct {
17         struct list_head opts;
18         struct list_head grps;
19 } lc_grp_special_t;
20
21 typedef struct {
22         lc_opt_type_t type;
23         lc_opt_callback_t *cb;
24         lc_opt_dump_t *dump;
25         lc_opt_dump_vals_t *dump_vals;
26         void *value;
27         size_t length;
28         unsigned is_set : 1;
29 } lc_opt_special_t;
30
31 struct lc_opt_entry_t {
32         unsigned hash;
33         const char *name;
34         const char *desc;
35         struct lc_opt_entry_t *parent;
36
37         unsigned is_grp : 1;
38
39         struct list_head list;
40
41         union {
42                 lc_grp_special_t grp;
43                 lc_opt_special_t opt;
44         } v;
45 };
46
47 #define lc_get_opt_special(ent) (&(ent)->v.opt)
48 #define lc_get_grp_special(ent) (&(ent)->v.grp)
49
50 int lc_opt_raise_error(const lc_opt_err_info_t *err,
51                                            lc_opt_error_handler_t *handler,
52                                            const char *fmt, ...);
53
54 #endif