| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifndef _PLY_H
- #define _PLY_H
- #include <stdio.h>
- struct node;
- struct symtab;
- struct ir;
- 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;
- struct ir *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_pre)(struct prog *);
- int (*ir_post)(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 */
|