OSDN Git Service

console/console_monitor.hpp: update_stackframe(), operator << ()
authorMyun2 <myun2@nwhite.info>
Sat, 8 Jan 2011 18:51:14 +0000 (03:51 +0900)
committerMyun2 <myun2@nwhite.info>
Sat, 8 Jan 2011 18:51:14 +0000 (03:51 +0900)
roast/include/roast/console/console_monitor.hpp

index 6dc078e..bbee5c0 100644 (file)
@@ -7,11 +7,26 @@
 #define __SFJP_ROAST__debug__console_monitor_HPP__
 
 #include "roast/console/console.hpp"
+#include <string>
+#include <stack>
+#include <list>
 
 namespace roast
 {
+       namespace debug
+       {
+               struct into{
+                       ::std::string name;
+               };
+
+               struct out{};
+       }
+
        class debug_console_monitor
        {
+       private:
+               ::std::stack<::std::string> m_stack;
+               typedef ::std::stack<::std::string>::iterator _StackIterator;
        public:
                debug_console_monitor()
                {
@@ -19,15 +34,32 @@ namespace roast
 
                        set_cursol(0,0);
                        repeat_to_screen_max('*',2);
-                       printf("\n*");
+               //      printf("\n*");
                        printf("\n*     Roast+ lexical Debugging Monitor\n");
-                       printf("*\n");
+               //      printf("*\n");
                        repeat_to_screen_max('*',2);
 
                        set_cursol(0,console::screen_height - 4);
                        repeat_to_screen_max('-');
                        printf("> ");
                }
+
+               void update_stackframe()
+               {
+                       using namespace console;
+                       set_cursol(0,3);
+                       //for(size_t i=0; i<m_stack.size(); i++)
+                       for(_StackIterator it=m_stack.begin(); it != m_stack.end(); it++)
+                       {
+                               printf("%s\n", it->c_str());
+                       }
+               }
+
+               void operator << (const debug::into& in)
+               {
+                       m_stack.push(in);
+                       update_stackframe();
+               }
        };
 }