parent
fec18fad07
commit
c9835bda97
Binary file not shown.
Binary file not shown.
@ -1,38 +1,27 @@
|
|||||||
#include "logic.h"
|
#include "logic.h"
|
||||||
|
|
||||||
/*
|
static plogic create_logic(const logic_type type, const pnode_info stmt_list, const char* var_name)
|
||||||
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)
|
if (!stmt_list || !var_name)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
logic* new_logic = malloc(sizeof(logic));
|
plogic new_logic = malloc(sizeof(logic));
|
||||||
new_logic->type = type;
|
new_logic->type = type;
|
||||||
new_logic->condition_var = var_name;
|
new_logic->condition_var = var_name;
|
||||||
new_logic->stmt_list = stmt_list;
|
new_logic->stmt_list = stmt_list;
|
||||||
return new_logic;
|
return new_logic;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
static pnode_info create_logic_node(const plogic logic_expr)
|
||||||
Author: xerox
|
|
||||||
Updated: 1/19/2020
|
|
||||||
|
|
||||||
create logic node (logical expression)
|
|
||||||
*/
|
|
||||||
static node_info* create_logic_node(logic* logic_expr)
|
|
||||||
{
|
{
|
||||||
if (!logic_expr)
|
if (!logic_expr)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
node_info* new_node = malloc(sizeof(node_info));
|
const pnode_info new_node = malloc(sizeof(node_info));
|
||||||
new_node->operation = LOGIC_OPERATION;
|
new_node->operation = LOGIC_OPERATION;
|
||||||
new_node->logical_expr = logic_expr;
|
new_node->logical_expr = logic_expr;
|
||||||
new_node->statement_list = NULL;
|
new_node->statement_list = NULL;
|
||||||
new_node->next = NULL;
|
new_node->next = NULL;
|
||||||
|
new_node->scope_map = _var_map;
|
||||||
return new_node;
|
return new_node;
|
||||||
}
|
}
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef LOGIC_H
|
#ifndef LOGIC_H
|
||||||
#define LOGIC_H
|
#define LOGIC_H
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
logic* create_logic(logic_type type, node_info* stmt_list, char* var_name);
|
plogic create_logic(const logic_type type, const pnode_info stmt_list, const char* var_name);
|
||||||
node_info* create_logic_node(logic* logic_expr);
|
pnode_info create_logic_node(const plogic logic_expr);
|
||||||
#endif
|
#endif
|
@ -1,6 +1,6 @@
|
|||||||
#ifndef PRINT_H
|
#ifndef PRINT_H
|
||||||
#define PRINT_H
|
#define PRINT_H
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
node_info* create_print_statement(variable_type operation, void* value);
|
pnode_info create_print_statement(const variable_type operation, const void* value);
|
||||||
node_info* create_print_variable(char* var_name);
|
pnode_info create_print_variable(const char* var_name);
|
||||||
#endif
|
#endif
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef VARS_H
|
#ifndef VARS_H
|
||||||
#define VARS_H
|
#define VARS_H
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
void add_var(char* name, variable_values* values, map_void_t* p_var_map);
|
void add_var(const char* name, const pvariable_values values, map_void_t* p_var_map);
|
||||||
variable* make_variable(char* p_name, void* value, variable_type var_type);
|
pvariable make_variable(char* p_name, void* value, variable_type var_type);
|
||||||
variable_values* get_value(char* p_name, map_void_t* p_var_map);
|
pvariable_values get_value(const char* p_name, map_void_t* p_var_map);
|
||||||
void* alloc_value(void* value, variable_type var_type);
|
void* alloc_value(const void* value, const variable_type var_type);
|
||||||
node_info* create_variable(char* p_name, void* value, variable_type var_type);
|
pnode_info create_variable(const char* p_name, const void* value, variable_type var_type);
|
||||||
node_info* move_value(char* to, char* from);
|
pnode_info move_value(const char* to, const char* from);
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
Reference in new issue