Example #1
0
	void ensure_tag_start_closed()
	{
	    if( !this->xml_document_started_ && options.start_document ) {
		start_document();
		this->xml_document_started_ = true;
	    }
	    if( this->in_start_tag_ ) {
		write_character('>');
		maybe_newline();        
		this->in_start_tag_ = false;
		++this->tag_nest_;
	    }
	    //I(in_start_tag_ == false);
	}
Example #2
0
	void end_tag(tstring const& name)
	{
		if( in_start_tag_ ) {
			write_bytes("/>");
			in_start_tag_ = false;
		} else {
			--tag_nest_;
			maybe_indent();
			write_bytes("</");
			write_bytes(name);
			write_character('>');
		}
		maybe_newline();
	}
void
ConsoleImpl::eval_command_line()
{
  if (!command_line.empty() && (history.empty() || history.back() != command_line))
    {
      history.push_back(command_line);
      history_position = history.size();
    }
                      
  console << ">" << command_line << std::endl;

  if (command_line == "quit" || command_line == "exit")
    {
      console.deactive();
    }
  else if (command_line == "help")
    {
      console << "This is a script console, can enter stuff in here that will then be evaluated.\n"
              << "Type 'quit' to exit the console." << std::endl;
    }
  else if (command_line == "reset")
    {
      GameSession::current()->set_sector("levels/newformat2.wst");
    }
  else if (command_line == "show")
    {
      HSQUIRRELVM v = script_manager->get_vm();

      int size = sq_getsize(v, -1);
      console << size << " elements on the root table" << std::endl;

      sq_pushroottable(v);

      //push your table/array here
      sq_pushnull(v);  //null iterator
      while(SQ_SUCCEEDED(sq_next(v,-2)))
        {
          //here -1 is the value and -2 is the key
          const SQChar *s;
          if (SQ_SUCCEEDED(sq_getstring(v,-2, &s)))
            {
              console << s << " -> " << squirrel2string(v, -1) << std::endl;
            }
          else
            {
              console << "Unknown key type for element" << std::endl;
            }
                              
          sq_pop(v,2); //pops key and val before the nex iteration
        }
                          
      sq_pop(v, 1);
    }
  else
    {
      execute(command_line);
      maybe_newline();
    }
  command_line = "";
  cursor_pos = 0;
}