view src/ploki/run.h @ 8203:b0fcb29e2ce7

<b_jonas> learn Silent initial consonants in English are: write, wrong, wrist, wrap, wreck, wrest, wrestle, wriggle, wrinkle, wrath, wraith, wreath, wrangle, wren, wright, wrought, wring, writ, writhe, wry; know, knife, knock, knee, knight, knob, knot, knit, knack, knout, knuckle; psychology, psalm, pseudo, psychic, psionics; gnaw, gnash, gnome, gnu, gnat; pneumatic; mnemonic; chthonic; phthisis; bdellium.
author HackBot
date Sun, 29 May 2016 20:52:46 +0000
parents ac0403686959
children
line wrap: on
line source

#ifndef RUN_H_
#define RUN_H_

#include "config.h"
#include "op.h"
#include "text.h"
#include "val.h"
#include "stack.h"

#include <stddef.h>

struct val *execute(const struct op *, struct val *);
ATTR_NORETURN
void run(const struct text *, size_t, char **);

struct Interp {
	struct val arg;
	struct val result;

	struct {
		struct val *argv;
		size_t argc;
	} a;
	struct {
		struct val *matches;
		size_t length, size;
	} match;
	struct {
		size_t *index;
		size_t size;
	} m_start;
	struct {
		size_t *index;
		size_t size;
	} m_end;
};
extern struct Interp Interp;

typedef struct {
	struct val *target;
	struct val content;
} save_pair;

stack_declare(save_pair, extern)
extern stack(save_pair) Saved;

void stack_store(struct val *, const struct val *);
size_t depth_get(void);
void depth_restore(size_t);

#endif /* RUN_H_ */