2012-03-18 18:24:12 +02:00
|
|
|
/*
|
|
|
|
* chr.h - Part characteristics
|
|
|
|
*
|
|
|
|
* Copyright 2012 by Werner Almesberger
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef CHR_H
|
|
|
|
#define CHR_H
|
|
|
|
|
2012-04-25 23:14:39 +03:00
|
|
|
#include <stdio.h>
|
|
|
|
|
2012-03-18 18:24:12 +02:00
|
|
|
#include "param.h"
|
|
|
|
|
|
|
|
|
2012-04-25 23:14:39 +03:00
|
|
|
struct field;
|
|
|
|
|
|
|
|
struct action {
|
|
|
|
struct field *fields;
|
|
|
|
struct field *rules;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct condition {
|
|
|
|
struct value value;
|
|
|
|
enum relop relop;
|
|
|
|
struct condition *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct selector {
|
|
|
|
struct condition *cond;
|
|
|
|
struct action act;
|
|
|
|
struct selector *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct field {
|
|
|
|
const char *name;
|
|
|
|
const struct format *fmt;
|
|
|
|
struct selector *sel;
|
|
|
|
struct action any;
|
|
|
|
struct field *next;
|
|
|
|
const struct field *prev;
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
const struct format *field_find(const char *name, const struct field *tail);
|
2012-04-26 08:48:08 +03:00
|
|
|
struct field *new_field(const char *name, const struct format *fmt,
|
2012-04-25 23:14:39 +03:00
|
|
|
const struct field *prev);
|
2012-04-26 08:48:08 +03:00
|
|
|
struct selector *new_selector(void);
|
|
|
|
struct condition *new_condition(enum relop relop, const char *word);
|
2012-04-25 23:14:39 +03:00
|
|
|
void field_finalize(struct field *field);
|
2012-05-30 17:53:58 +03:00
|
|
|
void fields_dump(FILE *file, const struct field *field);
|
|
|
|
void rules_dump(FILE *file, const struct field *field);
|
2012-03-18 18:24:12 +02:00
|
|
|
|
|
|
|
#endif /* !CHR_H */
|