diff --git a/version0.1/nasal_func_stack.h b/version0.1/nasal_func_stack.h deleted file mode 100644 index a48d2a8..0000000 --- a/version0.1/nasal_func_stack.h +++ /dev/null @@ -1,124 +0,0 @@ -#ifndef __NASAL_FUNC_STACK_H__ -#define __NASAL_FUNC_STACK_H__ - -#include "nasal_func.h" - - -namespace nasal -{ - -struct func_stack_unit -{ - std::string func_name; - func func_statement; - func_stack_unit *next; -}; - -class func_stack -{ - private: - func_stack_unit *head; - public: - func_stack() - { - head=new func_stack_unit; - head->func_name="null"; - head->next=NULL; - } - ~func_stack() - { - func_stack_unit *temp=head; - func_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_function(std::string &function_name,func &temp_func) - { - func_stack_unit *temp=head; - while(temp->next) - { - temp=temp->next; - if(temp->func_name==function_name) - { - std::cout<<"[Error] Redeclaration of function \""<next=new func_stack_unit; - temp=temp->next; - temp->next=NULL; - temp->func_statement=temp_func; - return; - } - void run_function(std::string &function_name) - { - func_stack_unit *temp=head; - while(temp->next) - { - temp=temp->next; - if(temp->func_name==function_name) - { - temp->func_statement.run(); - return; - } - } - std::cout<<"[Error] Could not find this function."<next) - { - temp=temp->next; - std::cout<<"function: "<func_name<func_name<next) - return; - while(temp->next) - { - end_temp=temp; - temp=temp->next; - } - end_temp->next=NULL; - delete temp; - } - void delete_all() - { - func_stack_unit *temp=head->next; - func_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