log-e-sappho/include/spho/bind.h

54 lines
1.1 KiB
C

#ifndef _SPHO_BIND_H
#define _SPHO_BIND_H
#include <sys/queue.h>
#include "spho/scope.h"
#define SPHO_BIND_KIND_TP 1
#define SPHO_BIND_KIND_TPOP 2
union spho_bound {
struct spho_tp *tp;
struct spho_tpop *op;
};
struct spho_binding {
struct spho_nom *nom;
int kind;
union spho_bound bound;
};
struct spho_bind_scope {
struct spho_scope *sc;
size_t cap_bds;
size_t n_bds;
struct spho_binding *bds;
};
struct spho_bind {
struct spho_ctx *ctx;
struct spho_bind_scope *binder;
struct spho_bind *parent;
};
struct spho_bind_scope *spho_bind_scope_create(struct spho_scope *);
int spho_bind_scope_add_tp(struct spho_bind_scope *, struct spho_nom *,
struct spho_tp *);
int spho_bind_scope_add_tpop(struct spho_bind_scope *, struct spho_nom *,
struct spho_tpop *);
void spho_bind_scope_destroy(struct spho_bind_scope *);
struct spho_bind *spho_bind_create(struct spho_ctx *, struct spho_bind_scope *,
struct spho_bind *);
int spho_bind_lkp(int, struct spho_bind *, struct spho_nom *,
union spho_bound **);
void spho_bind_destroy(struct spho_bind *);
#endif