From 159666bae6cc185a5abac154b85c49406f32f30c Mon Sep 17 00:00:00 2001 From: Nakidai Date: Sun, 23 Mar 2025 20:56:47 +0300 Subject: Last time I was here 8 months ago, idk what is this --- src/variable.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'src/variable.c') diff --git a/src/variable.c b/src/variable.c index 38ea2e3..b764c28 100644 --- a/src/variable.c +++ b/src/variable.c @@ -30,3 +30,29 @@ struct CCLVariable *ccl_variable_getany(struct CCL *ccl, struct CCLFrame *frame, return NULL; } + +struct CCLVariable *ccl_variable_set(struct CCLVariable *vars, char name, CCLNum value) +{ + struct CCLVariable *toset; + struct CCLVariable var = (struct CCLVariable) + { + .next = NULL, + .name = name, + .value = value, + }; + + if (vars->name == '_') + { + toset = vars; + var.prev = NULL; + } else + { + for (toset = vars; toset->next != NULL; toset = toset->next); + toset->next = (struct CCLVariable *)malloc(sizeof(*toset->next)); + var.prev = toset; + toset = toset->next; + } + + *toset = var; + return toset; +} -- cgit 1.4.1