diff --git a/version0.1/nasal_var_stack.h b/version0.1/nasal_var_stack.h deleted file mode 100644 index 6ea83b0..0000000 --- a/version0.1/nasal_var_stack.h +++ /dev/null @@ -1,121 +0,0 @@ -#ifndef __NASAL_VAR_STACK_H__ -#define __NASAL_VAR_STACK_H__ - -#include "nasal_list.h" -#include "nasal_print.h" - - -namespace nasal -{ - -struct var_stack_unit -{ - std::string var_name; - var var_detail; - var_stack_unit *next; -}; - -class var_stack -{ - private: - var_stack_unit *head; - public: - var_stack() - { - head=new var_stack_unit; - head->var_name="null"; - head->next=NULL; - } - ~var_stack() - { - var_stack_unit *temp=head; - var_stack_unit *this_node=NULL; - if(head->next) - { - while(temp->next) - { - this_node=temp; - temp=temp->next; - delete this_node; - } - delete temp; - } - else - delete head; - } - void append_var(std::string &varia_name,var &temp_var) - { - var_stack_unit *temp=head; - while(temp->next) - temp=temp->next; - temp->next=new var_stack_unit; - temp=temp->next; - temp->var_name=varia_name; - temp->var_detail=temp_var; - temp->next=NULL; - } - void print_var() - { - var_stack_unit *temp=head; - while(temp->next) - { - temp=temp->next; - std::cout<<"["<var_detail.Type<<"]: "<var_name<<" : "; - if(temp->var_detail.Type!="string") - PrintVar(temp->var_detail); - else - std::cout<<*((std::string *)temp->var_detail.data); - std::cout<next) - { - temp=temp->next; - if(temp->var_name==varia_name) - temp_var=temp->var_detail; - } - return temp_var; - } - void pop_var() - { - var_stack_unit *temp=head; - var_stack_unit *end_temp; - if(!head->next) - return; - while(temp->next) - { - end_temp=temp; - temp=temp->next; - } - end_temp->next=NULL; - delete temp; - } - void delete_all() - { - var_stack_unit *temp=head->next; - var_stack_unit *this_node=NULL; - head->next=NULL; - if(!temp) - return; - while(temp->next) - { - this_node=temp; - temp=temp->next; - delete this_node; - } - delete temp; - return; - } -}; - -} - -#endif