From 12129d46981106fa0d356cfd6000d6006942f0e4 Mon Sep 17 00:00:00 2001 From: Alice Frosi Date: Mon, 5 Jun 2023 14:06:33 +0200 Subject: cooker: add emit_end --- cooker/emit.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'cooker/emit.c') diff --git a/cooker/emit.c b/cooker/emit.c index e2b5461..625ff69 100644 --- a/cooker/emit.c +++ b/cooker/emit.c @@ -296,6 +296,22 @@ void emit_copy_field(struct gluten_ctx *g, struct field *field, field->size ? field->size : gluten_size[field->type]); } +/** + * emit_end() - Emit OP_END instruction: end of the operation block + * @g: gluten context + */ +void emit_end(struct gluten_ctx *g) +{ + struct op *op = (struct op *)gluten_ptr(&g->g, g->ip); + + op->type = OP_END; + + debug(" %i: OP_END", g->ip.offset); + + if (++g->ip.offset > INST_MAX) + die("Too many instructions"); +} + static struct gluten_offset emit_data_do(struct gluten_ctx *g, struct gluten_offset offset, enum type type, size_t str_len, -- cgit v1.2.3