MCPcopy Create free account
hub / github.com/defold/defold / Printf

Method Printf

engine/dlib/src/dlib/pprint.cpp:36–61  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 }
35
36 void Printer::Printf(const char* format, ...)
37 {
38 va_list argp;
39 va_start(argp, format);
40
41 if (m_StartLine) {
42 int n = dmMath::Min(m_Indent, m_BufferSize - m_Cursor - 1);
43 for (int i = 0; i < n; ++i) {
44 m_Buffer[i + m_Cursor] = ' ';
45 }
46 m_Cursor += n;
47 m_StartLine = false;
48 }
49
50 int c = m_BufferSize - m_Cursor;
51 vsnprintf(m_Buffer + m_Cursor, c, format, argp);
52
53 m_Buffer[m_BufferSize-1] = '\0';
54 m_Cursor = strlen(m_Buffer);
55
56 if (strchr(format, '\n')) {
57 m_StartLine = true;
58 }
59 va_end(argp);
60 assert(m_Cursor <= m_BufferSize);
61 }
62
63 void Printer::SetIndent(int indent)
64 {

Callers 3

DoLuaPPrintTableFunction · 0.80
LuaPPrintFunction · 0.80
TESTFunction · 0.80

Calls 2

MinFunction · 0.85
assertFunction · 0.50

Tested by 1

TESTFunction · 0.64