| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #ifndef _PLY_H
- #define _PLY_H
- #include <stdio.h>
- struct node;
- struct symtab;
- struct prog {
- const char *probe;
- struct node *ast;
- struct symtab *locals;
- struct symtab *globals;
- /* symtab_t *locals; */
- /* symtab_t *globals; */
- struct provider *provider;
- void *provider_data;
- /* ir_t *ir; */
- };
- struct ctx {
- struct prog **progs;
- struct symtab *globals;
- };
- struct func;
- struct provider {
- const char *name;
- int (*probe)(struct prog *);
- int (*sym_alloc)(struct prog *, struct node *);
- /* int (*resolve)(struct prog *, struct node *); */
- /* int (*rewrite_node)(struct prog *, struct node *); */
- /* int (*ir_prologue)(struct prog *); */
- /* int (*ir_epilogue)(struct prog *); */
- };
- void provider_register(struct provider *p);
- /* utils */
- void ast_fprint(FILE *fp, struct node *root);
- #include "printxf.h"
- #define _d(fmt, ...) fprintxf(NULL, stderr, fmt, ##__VA_ARGS__)
- #define _i(fmt, ...) fprintxf(NULL, stderr, fmt, ##__VA_ARGS__)
- #define _w(fmt, ...) fprintxf(NULL, stderr, fmt, ##__VA_ARGS__)
- #define _e(fmt, ...) fprintxf(NULL, stderr, fmt, ##__VA_ARGS__)
- #endif /* _PLY_H */
|