1
0
mirror of git://projects.qi-hardware.com/eda-tools.git synced 2025-04-21 12:27:27 +03:00

b2/: first tentative version of hierarchy parser, with example

This commit is contained in:
Werner Almesberger
2012-04-25 17:14:39 -03:00
parent 7fe553a4fc
commit 6bb8b03ef8
11 changed files with 512 additions and 88 deletions

View File

@@ -13,15 +13,46 @@
#ifndef CHR_H
#define CHR_H
#include <stdio.h>
#include "param.h"
void field_add(const char *name, const struct format *fmt);
const struct format *field_find(const char *name);
void field_mark(void);
void field_release(void);
void field_add_selector(enum relop relop, const char *word);
void field_more_selectors(void);
void field_add_wildcard(void);
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);
struct field *field_new(const char *name, const struct format *fmt,
const struct field *prev);
struct selector *field_selector(void);
struct condition *field_condition(enum relop relop, const char *word);
void field_finalize(struct field *field);
void field_dump(FILE *file, const struct field *field);
#endif /* !CHR_H */