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.

40 lines
1.2 KiB

#ifndef PRINT_C
#define PRINT_C
#include "print.h"
static pnode_info create_print_statement(const variable_type operation, const void* value)
{
if (!value)
return NULL;
const pnode_info new_print_stmt = (pnode_info)malloc(sizeof(node_info));
const pprint new_print = malloc(sizeof(print));
new_print_stmt->operation = PRINT_OPERATION;
new_print_stmt->operation_type.print = PRINT_CONSTANT;
new_print->type = operation;
new_print->value = value;
new_print_stmt->print_expr = new_print;
new_print_stmt->statement_list = NULL;
new_print_stmt->next = NULL;
new_print_stmt->scope_map = _var_map;
return new_print_stmt;
}
static pnode_info create_print_variable(const char* var_name)
{
if (!var_name)
return NULL;
const pnode_info new_print_stmt = malloc(sizeof(node_info));
new_print_stmt->var = malloc(sizeof(variable));
new_print_stmt->operation = PRINT_OPERATION;
new_print_stmt->operation_type.print = PRINT_VARIABLE;
new_print_stmt->var->name = var_name;
new_print_stmt->statement_list = NULL;
new_print_stmt->next = NULL;
new_print_stmt->scope_map = _var_map;
return new_print_stmt;
}
#endif