* For simplicity and performance sake, this function can * only handle limited-length printf's. In should be NOT be used * for string concatenation like printf("xyz %s %s", s1, s2). * * Engine will call Print for "print" and "echo" */
| 582 | * Engine will call Print for "print" and "echo" |
| 583 | */ |
| 584 | void CPhPLibContext::Printf(const char *str, ...) |
| 585 | { |
| 586 | va_list args; |
| 587 | |
| 588 | va_start(args, str); |
| 589 | if ( !g_curr_context || !g_curr_context->m_curr_str_buffer ) { |
| 590 | vprintf(str, args); |
| 591 | } else { |
| 592 | char buf[4096]; |
| 593 | vsnprintf(buf, sizeof(buf), str, args); |
| 594 | g_curr_context->m_curr_str_buffer->Write(buf); |
| 595 | } |
| 596 | va_end(args); |
| 597 | } |
| 598 | |
| 599 | void CPhPLibContext::Print(const char *str) |
| 600 | { |