Root/b2/chr.h

1/*
2 * chr.h - Part characteristics
3 *
4 * Copyright 2012 by Werner Almesberger
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12
13#ifndef CHR_H
14#define CHR_H
15
16#include <stdio.h>
17
18#include "param.h"
19
20
21struct field;
22
23struct action {
24    struct field *fields;
25    struct field *rules;
26};
27
28struct condition {
29    struct value value;
30    enum relop relop;
31    struct condition *next;
32};
33
34struct selector {
35    struct condition *cond;
36    struct action act;
37    struct selector *next;
38};
39
40struct field {
41    const char *name;
42    const struct format *fmt;
43    struct selector *sel;
44    struct action any;
45    struct field *next;
46    const struct field *prev;
47};
48
49
50const struct format *field_find(const char *name, const struct field *tail);
51struct field *new_field(const char *name, const struct format *fmt,
52    const struct field *prev);
53struct selector *new_selector(void);
54struct condition *new_condition(enum relop relop, const char *word);
55void field_finalize(struct field *field);
56void fields_dump(FILE *file, const struct field *field);
57void rules_dump(FILE *file, const struct field *field);
58
59#endif /* !CHR_H */
60

Archive Download this file

Branches:
master



interactive