You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
817 B

#include "logic.h"
/*
Author: xerox
Date: 1/19/2020
creates logic given type, statement list to execute, and variable name for condition.
*/
static logic* create_logic(logic_type type, node_info* stmt_list, char* var_name)
{
if (!stmt_list || !var_name)
return NULL;
logic* new_logic = malloc(sizeof(logic));
new_logic->type = type;
new_logic->condition_var = var_name;
new_logic->stmt_list = stmt_list;
return new_logic;
}
/*
Author: xerox
Updated: 1/19/2020
create logic node (logical expression)
*/
static node_info* create_logic_node(logic* logic_expr)
{
if (!logic_expr)
return NULL;
node_info* new_node = malloc(sizeof(node_info));
new_node->operation = LOGIC_OPERATION;
new_node->logical_expr = logic_expr;
new_node->statement_list = NULL;
new_node->next = NULL;
return new_node;
}