scoped bindings

This commit is contained in:
Ellen Arvidsson 2025-06-24 16:31:23 +02:00
parent 396716de09
commit 858f5c3eed
17 changed files with 1185 additions and 821 deletions

View file

@ -80,6 +80,13 @@ struct spho_tp {
STAILQ_ENTRY(spho_tp) entries;
};
struct spho_tp_op {
struct spho_scope *sc;
struct spho_scope *op_sc;
struct spho_tp *op_tp;
};
STAILQ_HEAD(spho_tp_l, spho_tp);
struct spho_tp_ptr {
@ -90,18 +97,16 @@ struct spho_tp_ptr {
STAILQ_HEAD(spho_tp_ptr_l, spho_tp_ptr);
struct spho_tp_alloc {
struct spho_tp tp;
union {
struct spho_tp tp;
struct spho_tp_op tp_op;
} alloc;
TAILQ_ENTRY(spho_tp_alloc) allocs;
};
TAILQ_HEAD(spho_tp_alloc_l, spho_tp_alloc);
struct spho_tpop {
struct spho_scope *sc;
struct spho_tp *tp;
};
SLIST_HEAD(spho_scope_l, spho_scope);
/* defined in spho/bind.h */
@ -112,10 +117,12 @@ struct spho_scope {
struct spho_scope *parent;
struct spho_scope_l subs;
size_t n_noms;
struct spho_nom_l noms;
struct spho_tp_alloc_l tps;
struct spho_bind_scope *stat_bind;
struct spho_prebind *bind;
SLIST_ENTRY(spho_scope) next;
};
@ -138,8 +145,11 @@ int spho_scope_nom_lookup_str(struct spho_scope *, const char *, size_t,
int spho_scope_nom_lookup_str_strict(struct spho_scope *, const char *,
size_t, struct spho_nom **);
int spho_scope_tp_bind_init(struct spho_scope *);
int spho_scope_tp_bind_nom(struct spho_scope *, struct spho_nom *,
int spho_scope_prebind_init(struct spho_scope *);
int spho_scope_prebind_tp(struct spho_scope *, struct spho_nom *,
struct spho_tp *);
int spho_scope_prebind_tp_op(struct spho_scope *, struct spho_nom *,
struct spho_tp_op *);
int spho_scope_prebind_undef(struct spho_scope *, struct spho_nom *);
#endif /* _SPHO_SCOPE_H */