//---------------------------------------------- void PrintXYZ( HWND hDlgWnd, int iDistortion, tdXYZ * ptXYZ, int iID_X, int iID_Y, int iID_Z ){ // Print coordinates if(iDistortion < DIST_LEVEL_MAX ){ PrintCoord(hDlgWnd, ptXYZ->X, iID_X); PrintCoord(hDlgWnd, ptXYZ->Y, iID_Y); PrintCoord(hDlgWnd, ptXYZ->Z, iID_Z); } else{ SetWindowText(GetDlgItem(hDlgWnd, iID_X), "N/A"); SetWindowText(GetDlgItem(hDlgWnd, iID_Y ), "N/A"); SetWindowText(GetDlgItem(hDlgWnd, iID_Z ), "N/A"); } }
PRIVATE inline void PrintFdcl(GBUF *out, Node *node, fdclNode *u, int offset, UNUSED(Bool norecurse)) { gbprintf(out, "Fdcl:"); PrintCoord(out, &node->coord); gbprintf(out, " "); PrintTQ(out, u->tq, offset, norecurse); PrintCRSpaces(out, offset + 2); gbputs("List: Args: ", out); PrintCRSpaces(out, offset + 4); PrintList(out, u->args, offset + 4); PrintCRSpaces(out, offset + 2); gbputs("Returns: ", out); PrintCRSpaces(out, offset + 4); PrintNode(out, u->returns, offset + 4); }
PRIVATE inline void PrintCast(GBUF *out, UNUSED(Node *node), castNode *u, int offset, UNUSED(Bool norecurse)) { gbputs("Cast: ", out); PrintCoord(out, &node->coord); if (u->value) { PrintCRSpaces(out, offset + 2); gbputs("Value: ", out); PrintCRSpaces(out, offset + 4); PrintNode(out, u->value, offset + 4); } PrintCRSpaces(out, offset + 2); PrintNode(out, u->type, offset + 2); PrintCRSpaces(out, offset + 2); PrintNode(out, u->expr, offset + 2); }
PRIVATE inline void PrintId(GBUF *out, Node *node, idNode *u, int offset, UNUSED(Bool norecurse)) { gbprintf(out, "Id: %s", u->text); PrintCoord(out, &node->coord); if (u->value) { PrintCRSpaces(out, offset + 2); gbputs("Value: ", out); PrintCRSpaces(out, offset + 4); PrintNode(out, u->value, offset + 4); } PrintCRSpaces(out, offset + 2); gbputs("decl: ", out); PrintNode(out, u->decl, offset+4); /* PrintCRSpaces(out, offset + 2);*/ /* PrintNode(out, u->decl, offset + 2); KHR */ }
PRIVATE inline void PrintTdef(GBUF *out, Node *node, tdefNode *u, UNUSED(int offset), UNUSED(Bool norecurse)) { /* temp fix for core dump when printing ast -Angelina */ if( u->type == NULL ) gbprintf(out, "Tdef: %s (%d) (type=NULL) ", u->name, node->print_uid); else gbprintf(out, "Tdef: %s (%d) (type=%d) ", u->name, node->print_uid, u->type->print_uid); PrintCoord(out, &node->coord); PrintTQ(out, u->tq, offset, norecurse); #if 0 if (!norecurse) { PrintCRSpaces(out, offset + 2); PrintNode(out, u->type, offset + 2); } #endif }
PRIVATE inline void PrintUnary(GBUF *out, Node *node, unaryNode *u, int offset, UNUSED(Bool norecurse)) { gbprintf(out, "Unary: "); PrintOp(out, u->op); PrintCoord(out, &node->coord); if (u->type) { PrintCRSpaces(out, offset + 2); PrintNode(out, u->type, offset + 2); } if (u->value) { PrintCRSpaces(out, offset + 2); gbputs("Value: ", out); PrintCRSpaces(out, offset + 4); PrintNode(out, u->value, offset + 4); } PrintCRSpaces(out, offset + 2); PrintNode(out, u->expr, offset + 2); }
PRIVATE inline void PrintBinop(GBUF *out, Node *node, binopNode *u, int offset, UNUSED(Bool norecurse)) { gbprintf(out, "Binop: "); PrintOp(out, u->op); PrintCoord(out, &node->coord); if (u->type) { PrintCRSpaces(out, offset + 2); PrintNode(out, u->type, offset + 2); } if (u->value) { PrintCRSpaces(out, offset + 2); gbputs("Value: ", out); PrintCRSpaces(out, offset + 4); PrintNode(out, u->value, offset + 4); } PrintCRSpaces(out, offset + 2); PrintNode(out, u->left, offset + 2); PrintCRSpaces(out, offset + 2); PrintNode(out, u->right, offset + 2); }
PRIVATE inline void PrintDecl(GBUF *out, Node *node, declNode *u, int offset, Bool norecurse) { gbprintf(out, "Decl: %s (%d)", u->name ? u->name : "", node->print_uid); PrintCoord(out, &node->coord); gbprintf(out, " "); PrintTQ(out, u->tq, offset+2, norecurse); if (norecurse) gbprintf(out, "\n"); else { PrintCRSpaces(out, offset + 2); PrintNode(out, u->type, offset + 2); PrintCRSpaces(out, offset + 2); PrintNode(out, u->init, offset + 2); PrintCRSpaces(out, offset + 2); PrintNode(out, u->bitsize, offset + 2); if (u->attribs) { PrintCRSpaces(out, offset+2); PrintList(out, u->attribs, offset+2); } } }
//---------------------------------------------- // Display current sensor position void OnTimer( HWND hDlgWnd ){ int iFrame; double dT_ms; double adXYZ[N_DISPL_SENSORS][N_COORD_ANGL]; int aiDistortion[N_DISPL_SENSORS]; HWND hPic; HDC hDC, hBitmapDC; HBITMAP hBitmap; RECT recClnt; int iSensor; int iOffsetX, iOffsetY; int iW, iH; int nSensors; double dSensX, dSensY; double dX, dY; char szTmp[100]; ZeroMemory(adXYZ, sizeof(adXYZ)); if( g_GetLatestCoordinates( &nSensors, &iFrame, &dT_ms, adXYZ ) ) return; g_GetSignalDistortion( aiDistortion ); hPic = GetDlgItem(hDlgWnd, IDC_PICTURE); GetClientRect( hPic, &recClnt ); iW = (recClnt.right - recClnt.left); iH = (recClnt.bottom - recClnt.top); iOffsetX = (iW - WIN_SIZE_X)/2; iOffsetY = (iH - WIN_SIZE_Y)/2; hDC = GetDC(hPic); // to avoid flicker we draw on the off-screen bitmap and then copy it to the screen hBitmapDC = CreateCompatibleDC ( hDC ); hBitmap = CreateCompatibleBitmap ( hDC, iW, iH ); SelectObject ( hBitmapDC, hBitmap ); // map DC to the off-screen bitmap // Black backgound SelectObject( hBitmapDC, GetStockObject( BLACK_BRUSH )); Rectangle( hBitmapDC, recClnt.left, recClnt.top, recClnt.right, recClnt.bottom); // White box SelectObject( hBitmapDC, GetStockObject( WHITE_PEN )); Rectangle( hBitmapDC, iOffsetX, iOffsetY, WIN_SIZE_X+iOffsetX, WIN_SIZE_Y+iOffsetY ); for( iSensor = 0; iSensor < nSensors; iSensor++){ dSensX = adXYZ[iSensor][0]; dSensY = adXYZ[iSensor][1]; // normalize coordinates to 0-1 dX = (dSensX - RAW_MIN_X)/ (RAW_MAX_X - RAW_MIN_X); dY = (RAW_MAX_Y - dSensY)/ (RAW_MAX_Y - RAW_MIN_Y); // make Y axis bottom->top // clip coordinates if(dX < 0) dX = 0; if(dX > 1) dX = 1; if(dY < 0) dY = 0; if(dY > 1) dY = 1; DrawCross( hBitmapDC, x_atMarkerColors[iSensor], (int)(dX*WIN_SIZE_X) + iOffsetX, (int)(dY*WIN_SIZE_Y) + iOffsetY ); } // for all sensors // Draw bitmap BitBlt(hDC, recClnt.left, recClnt.top, iW, iH, hBitmapDC, 0, 0, SRCCOPY); DeleteObject(hBitmap); DeleteDC(hBitmapDC); ReleaseDC(hPic, hDC); DrawDistortionBox( hDlgWnd, x_atDistortionColors[aiDistortion[0]], IDC_PIC_SENS1); DrawDistortionBox( hDlgWnd, x_atDistortionColors[aiDistortion[1]], IDC_PIC_SENS2); DrawDistortionBox( hDlgWnd, x_atDistortionColors[aiDistortion[2]], IDC_PIC_SENS3); DrawDistortionBox( hDlgWnd, x_atDistortionColors[aiDistortion[3]], IDC_PIC_SENS4); // Print timestamp sprintf(szTmp, "%.2f", dT_ms/1000.0); SetWindowText(GetDlgItem(hDlgWnd, IDC_LBL_TIME ), szTmp); // Print frame sprintf(szTmp, "%d", iFrame); SetWindowText(GetDlgItem(hDlgWnd, IDC_LBL_IFRAME ), szTmp); // Print coordinates PrintCoord(hDlgWnd, adXYZ[0][0], IDC_LBL_X1); PrintCoord(hDlgWnd, adXYZ[0][1], IDC_LBL_Y1); PrintCoord(hDlgWnd, adXYZ[0][2], IDC_LBL_Z1); PrintCoord(hDlgWnd, adXYZ[1][0], IDC_LBL_X2); PrintCoord(hDlgWnd, adXYZ[1][1], IDC_LBL_Y2); PrintCoord(hDlgWnd, adXYZ[1][2], IDC_LBL_Z2); PrintCoord(hDlgWnd, adXYZ[2][0], IDC_LBL_X3); PrintCoord(hDlgWnd, adXYZ[2][1], IDC_LBL_Y3); PrintCoord(hDlgWnd, adXYZ[2][2], IDC_LBL_Z3); PrintCoord(hDlgWnd, adXYZ[3][0], IDC_LBL_X4); PrintCoord(hDlgWnd, adXYZ[3][1], IDC_LBL_Y4); PrintCoord(hDlgWnd, adXYZ[3][2], IDC_LBL_Z4); }
PRIVATE inline void PrintPrim(GBUF *out, Node *node, UNUSED(primNode *u), UNUSED(int offset), UNUSED(Bool norecurse)) { gbprintf(out, "Prim: "); output_prim_type_to_GBUF(out, node, 0); PrintCoord(out, &node->coord); }