void GameRender(void) { u_int uColor = (dbg_collided)? 0x80FF8080 : 0x8080FF80; PolyColl::Render(m_xPosition[0], uColor, 0xFFFFFFFF, m_pxVertices[0], m_iNumVertices[0]); PolyColl::Render(m_xPosition[1], uColor, 0xFF000000, m_pxVertices[1], m_iNumVertices[1]); PrintString(m_xPosition[0].x, m_xPosition[0].y, true, 0xFFFFFFFF, "Poly A"); PrintString(m_xPosition[1].x, m_xPosition[1].y, true, 0xFFFFFFFF, "Poly B"); if (dbg_collided) { // render the collision stuff RenderArrow((m_xPosition[0] + m_xPosition[1]) * 0.5f, Ncoll, fabs(dcoll), 0xFFFFFFFF); PrintString(1, 1, false, 0xFFFFFFFF, "Press 'RETURN' to separate the objects"); } }
static void PrintCaptions() { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.8f); glRecti(0, session->film->GetHeight() - 15, session->film->GetWidth() - 1, session->film->GetHeight() - 1); glRecti(0, 0, session->film->GetWidth() - 1, 18); glDisable(GL_BLEND); // Caption line 0 glColor3f(1.f, 1.f, 1.f); glRasterPos2i(4, 5); PrintString(GLUT_BITMAP_8_BY_13, captionBuffer); // Title glRasterPos2i(4, session->film->GetHeight() - 10); PrintString(GLUT_BITMAP_8_BY_13, SLG_LABEL.c_str()); }
void displayFunc(void) { glClear(GL_COLOR_BUFFER_BIT); glRasterPos2i(0, 0); glDrawPixels(width, height, GL_RGBA, GL_UNSIGNED_BYTE, pixels); // Title glColor3f(1.f, 1.f, 1.f); glRasterPos2i(4, height - 16); PrintString(GLUT_BITMAP_HELVETICA_18, "OpenCL Ray Tracing Experiment"); // Caption line 0 glColor3f(1.f, 1.f, 1.f); glRasterPos2i(4, 10); PrintString(GLUT_BITMAP_HELVETICA_18, captionBuffer); glutSwapBuffers(); }
void PrintGpsText() { unsigned int color; CVector2D point; short text[128]; if(*g_TimeMs < gGpsTextTimer + GPS_TEXT_TIME) { switch(gCurrentGpsMode) { case GPS_MODE_DISABLED: AsciiToUnicode("GPS Mode: Disabled", text); break; case GPS_MODE_DEFAULT: AsciiToUnicode("GPS Mode: Default", text); break; case GPS_MODE_AMMUNATION: if(*gCurrLevel != LEVEL_SHORESIDE) AsciiToUnicode("GPS Mode: Ammu-Nation", text); else AsciiToUnicode("GPS Error: can't find Ammu-Nation", text); break; case GPS_MODE_BOMBSHOP: AsciiToUnicode("GPS Mode: Bomb Shop", text); break; case GPS_MODE_FIRESTATION: AsciiToUnicode("GPS Mode: Fire Station", text); break; case GPS_MODE_HOSPITAL: AsciiToUnicode("GPS Mode: Hospital", text); break; case GPS_MODE_PAYNSPRAY: AsciiToUnicode("GPS Mode: Pay'N'Spray", text); break; case GPS_MODE_POLICE: AsciiToUnicode("GPS Mode: Police", text); break; case GPS_MODE_SAFEHOUSE: AsciiToUnicode("GPS Mode: Safehouse", text); break; default: AsciiToUnicode("GPS Error: Unknown command", text); } color = 0xFFFFFFFF; SetFontStyle(0); SetScale(0.7f, 1.0f); SetColor(&color); SetJustifyOn(); SetDropShadowPosition(1); SetPropOn(); point.x = -1.0f; point.y = -1.0f; TransformRadarPointToScreenSpace(point, point); PrintString(point.x, point.y + 10.0f, text); SetDropShadowPosition(0); SetFontStyle(0); } }
/*! Read battery state and update charge output * \note Status can be used to update the LCD screen of a possible change * in battery charging state */ static void ChargingControl(void) { /* prepare to read status bits */ BAT_CHARGE_OUT |= BAT_CHARGE_STATUS_OPEN_DRAIN_BITS; /* always enable the charger (it may already be enabled) * status bits are not valid unless charger is enabled */ BATTERY_CHARGE_ENABLE(); /* wait until signals are valid - measured 400 us * during this delay we will also run the software FLL */ TaskDelayLpmDisable(); /* disable BT flow during FLL loop */ portENTER_CRITICAL(); unsigned char FlowDisabled = QueryFlowDisabled(); if (!FlowDisabled) DisableFlow(); portEXIT_CRITICAL(); EnableSoftwareFll(); vTaskDelay(1); DisableSoftwareFll(); portENTER_CRITICAL(); if (!FlowDisabled) EnableFlow(); portEXIT_CRITICAL(); TaskDelayLpmEnable(); /* Decode the battery state */ /* mask and shift to get the current battery charge status */ ChargeStatus = BAT_CHARGE_IN & (BAT_CHARGE_STAT1 | BAT_CHARGE_STAT2); switch (ChargeStatus) { case CHARGE_STATUS_PRECHARGE: PrintString("."); break; case CHARGE_STATUS_FAST_CHARGE: PrintString(":"); break; case CHARGE_STATUS_DONE: PrintString("|"); break; case CHARGE_STATUS_OFF: PrintString("ChargeOff"); break; default: PrintString("Charge???"); break; } }
NET_API_STATUS StartBrowserService(LPTSTR wcMachineName) { DWORD LastError; SC_HANDLE ServiceControllerHandle; SC_HANDLE ServiceHandle; sprintf(PrintBuf,"\nTrying to start Browser on %s.", UnicodeToPrintfString(wcMachineName)); PrintString(TOSCREENANDLOG, PrintBuf); ServiceControllerHandle = OpenSCManager(wcMachineName, NULL, SC_MANAGER_ALL_ACCESS); if (ServiceControllerHandle == NULL) { return GetLastError(); } ServiceHandle = OpenService(ServiceControllerHandle, BROWSER, SERVICE_ALL_ACCESS); if (ServiceHandle == NULL) { CloseServiceHandle(ServiceControllerHandle); return GetLastError(); } if(!StartService(ServiceHandle, 0, NULL)){ CloseServiceHandle(ServiceHandle); CloseServiceHandle(ServiceControllerHandle); LastError = GetLastError(); if(LastError != ERROR_SERVICE_ALREADY_RUNNING) return LastError; else { sprintf(PrintBuf,"\nBrowser already running on %s.\n", UnicodeToPrintfString(wcMachineName)); PrintString(TOSCREENANDLOG, PrintBuf); return NERR_Success; } } sprintf(PrintBuf,"\nStarted Browser on %s.\n", UnicodeToPrintfString(wcMachineName)); PrintString(TOSCREENANDLOG, PrintBuf); CloseServiceHandle(ServiceHandle); CloseServiceHandle(ServiceControllerHandle); return NERR_Success; }
//****************************************************************** // EditMemoryInit // FILENAME: // PARAMETERS: // DESCRIPTION: // RETURNS: //******************************************************************* void EditMemoryInit(int initstate) { read_sw(); if(GetKey(MODE_KEY)) { // reset nickname -> nickname discovery vscp_setNickname( VSCP_ADDRESS_FREE ); PrintString( (UINT8 const *)"\n\rRESET NICKNAME" ); } }
/* when debugging one may want to disable this */ static void Housekeeping(void) { if ( gBtStats.MallocFailed || gBtStats.RxDataOverrun || gBtStats.RxInvalidStartCallback ) { PrintString("************Bluetooth Failure************\r\n"); __delay_cycles(100000); ForceWatchdogReset(); } if ( gAppStats.BufferPoolFailure ) { PrintString("************Application Failure************\r\n"); __delay_cycles(100000); ForceWatchdogReset(); } }
void testStringIndex() { printf("input the main string:\n"); SString S; CreateString(S); PrintString(S); printf("input the sub string:\n"); SString S2; CreateString(S2); PrintString(S2); printf("general matching algirothm:\n"); int pos = Index(S, S2, 1); printf("the position of the substring in the main string is: %d\n", pos); printf("kmp matching algirothm:\n"); pos = Index_KMP(S, S2, 1); printf("the position of the substring in the main string is: %d\n", pos); }
void BPL_FreeMessageBuffer(unsigned char* pBuffer) { // make sure the returned pointer is in range if ( pBuffer < LOW_BUFFER_ADDRESS || pBuffer > HIGH_BUFFER_ADDRESS ) { PrintString("Free Buffer Corruption\r\n"); SetBufferPoolFailureBit(); } // params are: queue handle, ptr to item to queue, tick to wait if full // the queue can't be full unless there is a bug, so don't wait on full if( pdTRUE != xQueueSend(QueueHandles[FREE_QINDEX], &pBuffer, DONT_WAIT) ) { PrintString("Unable to add buffer to Free Queue\r\n"); SetBufferPoolFailureBit(); } }
void Display_Raw(float accel[3], float gyro[3], float temp) //Display raw Accel Gyro and Tempreature Values { PrintString("\nAccel\tTemp\tGyro\t"); for(uint8_t i=0;i<3;i++) { PrintFloat(accel[i]); PrintString("\t"); } PrintFloat(temp); PrintString("\t"); for(uint8_t i=0;i<3;i++) { PrintFloat(gyro[i]); PrintString("\t"); } }
int main(){ PrintString("Setting monitors\n", 17); Acquire(lock1); SetMonitor(mon1, 0, 9); for (i = 0; i < 30000; ++i){ Yield(); } Release(lock1); PrintString("Waiting on lock2\n", 17); Acquire(lock1); Wait(lock1, cond1); Release(lock1); PrintString("Destroying Monitors 1 and 2\n", 28); DestroyMonitor(mon1); DestroyMonitor(mon2); Exit(1); }
/*Function to print money owned by clerks*/ void printMoney() { int totalMoney = 0; int applicationMoney = 0; int pictureMoney = 0; int passportMoney = 0; int cashierMoney = 0; int i, tempMon; for(i = 0; i < clerkCount; ++i) { tempMon = GetMonitor(clerkMoney, i); if (i < clerkArray[0]) { /*ApplicationClerk index*/ applicationMoney += tempMon; } else if (i < clerkArray[0] + clerkArray[1]) { /*PictureClerk index*/ pictureMoney += tempMon; } else if (i < clerkArray[0] + clerkArray[1] + clerkArray[2]) { /*PassportClerk index*/ passportMoney += tempMon; } else if (i < clerkArray[0] + clerkArray[1] + clerkArray[2] + clerkArray[3]) { /*Cashier index*/ cashierMoney += tempMon; } totalMoney += tempMon; } applicationMoney = applicationMoney * 100; pictureMoney = pictureMoney * 100; passportMoney = passportMoney * 100; cashierMoney = cashierMoney * 100; totalMoney = totalMoney * 100; PrintString("Manager has counted a total of ", 31); PrintNum(applicationMoney); PrintString(" for ApplicationClerks\n", 23); PrintString("Manager has counted a total of ", 31); PrintNum(pictureMoney); PrintString(" for PictureClerks\n", 19); PrintString("Manager has counted a total of ", 31); PrintNum(passportMoney); PrintString(" for PassportClerks\n", 20); PrintString("Manager has counted a total of ", 31); PrintNum(cashierMoney); PrintString(" for Cashiers\n", 14); PrintString("Manager has counted a total of ", 31); PrintNum(totalMoney); PrintString(" for passport office\n", 21); }
virtual void DisplayCallBack() { ComputeImage(); bitmap->draw(); glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.8f); glRecti(0, windowHeight - 30, windowWidth - 1, windowHeight - 1); glRecti(0, 0, windowWidth - 1, 18); glDisable(GL_BLEND); // Title glColor3f(1.f, 1.f, 1.f); glRasterPos2i(4, windowHeight - 10); PrintString(GLUT_BITMAP_8_BY_13, "JugCLer 1.0 by Holger Bettag ([email protected])"); glRasterPos2i(4, windowHeight - 25); PrintString(GLUT_BITMAP_8_BY_13, "Heavily inspired by Michael Birken's" " reverse engineering of Eric Graham's original Amiga" " juggler demo"); // Caption line 0 const std::string captionString = boost::str(boost::format("[60Hz screen refresh][No-Vsync %.1f Frame/sec][%.1fM Sample/sec]") % frameSec % (frameSec * windowWidth * windowHeight / 1000000.0)); glColor3f(1.f, 1.f, 1.f); glRasterPos2i(4, 5); PrintString(GLUT_BITMAP_8_BY_13, captionString.c_str()); if (printHelp) { glPushMatrix(); glLoadIdentity(); glOrtho(-.5f, windowWidth - .5f, -.5f, windowHeight - .5f, -1.f, 1.f); PrintHelp(); glPopMatrix(); } glutSwapBuffers(); }
VOID SystemHang ( CHAR8 *Message ) { PrintString ( "%s## FATAL ERROR ##: Fail to load DUET images! System hang!\n", Message ); CpuDeadLoop(); }
static void PrintInfo(void) { char s[100]; glDisable(GL_FOG); glColor3f(0, 1, 1); sprintf(s, "Mode(m): %s Start(s/S): %g End(e/E): %g Density(d/D): %g", ModeStr, fogStart, fogEnd, fogDensity); glWindowPos2iARB(5, 20); PrintString(s); sprintf(s, "Arrays(a): %s glFogCoord(c): %s EyeZ(z/z): %g", (Arrays ? "Yes" : "No"), (fogCoord ? "Yes" : "No"), camz); glWindowPos2iARB(5, 5); PrintString(s); }
void TOperandString::Print(OutStream &out) const { if (m_data_length != 0) { out << '\"'; PrintString(out, m_data, m_data_length); out << '\"'; } else { out << "null"; } }
void Display_Song_Length(void) { char ms[64]; if(userscreen == USER_SCREEN_DISKIO_EDIT) { sprintf(ms, "%.2d:%.2d:%.2d", song_Hours, song_Minutes, song_Seconds); Gui_Draw_Button_Box(254, (Cur_Height - 58), 80, 16, "", BUTTON_NORMAL | BUTTON_DISABLED); PrintString(274, (Cur_Height - 56), USE_FONT, ms); } }
int main() { int n; int arr[N_MAX]; int i, j; PrintString("Nhap N (N <= 100): "); n = ReadInt(); while (n == 0 || n > 100) { PrintString("So nhap khong hop le, vui long nhap lai: "); n = ReadInt(); } /* Input N integers */ for (i = 0; i < n; i++) { PrintString("Nhap vao so nguyen thu "); PrintInt(i+1); PrintString(": "); arr[i] = ReadInt(); while (arr[i] == 0) { PrintString("Nhap khong hop le, vui long nhap lai: "); arr[i] = ReadInt(); } } /* Bubble sort */ for (i = 0; i < n - 1; i++) { /* Last i integers are already sorted */ for (j = 0; j < n - i - 1; j++) { if (arr[j] > arr[j + 1]) { /* Swap two integers */ arr[j] ^= arr[j + 1]; arr[j + 1] ^= arr[j]; arr[j] ^= arr[j + 1]; } } } /* Print N sorted integers */ PrintString("Day so da sap xep:\n"); for (i = 0; i < n - 1; i++) { PrintInt(arr[i]); PrintString(", "); } /* Last integer */ PrintInt(arr[n - 1]); PrintString(".\n"); return 0; }
unsigned char* BPL_AllocMessageBuffer(void) { unsigned char * pBuffer = NULL; // params are: queue handle, ptr to the msg buffer, ticks to wait if( pdTRUE != xQueueReceive( QueueHandles[FREE_QINDEX], &pBuffer, DONT_WAIT ) ) { PrintString("Unable to Allocate Buffer\r\n"); SetBufferPoolFailureBit(); } if ( pBuffer < LOW_BUFFER_ADDRESS || pBuffer > HIGH_BUFFER_ADDRESS ) { PrintString("Free Buffer Corruption\r\n"); SetBufferPoolFailureBit(); } return pBuffer; }
VOID PrintWin32Error(IN LPWSTR Message, IN DWORD ErrorCode) { LPWSTR lpMsgBuf; FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, NULL, ErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPWSTR)&lpMsgBuf, 0, NULL); PrintString(L"%s: %s\n", Message, lpMsgBuf); LocalFree(lpMsgBuf); }
/* * this writes a signature to the EnterBoot RAM location * and generates a reset. The signature tells the bootloader * to stay in bootload mode to accept bootload messaging. */ void EnterBootloader(void) { PrintString("- Entering Bootloader Mode\r\n"); DrawBootloaderScreen(); __disable_interrupt(); /* disable RAM alternate interrupt vectors */ SYSCTL &= ~SYSRIVECT; SetBootloaderSignature(); SoftwareReset(); }
static void HelpCmdHandler(void) { PrintString("\r\n************ List of Commands ****************\r\n"); unsigned char i = 0; /* don't print the last command because it is for PC tool */ while ( i < NUMBER_OF_COMMANDS-1 ) { PrintString2((tString*)COMMAND_TABLE[i].CommandNameString,CR); i++; } }
void testStringWithFixedLen() { SString S; CreateString(S); PrintString(S); SString S2; CreateString(S2); PrintString(S2); SString T; StrConcat(T, S, S2); PrintString(T); SString Sub; SubString(Sub, T, 2, 3); PrintString(Sub); printf("compare two string:\n"); SString s1; CreateString(s1); PrintString(s1); SString s2; CreateString(s2); PrintString(s2); int result = StrCompare(s1, s2); if (!result) printf("s1 == s2"); else if (result > 0) printf("s1 > s2"); else printf("s1 < s2"); printf("\n"); }
BOOL TerminatePort(void) { //APIRET APIENTRY SplPdInitPort(HFILE hCom,PSZ pszPortName) PFN pfnProcess; APIRET rc; HFILE hCom; ULONG ulAction; sprintf(szMessage,"Terminating %s",szPortName); PrintString(szMessage,3); if ((rc = DosOpen(szPortName,&hCom,&ulAction,0L,0L,0x0001,0x21c2,0L)) == NO_ERROR) { if (hMod != 0) { if (DosQueryProcAddr(hMod,0,"SPLPDTERMPORT",&pfnProcess) == NO_ERROR) rc = pfnProcess(hCom,szPortName); else { ErrorNotify("Error Getting TERMPORT Address"); return(FALSE); } } else { sprintf(szMessage,"Error Loading Module %s",szModuleName); ErrorNotify(szMessage); return(FALSE); } DosClose(hCom); } if (rc != NO_ERROR) { sprintf(szMessage,"Error Terminating Port - rc = %X",rc); ErrorNotify(szMessage); return(FALSE); } sprintf(szMessage,"Port %s terminated",szPortName); PrintString(szMessage,4); return(TRUE); }
void t2(){ Write("t2 acquiring lock1\n", 19, ConsoleOutput); Acquire(lock1); PrintString("t2 output should be 50 or 60 to show that there is no race condition in for loop\n", 81); for ( i = 0; i < 10; ++i) ++check; PrintNum(check); PrintNl(); Write("t2 releasing lock1\n", 19, ConsoleOutput); Release(lock1); Acquire(lock2); Release(lock2); Exit(0); }
VOID CompareListsMasterAndBackUp(PVOID pvMsServerList, DWORD dwEntriesInList, PVOID pvBkServerList, DWORD dwEntriesInBackList, LPTSTR wcDomainName, LPTSTR wcMasterName, LPTSTR wcBackUpBrowser, LPTSTR wcTestedTransport) { INT i, j; PSERVER_INFO_101 pServerInfo101_l1; PSERVER_INFO_101 pServerInfo101_l2; if(dwEntriesInList != dwEntriesInBackList){ sprintf(PrintBuf, "\nThe List in Master and BackUp differs by %ld. Master : %s ", abs(dwEntriesInList - dwEntriesInBackList), UnicodeToPrintfString(wcMasterName)); PrintString(TOSCREENANDLOG, PrintBuf); sprintf(PrintBuf, " BackUp: %s ",UnicodeToPrintfString(wcBackUpBrowser)); PrintString(TOSCREENANDLOG, PrintBuf); sprintf(PrintBuf, " Transport: %s.",UnicodeToPrintfString(wcTestedTransport)); PrintString(TOSCREENANDLOG, PrintBuf); sprintf(PrintBuf, "\nWARNING[WR%ld]: The List in Master and BackUp doesnot match. Transport : %s.", ++WRNCOUNT, UnicodeToPrintfString(wcTestedTransport)); PrintString(TOALL, PrintBuf); } else { sprintf(PrintBuf, "\nSUCCESS[SC%ld]: The List in Master and BackUp Matches. Transport : %s.", ++SUCSCOUNT, UnicodeToPrintfString(wcTestedTransport)); PrintString(TOALL, PrintBuf); } // // Note : Needs to add the rest of the checking // }
static void PrintCaptions() { glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.8f); glRecti(0, engine->height - 15, engine->width - 1, engine->height - 1); glRecti(0, 0, engine->width - 1, 18); glDisable(GL_BLEND); // Title glColor3f(1.f, 1.f, 1.f); glRasterPos2i(4, engine->height - 10); PrintString(GLUT_BITMAP_8_BY_13, engine->SPPMG_LABEL); // Stats glRasterPos2i(4, 5); char captionBuffer[512]; const double elapsedTime = WallClockTime() - engine->startTime; const unsigned int kPhotonsSec = engine->getPhotonTracedTotal() / (elapsedTime * 1000.f); sprintf(captionBuffer, "[Photons %.2fM][Avg. photons/sec % 4dK][Elapsed time %dsecs]", float(engine->getPhotonTracedTotal() / 1000000.0), kPhotonsSec, int(elapsedTime)); PrintString(GLUT_BITMAP_8_BY_13, captionBuffer); }
void MySevenSegment::EffectServer() { if( mServerWaitTime == 3500 ) { if( mServerWaitCount == 0 ) { PrintString(F("SEr_ ")); } else if( mServerWaitCount == 1 ) { PrintString(F("SEr _ ")); } else { PrintString(F("SEr _")); } mServerWaitCount = (mServerWaitCount+1) % 3; mServerWaitTime = mServerWaitTime%3500; } mServerWaitTime++; }
void CheckBattery(void) { BatterySenseCycle(); if (!ClipOn()) { ChargeStatus = CHARGE_STATUS_OFF; CheckBatteryLow(); } else if (ChargeEnable) ChargingControl(); PrintDecimal(Read(BATTERY)); PrintString(CR); }