void SIC_Print(EscEscape& e) { if(e[0].IsArray()) VppLog() << (String) e[0]; else if(e[0].IsNumber()) VppLog() << e[0].GetNumber(); else if(!e[0].IsVoid()) e.ThrowError("invalid argument to 'print'"); }
SVal SIC_Print(Sic& sic, Vector<Sic::SRVal>& arg) { if(arg[0]->IsString()) VppLog() << arg[0]->GetString(); else if(arg[0]->IsNumber()) VppLog() << arg[0]->GetNumber(); else if(!arg[0]->IsVoid()) sic.ThrowError("invalid argument to 'print'"); return Null; }
NAMESPACE_UPP #define LTIMING(x) // TIMING(x) void __LOGF__(const char *fmt, ...) { char buffer[1024]; va_list argptr; va_start(argptr, fmt); vsprintf(buffer, fmt, argptr); va_end(argptr); VppLog().Put(buffer); }
void LogCtrl::Log(bool b) { if(ps == this) return; if(b) { ps = &VppLog(); SetVppLog(*this); } else if(ps) { SetVppLog(*ps); ps = NULL; } }
LRESULT CALLBACK Ctrl::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { GuiLock __; if(sFinished) return DefWindowProc(hWnd, message, wParam, lParam); #ifdef PLATFORM_WINCE if(message == WM_CREATE) #else if(message == WM_NCCREATE) #endif { Ctrl *w = (Ctrl *)((LPCREATESTRUCT) lParam)->lpCreateParams; if(w) { w->NcCreate(hWnd); int i = Windows().Find(NULL); if(i >= 0) { Windows().SetKey(i, hWnd); Windows()[i] = w; } else Windows().Add(hWnd) = w; } } Ctrl *w = Windows().Get(hWnd, NULL); #ifdef PLATFORM_WINCE if(message == WM_DESTROY) #else if(message == WM_NCDESTROY) #endif { if(w) w->NcDestroy(); int i = Windows().Find(hWnd); if(i >= 0) Windows().SetKey(i, NULL); } #if LOGMESSAGES bool logblk = false; if(message != WM_SETCURSOR && message != WM_CTLCOLORBTN && message != WM_TIMER && #ifndef PLATFORM_WINCE message != WM_NCHITTEST && message != WM_ENTERIDLE && #endif message != WM_CTLCOLORDLG && message != WM_CTLCOLOREDIT && message != WM_CTLCOLORLISTBOX && message != WM_CTLCOLORMSGBOX && message != WM_CTLCOLORSCROLLBAR && message != WM_CTLCOLORSTATIC && message != WM_CANCELMODE && message != 0x0118) for(WinMsg *m = sWinMsg; m->ID; m++) if(m->ID == message) { RLOG(m->name << ' ' << UPP::Name(w) << Sprintf(", wParam = %d (0x%x), lParam = %d (0x%x)", wParam, wParam, lParam, lParam)); VppLog() << LOG_BEGIN; logblk = true; break; } #endif LRESULT l = 0; if(w) { #if defined(_DEBUG) && LOGTIMING int ticks = msecs(); String wname = w->Name(); #endif Ptr<Ctrl> pw = w; l = w->WindowProc(message, wParam, lParam); if(pw) pw->SyncMoves(); #if defined(_DEBUG) && LOGTIMING String msgname; for(WinMsg *m = sWinMsg; m->ID; m++) if(m->ID == message) { msgname = m->name; break; } if(IsNull(msgname)) msgname = NFormat("0x%04x", (int)message); LLOG(NFormat("T+%d %s 0x%08x 0x%08x -> %s", msecs(ticks), msgname, (int)wParam, (int)lParam, wname)); #endif } else l = DefWindowProc(hWnd, message, wParam, lParam); #if LOGMESSAGES if(logblk) VppLog() << LOG_END; #endif return l; }
void HeapPanic(const char *text, void *pos, int size) { RLOG("\n\n" << text << "\n"); HexDump(VppLog(), pos, size, 64); Panic(text); }