void ThreadStackTrace::dump_stack_at_safepoint(int maxDepth) { assert(SafepointSynchronize::is_at_safepoint(), "all threads are stopped"); if (_thread->has_last_Java_frame()) { RegisterMap reg_map(_thread); vframe* start_vf = _thread->last_java_vframe(®_map); int count = 0; for (vframe* f = start_vf; f; f = f->sender() ) { if (f->is_java_frame()) { javaVFrame* jvf = javaVFrame::cast(f); add_stack_frame(jvf); count++; } else { // Ignore non-Java frames } if (maxDepth > 0 && count == maxDepth) { // Skip frames if more than maxDepth break; } } } if (_with_locked_monitors) { // Iterate inflated monitors and find monitors locked by this thread // not found in the stack InflatedMonitorsClosure imc(_thread, this); ObjectSynchronizer::monitors_iterate(&imc); } }
void main(){ float x,y,calc; printf("Entre com sua altura em metros: \n"); scanf("%f",&x); printf("Entre com seu peso em kg: \n"); scanf("%f",&y); calc = imc(x,y); if (calc<=18.5){ printf("Abaixo do Peso! [%f] \n",calc); } else if (calc<=24.9) { printf("Saudavel! [%f] \n",calc); } else if (calc<=29.9){ printf("Peso em excesso! [%f] \n",calc); } else if (calc<=34.9){ printf("Obesidade Grau I! [%f] \n",calc); } else if (calc<=39.9){ printf("Obesidade Grau II (Severa)! [%f] \n",calc); } else { printf("Obesidade Grau III (Morbida)! [%f] \n",calc); } }
int main() { int n; double p, a; scanf("%d", &n); for (int i = 0; i < n; i++) { scanf("%lf %lf", &a, &p); printf("%.2f\n", imc(a, p)); } }
void StatusWnd::updateIcons(HIMC hIMC) { if ( g_isWinLogon ) return; IMCLock imc(hIMC); bool isChinese; // if( g_enableShift ) isChinese = imc.isChinese(); // else // isChinese = !LOBYTE(GetKeyState(VK_CAPITAL)); this->setBtnImage( 0, isChinese ? iconChi : iconEng ); this->setBtnImage( 1, imc.isFullShape() ? iconFull : iconHalf ); }
bool StatusWnd::create(HWND imeUIWnd) { HIMC hIMC = (HIMC)GetWindowLong( imeUIWnd, IMMGWL_IMC ); if ( g_isWinLogon ) return false; IMCLock imc(hIMC); hwnd = CreateWindowEx(0, g_statusWndClass, NULL, WS_POPUP|WS_CLIPCHILDREN, 0, 0, 0, 0, imeUIWnd, NULL, g_dllInst, NULL); if( !hwnd ) return false; TCHAR bmppath[MAX_PATH]; GetSystemDirectory( bmppath, MAX_PATH ); _tcscat( bmppath, _T("\\IME\\Chewing\\statuswnd.bmp") ); HBITMAP tbbmp = (HBITMAP)LoadImage( NULL, bmppath, IMAGE_BITMAP, 0, 0, LR_DEFAULTCOLOR|LR_LOADFROMFILE); this->setTheme(tbbmp); iconChi = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_CHI), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); iconEng = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_ENG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); iconFull = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_FULL), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); iconHalf = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_HALF), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); iconConfig = (HICON)LoadImage( g_dllInst, LPCTSTR (IDI_CONFIG), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ); TCHAR tip[128]; LoadString(g_dllInst, ID_CHI_ENG, tip, sizeof(tip) ); addBtn( ID_CHI_ENG, imc.isChinese() ? iconChi : iconEng, tip ); LoadString(g_dllInst, ID_FULL_HALF, tip, sizeof(tip) ); addBtn( ID_FULL_HALF, imc.isFullShape() ? iconFull : iconHalf, tip ); // This should be disabled in WinLogon for security reason. if( ! g_isWinLogon ) { LoadString(g_dllInst, ID_MENU, tip, sizeof(tip) ); addBtn( ID_MENU, iconConfig, tip ); } IMEUILock ui(GetParent(hwnd)); setTooltip( &ui.getIMEUI()->tooltip ); setCmdTarget(hwnd); int w, h; XPToolbar::getSize(&w, &h); SetWindowPos( hwnd, NULL, 0, 0, w, h, SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER ); return true; }
LRESULT StatusWnd::wndProc(UINT msg, WPARAM wp, LPARAM lp) { if ( g_isWinLogon ) return 0; HIMC hIMC = getIMC(hwnd); IMCLock imc( hIMC ); switch (msg) { case WM_PAINT: { PAINTSTRUCT ps; BeginPaint( hwnd, &ps ); XPToolbar::onPaint(ps); EndPaint(hwnd, &ps); break; } case WM_COMMAND: onCommand( LOWORD(wp), hIMC ); break; /* case WM_NOTIFY: { switch( ((NMHDR*)lp)->code ) { case TTN_GETDISPINFO: { LPTOOLTIPTEXT pttt; pttt = (LPTOOLTIPTEXT)lp; pttt->hinst = g_dllInst; pttt->lpszText = MAKEINTRESOURCE(pttt->hdr.idFrom); break; } } } break; */ case WM_LBUTTONDOWN: if( !XPToolbar::onLButtonDown(wp, lp) ) { dragging = true; IMEChildWnd::onLButtonDown(wp, lp); } break; case WM_MOUSEMOVE: if( dragging || !XPToolbar::onMouseMove(wp, lp) ) IMEChildWnd::onMouseMove(wp, lp); break; case WM_LBUTTONUP: if( dragging || !XPToolbar::onLButtonUp(wp, lp) ) { dragging = false; IMEChildWnd::onLButtonUp(wp, lp); } break; case WM_MOUSEACTIVATE: return MA_NOACTIVATE; case WM_SHOWWINDOW: if( ! wp ) { RECT rc; GetWindowRect( hwnd, &rc ); INPUTCONTEXT* ic = imc.getIC(); if( ic ) { ic->ptStatusWndPos.x = rc.left; ic->ptStatusWndPos.y = rc.top; } } break; case WM_DESTROY: { RECT rc; GetWindowRect( hwnd, &rc ); INPUTCONTEXT* ic = imc.getIC(); if( ic ) { ic->ptStatusWndPos.x = rc.left; ic->ptStatusWndPos.y = rc.top; } // DeleteObject(tbbmp); } break; case WM_CAPTURECHANGED: onCaptureChanged(lp); break; default: return DefWindowProc(hwnd, msg, wp, lp); } return 0; }