void myDisplay(void) { if(display_type == INTRO) { static int intro_count = 0; if(intro_count == 0) { IntroMessage(); intro_count++; } else if(intro_count == 1) { Pause(PAUSE_INTRO); intro_count++; display_type = RUN; } } else if(display_type == PAUSE) { Pause(PAUSE_STANDARD); display_type = RUN; } else if(display_type == RUN) { ClearWindow(); SetBackgndColorHex(COLOR_HOUSE_BACKGROUND); DrawRandomHouses(); MoveHouses(); } return; }
/* * UpdateRepeatString - a new repeat count has come in */ void UpdateRepeatString( char *str ) { ClearWindow( repeat_window_id ); strcpy( repString, str ); drawRepeatString(); } /* UpdateRepeatString */
// === Debug image display methods. === // Displays the image of the matrix to the forward window. void Network::DisplayForward(const NetworkIO& matrix) { Pix* image = matrix.ToPix(); ClearWindow(false, name_.string(), pixGetWidth(image), pixGetHeight(image), &forward_win_); DisplayImage(image, forward_win_); forward_win_->Update(); }
// Displays the image of the matrix to the backward window. void Network::DisplayBackward(const NetworkIO& matrix) { Pix* image = matrix.ToPix(); STRING window_name = name_ + "-back"; ClearWindow(false, window_name.string(), pixGetWidth(image), pixGetHeight(image), &backward_win_); DisplayImage(image, backward_win_); backward_win_->Update(); }
/* * NullResponse - give null response for keystroke */ vi_rc NullResponse( void ) { if( !EditFlags.EscapeMessage ) { ClearWindow( MessageWindow ); } else { DisplayFileStatus(); } UnselectRegion(); return( ERR_NO_ERR ); } /* NullResponse */
void Message1( char *fmt, ... ) { va_list args; char tmp[MAX_STR]; ClearWindow( MessageWindow ); va_start( args, fmt ); MyVSprintf( tmp, fmt, args ); va_end( args ); strcpy( msgString1, tmp ); msgString( 1, tmp ); }
VOID OpenImage(HWND hWnd, LPCWSTR fileName) { HDC windowDC = GetDC(hWnd); HENHMETAFILE hemf = GetEnhMetaFile(fileName); GetClientRect(hWnd, &rect); ClearWindow(memoryDC); RefreshMetafileDC(hWnd); PlayEnhMetaFile(memoryDC, hemf, &rect); PlayEnhMetaFile(metafileDC, hemf, &rect); ReleaseDC(hWnd, windowDC); DeleteEnhMetaFile(hemf); }
void DoHelp ( void ) { char buffer[82]; PWINDOWS ptr = GetActiveWindow(); ClearWindow(); memset(buffer, 0x00, 82); sprintf(buffer, "StartAll -- resume all tasks"); PC_DispStr(ptr->cx, ptr->cy, buffer, ptr->color); ptr->cy ++; sprintf(buffer, "StopAll -- suspend all tasks"); PC_DispStr(ptr->cx, ptr->cy, buffer, ptr->color); // printf("Test printf functions!\n"); }
void LoadingOutput::Notify(int percentage, char* message) { if (s_loadingScreen) { // Add up the total s_loadingScreen->Add(percentage); // Set the message s_loadingScreen->SetMessage(message); // Clear the window for manual rendering. This is done here, as it is outside the main game loop (loading between states) ClearWindow(); // Render the loading bar s_loadingScreen->Render(); // Update window with new loading screen UpdateWindow(); } else throw runtime_error("Must initialise the loading output before notifying it."); }
/* * Message1Box - display message on line 1 (differs from Message1 only on Windows) */ void Message1Box( char *str, ... ) { va_list al; char tmp[MAX_STR]; if( !EditFlags.EchoOn || MessageWindow == NO_WINDOW ) { return; } ClearWindow( MessageWindow ); va_start( al, str ); MyVSprintf( tmp, str, al ); va_end( al ); tmp[EditVars.WindMaxWidth - 1] = 0; if( !EditFlags.LineDisplay ) { DisplayLineInWindow( MessageWindow, 1, tmp ); } else { MyPrintf( "%s\n", tmp ); } } /* Message1 */
/* * Message1Box - display message on line 1 (differs from Message1 only on Windows) */ void Message1Box( const char *str, ... ) { va_list al; char tmp[MAX_STR]; if( !EditFlags.EchoOn || BAD_ID( message_window_id ) ) { return; } ClearWindow( message_window_id ); va_start( al, str ); MyVSprintf( tmp, str, al ); va_end( al ); tmp[EditVars.WindMaxWidth - 1] = '\0'; if( !EditFlags.LineDisplay ) { DisplayLineInWindow( message_window_id, 1, tmp ); } else { MyPrintf( "%s\n", tmp ); } } /* Message1 */
/* * ResizeWindow - give a window a new size */ vi_rc ResizeWindow( window_id wid, windim x1, windim y1, windim x2, windim y2, bool scrflag ) { window *oldw; // int bt, k; // char *txt, *tptr; // char *ot; // int i, j; oldw = WINDOW_FROM_ID( wid ); AccessWindow( oldw ); if( !ValidDimension( x1, y1, x2, y2, oldw->has_border ) ) { ReleaseWindow( oldw ); return( ERR_WIND_INVALID ); } RestoreOverlap( wid, scrflag ); AllocWindow( wid, x1, y1, x2, y2, oldw->has_border, oldw->has_gadgets, true, oldw->border_color1, oldw->border_color2, oldw->text_color, oldw->background_color ); MarkOverlap( wid ); /* * display the new text */ ClearWindow( wid ); if( oldw->title != NULL ) { WindowTitle( wid, oldw->title ); } else { DrawBorder( wid ); } DCResize( CurrentInfo ); DCDisplayAllLines(); DCUpdate(); FreeWindow( oldw ); ReleaseWindow( WINDOW_FROM_ID( wid ) ); return( ERR_NO_ERR ); } /* ResizeWindow */
HRESULT Dot11aTxFrameEncode9(PBB11A_TX_VECTOR info, IN OUT PPACKET_BASE pPacket) { unsigned int uiScrambledSize; unsigned int uiSymbolCountData; unsigned int uiPilotIndex = 0; unsigned int i; char * pbInput; PTXSAMPLE pcOutput; ULONG PacketSizePlusCRC32 = pPacket->PacketSize + 4; ClearWindow(info->cWindow); uiScrambledSize = SERVICE_LEN_IN_BITS + PADDING_LEN_IN_BITS + (PacketSizePlusCRC32 << BITS_PER_BYTE_SHIFT); uiSymbolCountData = (uiScrambledSize + (DBPS - 1)) / DBPS; ULONG SignalBytes = GetSignalBytes(info, uiSymbolCountData); ULONG SampleBufferSize = 0; SoraPacketGetTxSampleBuffer(pPacket, (PTXSAMPLE *)&pcOutput, &SampleBufferSize); ALIGN_WITH_RCB_BUFFER_PADDING_ZERO(pcOutput, SignalBytes); SoraPacketSetSignalLength(pPacket, SignalBytes); // Copy preamble pcOutput += CopyPreamble16_NT(info, pcOutput, info->cWindow); ConvEncodeReset(info->bConvEncoderReg); // Generate Signal pcOutput += GenerateSignal(info, pcOutput, info->cWindow, SIGNAL_RATE, (unsigned short)PacketSizePlusCRC32); // Scramble Data if (!(uiSymbolCountData & 0x1)) { Scramble11a(pPacket->pMdl, info->bFrameScrambled, (uiSymbolCountData >> 1) * (DBPS * 2 / BITS_PER_BYTE), pPacket->Reserved1, info->ulRadom); }
void Task ( void * data ) { UBYTE x; UBYTE y; UBYTE err; int curwin; PWINDOWS ptr; int i, full; for (;;) { OSSemPend(RandomSem, 0, &err); /* Acquire semaphore to perform random numbers */ curwin = GetCurrentWin(); SetCurrentWin(*(char *)data - 0x2f); ptr = GetActiveWindow(); x = random(ptr->ex - ptr->sx); /* Find X position where task number will appear */ y = random(ptr->ey - ptr->sy); /* Find Y position where task number will appear */ ptr->cache[x + y * (ptr->ex - ptr->sx)] = *(char *)data; for (full = 1, i = 0; i < (ptr->ex - ptr->sx) * (ptr->ey - ptr->sy); i ++) { if (ptr->cache[i] != *(char *)data) { full = 0; break; } } if (full) ClearWindow(); PC_DispChar(ptr->sx + x + 1, ptr->sy + y, 'o', ptr->color); // *(char *)data, ptr->color); SetCurrentWin(curwin); OSSemPost(RandomSem); /* Release semaphore */ OSTimeDly(1); /* Delay 1 clock tick */ } }
/* * Global - perform global command */ vi_rc Global( linenum n1, linenum n2, const char *data, int dmt ) { char *sstr, *linedata; bool match; vi_rc rc; vi_rc rc1; long changecnt = 0; linenum ll; fcb *cfcb; line *cline; regexp crx; i_mark pos; /* * get search string and command */ rc = ModificationTest(); if( rc != ERR_NO_ERR ) { return( rc ); } sstr = alloca( MAX_INPUT_LINE ); if( sstr == NULL ) { return( ERR_NO_STACK ); } data = SkipLeadingSpaces( data ); data = GetNextWord( data, sstr, SingleSlash ); if( *sstr == '\0' ) { return( ERR_INVALID_GLOBAL_CMD ); } if( *data == '/' ) ++data; // skip one slash character data = SkipLeadingSpaces( data ); /* * verify last line */ if( n2 > CurrentFile->fcbs.tail->end_line ) { rc = CFindLastLine( &ll ); if( rc != ERR_NO_ERR ) { return( rc ); } if( n2 > ll ) { return( ERR_INVALID_LINE_RANGE ); } } /* * set for start of search */ if( EditFlags.Verbose && EditFlags.EchoOn ) { ClearWindow( MessageWindow ); } rc = CurrentRegComp( sstr ); if( rc != ERR_NO_ERR ) { return( rc ); } SaveCurrentFilePos(); StartUndoGroup( UndoStack ); EditFlags.DisplayHold = true; /* * pass one - find all matches */ for( pos.line = n1; pos.line <= n2; pos.line++ ) { /* * go thorugh file, marking global lines */ pos.column = 0; rc = FindRegularExpression( NULL, &pos, &linedata, n2, 0 ); if( rc != ERR_NO_ERR ) { if( rc == ERR_FIND_PAST_TERM_LINE || rc == ERR_FIND_NOT_FOUND || rc == ERR_FIND_END_OF_FILE ) { break; } RestoreCurrentFilePos(); EditFlags.DisplayHold = false; return( rc ); } if( pos.line > n2 ) { break; } /* * go to appropriate spot in file */ rc = GoToLineNoRelCurs( pos.line ); if( rc != ERR_NO_ERR ) { RestoreCurrentFilePos(); EditFlags.DisplayHold = false; return( rc ); } /* * mark fcb and line for a match */ CurrentFcb->globalmatch = true; CurrentLine->u.ld.globmatch = true; if( EditFlags.Verbose && EditFlags.EchoOn ) { // WPrintfLine( MessageWindow,1,"Match on line %l",clineno ); Message1( "Match on line %l", pos.line ); } } /* * negate range, if needed */ if( dmt ) { /* * run through each line, flipping globmatch flag on lines */ CGimmeLinePtr( n1, &CurrentFcb, &CurrentLine ); match = false; for( CurrentPos.line = n1; CurrentPos.line <= n2; CurrentPos.line++ ) { if( CurrentLine->u.ld.globmatch ) { CurrentLine->u.ld.globmatch = false; } else { match = true; CurrentLine->u.ld.globmatch = true; } CurrentLine = CurrentLine->next; if( CurrentLine == NULL ) { CurrentFcb->globalmatch = match; CurrentFcb = CurrentFcb->next; FetchFcb( CurrentFcb ); CurrentLine = CurrentFcb->lines.head; match = false; } } } /* * Pass 2: do all changes */ rc = ERR_NO_ERR; EditFlags.GlobalInProgress = true; memcpy( &crx, CurrentRegularExpression, sizeof( crx ) ); for( CurrentFcb = CurrentFile->fcbs.head; CurrentFcb != NULL; CurrentFcb = CurrentFcb->next ) { if( !CurrentFcb->globalmatch ) continue; FetchFcb( CurrentFcb ); CurrentPos.line = CurrentFcb->start_line; for( CurrentLine = CurrentFcb->lines.head; CurrentLine != NULL; CurrentLine = CurrentLine->next, CurrentPos.line++ ) { if( !CurrentLine->u.ld.globmatch ) continue; CurrentLine->u.ld.globmatch = false; changecnt++; CurrentPos.column = 1; ProcessingMessage( CurrentPos.line ); /* * build command line */ rc = RunCommandLine( data ); if( rc > ERR_NO_ERR ) { break; } } if( rc > ERR_NO_ERR ) { break; } CurrentFcb->globalmatch = false; } /* * we have an error, so fix up fcbs */ if( rc > ERR_NO_ERR ) { for( cfcb = CurrentFile->fcbs.head; cfcb != NULL; cfcb = cfcb->next ) { if( cfcb->globalmatch ) { cfcb->globalmatch = false; cfcb->non_swappable = false; for( cline = cfcb->lines.head; cline != NULL; cline = cline->next ) { cline->u.ld.globmatch = false; } } } } /* * display results */ EditFlags.GlobalInProgress = false; EditFlags.DisplayHold = false; EndUndoGroup( UndoStack ); RestoreCurrentFilePos(); rc1 = SetCurrentLine( CurrentPos.line ); if( rc1 != ERR_NO_ERR ) { if( rc1 == ERR_NO_SUCH_LINE ) { SetCurrentLine( 1 ); } else { return( rc1 ); } } Message1( "%l matches found",changecnt ); DCDisplayAllLines(); return( rc ); } /* Global */
/* * EditMain - main driver for editor (command mode) */ void EditMain( void ) { vi_rc rc; char *msg = NULL; bool doclear; /* * loop forever, or at least until all done */ for( ;; ) { #if 0 #ifdef __WIN__ PushMode(); UpdateFiles(); PopMode(); #endif #endif if( !EditFlags.InsertModeActive || EditFlags.Modeless ) { if( EditFlags.Modeless ) { UpdateEditStatus(); EditFlags.NoCapsLock = false; } else { UpdateCurrentStatus( CSTATUS_COMMAND ); EditFlags.NoCapsLock = true; } if( !EditFlags.Modeless && EditFlags.ReturnToInsertMode && !NonKeyboardEventsPending() ) { EditFlags.ReturnToInsertMode = false; if( EditFlags.WasOverstrike ) { LastEvent = 'R'; } else { LastEvent = 'i'; } } else { DCUpdateAll(); #ifdef __WIN__ SetWindowCursorForReal(); #endif LastEvent = GetNextEvent( true ); } EditFlags.NoCapsLock = false; doclear = true; if( LastEvent == VI_KEY( MOUSEEVENT ) ) { if( LastMouseEvent == MOUSE_MOVE ) { doclear = false; } } if( doclear ) { if( EditFlags.AutoMessageClear ) { ClearWindow( MessageWindow ); } #ifndef __WIN__ ResetDisplayLine(); #endif } } else { // Cannot do a RestoreInfo while we are in insert mode // because it will call ValidateCurrentColumn which will // do something stupid on us... PushMode/PopMode solution // not working yet... this needs a little work DCUpdate(); #ifdef __WIN__ SetWindowCursorForReal(); #endif LastEvent = GetNextEvent( true ); } rc = DoLastEvent(); if( EditFlags.ReadOnlyError && rc <= ERR_NO_ERR ) { EditFlags.ReadOnlyError = false; rc = ERR_READ_ONLY_FILE_MODIFIED; } if( rc > ERR_NO_ERR ) { msg = GetErrorMsg( rc ); } DoneLastEvent( rc, false ); if( rc > ERR_NO_ERR ) { Error( msg ); } } } /* EditMain */
/* * ResizeWindow - give a window a new size */ vi_rc ResizeWindow( window_id wn, int x1, int y1, int x2, int y2, int scrflag ) { wind *tmp, *w; int bt, k; // char *txt, *tptr; // char *ot; // int i, j; w = AccessWindow( wn ); if( !ValidDimension( x1, y1, x2, y2, w->has_border ) ) { ReleaseWindow( w ); return( ERR_WIND_INVALID ); } tmp = AllocWindow( x1, y1, x2, y2, w->has_border, w->border_color1, w->border_color2, w->text_color, w->background_color ); tmp->id = wn; tmp->has_gadgets = w->has_gadgets; // txt = MemAlloc( w->width + 1 ); // tptr = txt; RestoreOverlap( wn, scrflag ); Windows[wn] = tmp; tmp->accessed = TRUE; ResetOverlap( tmp ); MarkOverlap( wn ); /* * display the new text */ k = 1; bt = (int) w->has_border; ClearWindow( wn ); if( w->title != NULL ) { WindowTitle( wn, w->title ); } else { DrawBorder( wn ); } #if 0 for( j = bt; j < w->height - bt; j++ ) { ot = &(w->text[(j * w->width) * sizeof( char_info )]); for( i = bt; i < w->width - bt; i++ ) { *txt++ = ot[i * sizeof( char_info )]; } *txt = 0; DisplayLineInWindow( wn, k++, tptr ); txt = tptr; } #else DCResize( CurrentInfo ); DCDisplayAllLines(); DCUpdate(); #endif FreeWindow( w ); ReleaseWindow( tmp ); return( ERR_NO_ERR ); } /* ResizeWindow */
/* * FindRegularExpression - do a forward search for a regular expression */ vi_rc FindRegularExpression( char *pat, i_mark *pos1, char **linedata, linenum termline, find_type flags ) { vi_rc rc; int found; linenum ilineno = 0; bool wrapped = false; char *data; line *cline; fcb *cfcb; int scol; linenum sline; /* * initialize for search */ if( wrapMsgPrinted ) { wrapMsgPrinted = false; ClearWindow( message_window_id ); } sline = pos1->line; if( flags & FINDFL_WRAP ) { ilineno = sline; } rc = CGimmeLinePtr( sline, &cfcb, &cline ); if( rc != ERR_NO_ERR ) { return( rc ); } scol = pos1->column; if( pat != NULL ) { rc = CurrentRegComp( pat ); if( rc != ERR_NO_ERR ) { return( rc ); } } /* * loop until string found */ data = &cline->data[scol]; while( (found = RegExec( CurrentRegularExpression, data, (data == cline->data) )) == 0 ) { if( RegExpError != ERR_NO_ERR ) { return( RegExpError ); } /* * get next line */ rc = CGimmeNextLinePtr( &cfcb, &cline ); if( rc == ERR_NO_ERR ) { ++sline; } else if( rc == ERR_NO_MORE_LINES ) { if( (flags & FINDFL_WRAP) == 0 ) { return( ERR_FIND_END_OF_FILE ); } else { Message1( wrapMsg, "bottom" ); MyBeep(); wrapMsgPrinted = true; } if( wrapped ) { return( ERR_FIND_NOT_FOUND ); } sline = 1; rc = CGimmeLinePtr( sline, &cfcb, &cline ); if( rc != ERR_NO_ERR ) { return( rc ); } wrapped = true; } else { return( rc ); } if( sline > termline ) { return( ERR_FIND_PAST_TERM_LINE ); } if( wrapped ) { if( sline > ilineno ) { return( ERR_FIND_NOT_FOUND ); } } scol = 0; data = cline->data; } *linedata = cline->data; pos1->column = GetCurrRegExpColumn( cline->data ); pos1->line = sline; return( ERR_NO_ERR ); } /* FindRegularExpression */
/** Override of base class pure virtual Our implementation only gets called if the base class doTestStepPreambleL() did not leave. That being the case, the current test result value will be EPass. @return - TVerdict code */ TVerdict CAlphaBlendTest::doTestStepL(TBool aIType) { RWsSession wsSession; User::LeaveIfError(wsSession.Connect()); CleanupClosePushL(wsSession); // // Uncomment to debug WSERV redraw problems. // wsSession.SetAutoFlush(ETrue); CWsScreenDevice* windowDevice = new (ELeave) CWsScreenDevice(wsSession); CleanupStack::PushL(windowDevice); User::LeaveIfError(windowDevice->Construct()); CWindowGc* windowGc=NULL; User::LeaveIfError(windowDevice->CreateContext(windowGc)); // create graphics context CleanupStack::PushL(windowGc); RWindowGroup group; group = RWindowGroup(wsSession); CleanupClosePushL(group); User::LeaveIfError(group.Construct(1, EFalse)); RWindow background; background = RWindow(wsSession); CleanupClosePushL(background); User::LeaveIfError(background.Construct(group, 2)); RWindow window; window = RWindow(wsSession); CleanupClosePushL(window); User::LeaveIfError(window.Construct(group, 3)); TSize windowSize = windowDevice->SizeInPixels(); TDisplayMode windowMode = windowDevice->DisplayMode(); background.Activate(); background.Invalidate(); ClearWindow(wsSession, background, windowGc, BLACK_SEMI_TRANSPARENT); ClearWindow(wsSession, window, windowGc, BLACK_SEMI_TRANSPARENT); window.SetTransparencyAlphaChannel(); window.Activate(); window.Invalidate(); if (aIType) { if (CheckMonoTypeInstalledL()) DoDrawBlendedTestsL(EBlendTestDrawTextIType,wsSession, KDrawVertTextIterationsToTest); else { INFO_PRINTF1(_L("Monotype fonts not installed, skipping test")); } } else { /* Test speed of blended draw rects on all modes supporting alpha blending */ DoDrawBlendedTestsL(EBlendTestDrawRect,wsSession, KDrawRectIterationsToTest); /* Test speed of blended draw vertical line calls on all modes supporting alpha blending */ DoDrawBlendedTestsL(EBlendTestVerticalLine,wsSession, KDrawVertLineIterationsToTest); /* Test speed of blended draw text calls on all modes supporting alpha blending */ DoDrawBlendedTestsL(EBlendTestDrawText,wsSession, KDrawTextIterationsToTest); DoDrawBlendedTestsL(EBlendTestDrawTextAntiAliased,wsSession, KDrawVertTextIterationsToTest); DoDrawBlendedTestsL(EBlendTestDrawVerticalText,wsSession, KDrawVertTextIterationsToTest); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0022 @SYMTestCaseDesc Alphablend test BITBLT with EColor16MA source and EColor16MU destination. @SYMTestActions Compare the results over time @SYMTestExpectedResults */ RDebug::Printf("Alpha Tests: EColor16MU, EColor16MA"); RDebug::Printf("Alpha Blend"); SetTestStepID(_L("GRAPHICS-UI-BENCH-0022")); DoAlphaBlendBitmapsBitmapTestL(EColor16MA, EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0023 @SYMTestCaseDesc Test BITBLT with EColor16MA source and EColor16MU destination. @SYMTestActions Compare the results over time @SYMTestExpectedResults */ RDebug::Printf("BitBlt Alpha"); SetTestStepID(_L("GRAPHICS-UI-BENCH-0023")); DoBitBltAlphaBitmapTestL(EColor16MA, EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0024 @SYMTestCaseDesc Alpha blend test BITBLT with EColor16MA source and EColor16MA destination. @SYMTestActions Compare the results over time @SYMTestExpectedResults */ RDebug::Printf("Alpha Tests: EColor16MA, EColor16MA"); RDebug::Printf("Alpha Blend"); SetTestStepID(_L("GRAPHICS-UI-BENCH-0024")); DoAlphaBlendBitmapsBitmapTestL(EColor16MA,EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0025 @SYMTestCaseDesc Test BITBLT with EColor16MA source and EColor16MA destination. @SYMTestActions Compare the results over time @SYMTestExpectedResults */ RDebug::Printf("BitBlt Alpha"); SetTestStepID(_L("GRAPHICS-UI-BENCH-0025")); DoBitBltAlphaBitmapTestL(EColor16MA, EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0063 @SYMTestCaseDesc Test BITBLT with EColor16MAP source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0063")); DoNormalBitBltL(EFalse, EColor16MAP,EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0064 @SYMTestCaseDesc Test BITBLT with EColor16MA source and EColor16MA destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0064")); DoNormalBitBltL(EFalse, EColor16MA,EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0065 @SYMTestCaseDesc Test BITBLT with EColor16MAP source and EColor16MA destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0065")); DoNormalBitBltL(EFalse, EColor16MAP,EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0066 @SYMTestCaseDesc Test BITBLT with EColor16MA source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0066")); DoNormalBitBltL(EFalse, EColor16MA,EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0067 @SYMTestCaseDesc Test BITBLT with EColor16MU source and EColor16MU destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0067")); DoNormalBitBltL(EFalse, EColor16MU,EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0068 @SYMTestCaseDesc Test BITBLT with EColor16MAP source and EColor16MU destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0068")); DoNormalBitBltL(EFalse, EColor16MAP,EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0069 @SYMTestCaseDesc Test BITBLT with EColor16MU source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0069")); DoNormalBitBltL(EFalse, EColor16MU,EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0070 @SYMTestCaseDesc Test BITBLT with EColor64K source and EColor16MU destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0070")); DoNormalBitBltL(ETrue, EColor64K,EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0071 @SYMTestCaseDesc Test DrawBitmap with different sizes (STRETCHED) with EColor16MAP source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0071")); DoDrawBitmapL(EFalse, EColor16MAP, EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0072 @SYMTestCaseDesc Test DrawBitmap with different sizes (STRETCHED) with EColor16MA source and EColor16MA destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0072")); DoDrawBitmapL(EFalse, EColor16MA, EColor16MA, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0073 @SYMTestCaseDesc Test DrawBitmap (using alpha mask) with different sizes (STRETCHED) with EColor16MU source and EColor16MU destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0073")); DoDrawBitmapL(ETrue, EColor16MU, EColor16MU, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); /** @SYMTestCaseID GRAPHICS-UI-BENCH-0057 @SYMTestCaseDesc Test DrawBitmap (using alpha mask) with different sizes (STRETCHED) with EColor16MAP source and EColor16MAP destination. @SYMTestActions Compare the results over several iterations over time. @SYMTestExpectedResults */ SetTestStepID(_L("GRAPHICS-UI-BENCH-0057")); DoDrawBitmapL(ETrue, EColor16MAP, EColor16MAP, wsSession, window, windowGc, KIterationsToTest); RecordTestResultL(); } CleanupStack::PopAndDestroy(6, &wsSession); return TestStepResult(); }
int Game(int port, const char *ApplicationPath) { // Variabeln definieren char Name[20]; // Array für Spielername int Zeichen; // Variable zur Verarbeitung der eingelesenen Zeichen int key; // Variable zum einlesen der Zeichen von der Tastatur int dir = 0; // Variable zum speichern der Richtung int dir_old = 0; // Variable zum speichern der letzten Richtung int score; // Variable für den Score int winner; // Variable für Rückgabewert der Highscorefunktion // Wird 1 wenn Highscore geknackt wurde, sonst 0 int i = 0; // Bildschirm löschen ClearWindow(); // Spielernamen einlesen SelectFont("Arial MS", 15, FONT_NORMAL); DrawTextXY (50, 50, COL_GREEN, "Bitte Namen eingeben:"); while((key = GetKeyPress()) != W_KEY_RETURN ){ Zeichen = key; // Anzahl der Zeichen begrenzen, Leertaste unterdrücken if ((Zeichen >= ' ')&&(i < 19) && (Zeichen != 0x20) ){ Name[i] = Zeichen; Name[i+1] = '\0'; i++; } // Möglichkeit Zeichen zu löschen if( Zeichen == '\b'){ if(i>0){ i--; Name[i]='\0'; DrawFilledRectangle(270, 25, 300, 40, COL_BLACK, 1); } } // Bisherige Eingabe anzeigen DrawTextXY (270, 50, COL_RED, Name); } DrawTextXY (50, 80, COL_GREEN, "Now playing! [ESC] to escape"); if (InitSerialPort(port, Bd9600, P_NONE, 8, 1) == 0) // COM1 { printf("\nPort opened: COM%d", port); do { if(IsKeyPressReady()) // Wenn Taste gedrückt { key = GetKeyPress(); switch(key) { case W_KEY_CURSOR_UP: if(dir_old != 'd') { dir = 'u'; } break; case W_KEY_CURSOR_DOWN: if(dir_old != 'u') { dir = 'd'; } break; case W_KEY_CURSOR_LEFT: if(dir_old != 'r') { dir = 'l'; } break; case W_KEY_CURSOR_RIGHT: if(dir_old != 'l') { dir = 'r'; } break; case W_KEY_ESCAPE: case W_KEY_CLOSE_WINDOW: ShutdownSerialPort(); return 0; break; default: key = NO_VALID_KEY; break; } // Nur wenn Key gültig ist und der Wert geändert hat ein Zeichen ans Carmekit senden if(dir != dir_old) { SendByteToSerialPort(dir); // Alter Wert speichern dir_old = dir; } } score = GetByteFromSerialPort(); } while (score == -1); ShutdownSerialPort(); winner=highscore(Name , score , ApplicationPath); SelectFont("Arial MS", 20, FONT_ITALIC); if(winner == 1) { DrawTextXY (220, 200, COL_GREEN, "Du hast den High Score geknackt!"); } else { DrawTextXY (220, 200, COL_GREEN, "Game over."); } SelectFont("Arial MS", 15, FONT_NORMAL); DrawTextXY (220, 230, COL_GREEN, "Press any key to continue."); while(!IsKeyPressReady()) ; } return 0; }
//Our main loop which should continue running as long as we don't quite the game static void MainLoop() { char DLLFilePath[MAX_PATH]; char *onePastLastSlash; DWORD pathSize = GetModuleFileNameA(NULL, DLLFilePath, sizeof(DLLFilePath)); onePastLastSlash = DLLFilePath; for (char *scan = DLLFilePath; *scan; scan++) { if (*scan == '\\') { onePastLastSlash = scan + 1; } } char DLLFullPath[MAX_PATH]; BuildFileFullPath(&state, "playground game.dll", DLLFullPath, sizeof(DLLFullPath)); char tempDLLFullPath[MAX_PATH]; BuildFileFullPath(&state, "playground game_temp.dll", tempDLLFullPath, sizeof(tempDLLFullPath)); char PDBFullPath[MAX_PATH]; BuildFileFullPath(&state, "playground game.pdb", PDBFullPath, sizeof(PDBFullPath)); char tempPDBFullPath[MAX_PATH]; BuildFileFullPath(&state, "playground game_temp.pdb", tempPDBFullPath, sizeof(tempPDBFullPath)); Input = {}; Input.UP.Button = VK_UP; Input.DOWN.Button = VK_DOWN; Input.RIGHT.Button = VK_RIGHT; Input.LEFT.Button = VK_LEFT; LARGE_INTEGER performanceFrequency; QueryPerformanceFrequency(&performanceFrequency); TicksPerSecond = performanceFrequency.QuadPart; int monitorRefreshHZ = 60; HDC deviceContext = GetDC(Window.Window); int refreshHz = GetDeviceCaps(deviceContext, VREFRESH); ReleaseDC(Window.Window, deviceContext); if (refreshHz > 1) { monitorRefreshHZ = refreshHz; } float gameUpdateHZ = (float)(monitorRefreshHZ); float targetSecondsPerFrame = 1.0f / gameUpdateHZ; UINT desiredSchedulerTime = 1; bool sleepIsSmaller = true;//timeBeginPeriod(desiredSchedulerTime) == TIMERR_NOERROR; LARGE_INTEGER lastTick = GetTicks(); float updateTime = 0; int updates = 0; double frames = 0; double frameTime = 0; while (IsRunning) { /* start_loop = clock(); */ FILETIME newWriteTimeDLL = GetLastWriteTime(DLLFullPath); FILETIME newWriteTimePDB = GetLastWriteTime(PDBFullPath); if (CompareFileTime(&newWriteTimeDLL, &Game.LastWriteTimeDLL) != 0 && CompareFileTime(&newWriteTimeDLL, &Game.LastWriteTimePDB) != 0) { UnloadGameCode(&Game); CopyFile(PDBFullPath, tempPDBFullPath, FALSE); Game = LoadGameCode(DLLFullPath, tempDLLFullPath); Game.Game_Init(Dimensions); } LARGE_INTEGER gameTimerStart = GetTicks(); ProcessPendingMessages(&Keys); ProcessInput(&Input); //Update everything //Update the game Game.Game_Update(&Input); /*NOTE(kai): TEST ONLY*/ //Testing if A button is pressed if (IsKeyDown(&Keys, 'A')) { OutputDebugString("Key: a is pressed\n"); } //Testing if A button is released if (IsKeyUp(&Keys, 'A')) { OutputDebugString("Key: a is released\n"); } //Render everything //Clear the window ClearWindow(); //Render the game Game.Game_Render(); LARGE_INTEGER gameTimerEnd = GetTicks(); frameTime += (double)(1000.0f * GetSecondsElapsed(gameTimerStart, gameTimerEnd)); frames++; //frames += 1000.0f / (double)(1000.0f * GetSecondsElapsed(gameTimerStart, gameTimerEnd)); //PrintTimeElapsed(lastTick, gameTimerEnd); float secondsElapsedForFrame = GetSecondsElapsed(lastTick, GetTicks()); if (secondsElapsedForFrame < targetSecondsPerFrame) { if (sleepIsSmaller) { DWORD sleepTime = (DWORD)(1000.0f * (targetSecondsPerFrame - secondsElapsedForFrame)); if (sleepTime > 0) { Sleep(sleepTime); } } while (secondsElapsedForFrame < targetSecondsPerFrame) { secondsElapsedForFrame = GetSecondsElapsed(lastTick, GetTicks()); } updates++; } updateTime += GetSecondsElapsed(lastTick, GetTicks()); if (updateTime >= 1.0f) { double avgFPS = 1000.0f / ((frameTime) / frames); std::cout << "UPS: " << updates << ", average FPS: " << avgFPS << ", average work/frame: " << (frameTime) / frames << "\n"; frames = 0; frameTime = 0; updates = 0; updateTime = 0; } LARGE_INTEGER endTick = GetTicks(); //PrintTimeElapsed(lastTick, endTick); lastTick = endTick; //Render the window RenderWindow(Window.Window); /* //calc fps calcfps(); static int framecount = 0; framecount++; if (framecount == 10) { framecount = 0; std::cout << "frame per second is : " << (fps) << std::endl; } //QueryPerformanceCounter(&t_current_loop); end_loop = clock(); //float frameticks = (t_current_loop.QuadPart - t_previous_loop.QuadPart) / ((frequency_loop.QuadPart) / 1000.0); float frameticks = ((float)(end_loop - start_loop) / CLOCKS_PER_SEC) * 1000.0f; //print the current fps // std::cout << 1000/frameticks << std::endl; if (1000.0f / max_fps > frameticks){ Sleep(1000.0f / max_fps - frameticks); } */ } //Release resources (if there is any) and destory the window Release(); }
/* * Substitute - perform substitution */ vi_rc Substitute( linenum n1, linenum n2, char *data ) { char *sstr, *rstr, *newr; char flag[20], *linedata; bool iflag = false; bool gflag = false; bool undoflag = false; bool restline = false; bool splitpending = false; bool undoline = false; int i, rlen, slen; bool splitme; long changecnt = 0, linecnt = 0; linenum llineno, ll, lastline = 0, extra; i_mark pos; vi_rc rc; LastSubstituteCancelled = 0; LastChangeCount = 0; LastLineCount = 0; sstr = alloca( MAX_INPUT_LINE ); if( sstr == NULL ) { return( ERR_NO_STACK ); } strcpy( sstr, data ); rc = ModificationTest(); if( rc != ERR_NO_ERR ) { return( rc ); } strcpy( data, sstr ); rstr = alloca( MAX_INPUT_LINE ); if( rstr == NULL ) { return( ERR_NO_STACK ); } if( NextWordSlash( data, sstr ) < 0 ) { return( ERR_INVALID_SUBS_CMD ); } if( NextWordSlash( data, rstr ) < 0 ) { return( ERR_INVALID_SUBS_CMD ); } slen = NextWord1( data, flag ); for( i = 0; i < slen; i++ ) { switch( flag[i] ) { case 'g': gflag = true; break; case 'i': case 'c': iflag = true; break; } } rc = CurrentRegComp( sstr ); if( rc != ERR_NO_ERR ) { return( rc ); } /* * verify last line */ if( n2 > CurrentFile->fcbs.tail->end_line ) { rc = CFindLastLine( &ll ); if( rc != ERR_NO_ERR ) { return( rc ); } if( n2 > ll ) { return( ERR_INVALID_LINE_RANGE ); } } /* * set for start of search */ if( EditFlags.Verbose && EditFlags.EchoOn ) { ClearWindow( MessageWindow ); } SaveCurrentFilePos(); llineno = n1 - 1; EditFlags.AllowRegSubNewline = true; newr = StaticAlloc(); for( pos.column = 0, pos.line = n1; pos.line <= n2; nextSearchStartPos( &pos, gflag, rlen ) ) { /* * get regular expression, and build replacement string */ rc = FindRegularExpression( NULL, &pos, &linedata, n2, 0 ); if( rc != ERR_NO_ERR || pos.line > n2 ) { break; } slen = GetCurrRegExpLength(); splitme = RegSub( CurrentRegularExpression, rstr, newr, pos.line ); rlen = strlen( newr ); ProcessingMessage( pos.line ); /* * if in global mode, see if we already have an undo for * this line */ if( gflag ) { if( lastline != pos.line ) { undoline = false; } } /* * interactive mode? yes, then display text and ask to change */ if( iflag ) { change_resp rsp; if( !restline ) { ClearWindow( MessageWindow ); } restline = true; GoToLineNoRelCurs( pos.line ); if( EditFlags.GlobalInProgress ) { EditFlags.DisplayHold = false; DCDisplayAllLines(); EditFlags.DisplayHold = true; } HilightSearchString( &pos, slen ); rsp = ChangePrompt(); if( rsp == CHANGE_NO ) { ResetDisplayLine(); rlen = 1; continue; } else if( rsp == CHANGE_CANCEL ) { ResetDisplayLine(); LastSubstituteCancelled = 1; break; } else if( rsp == CHANGE_ALL ) { ResetDisplayLine(); iflag = false; } } /* * set up for global undo if we haven't already */ if( !undoflag ) { StartUndoGroup( UndoStack ); undoflag = true; } /* * bump change counts */ changecnt++; if( llineno != pos.line ) { if( splitpending ) { splitpending = false; extra = SplitUpLine( llineno ); n2 += extra; pos.line += extra; } linecnt++; llineno = pos.line; } /* * get copy of line, and verify that new stuff fits */ CurrentPos.line = pos.line; rc = CGimmeLinePtr( pos.line, &CurrentFcb, &CurrentLine ); if( rc != ERR_NO_ERR ) { break; } if( CurrentLine->len + rlen - slen >= EditVars.MaxLine ) { rc = ERR_LINE_FULL; break; } /* * now build the individual undo */ CurrentFcb->non_swappable = true; if( !undoline ) { CurrentLineReplaceUndoStart(); CurrentLineReplaceUndoEnd( true ); if( gflag ) { undoline = true; lastline = pos.line; } } /* * remove the old string */ GetCurrentLine(); WorkLine->len = ReplaceSubString( WorkLine->data, WorkLine->len, pos.column, pos.column + slen - 1, newr, rlen ); if( iflag ) { DisplayWorkLine( true ); } ReplaceCurrentLine(); /* * if not global, only do this change on this line */ if( splitme ) { splitpending = true; } CurrentFcb->non_swappable = false; } StaticFree( newr ); EditFlags.AllowRegSubNewline = false; /* * is there still a split line pending? */ if( splitpending ) { SplitUpLine( llineno ); } RestoreCurrentFilePos(); if( restline ) { SetCurrentLine( CurrentPos.line ); GoToColumnOK( CurrentPos.column ); } if( undoflag ) { EndUndoGroup( UndoStack ); } switch( rc ) { case ERR_NO_ERR: case ERR_LINE_FULL: case ERR_FIND_PAST_TERM_LINE: case ERR_FIND_NOT_FOUND: case ERR_FIND_END_OF_FILE: /* * display results */ if( rc == ERR_LINE_FULL ) { Message1( "Stopped at line %l - line full", pos.line ); } else { Message1( "%l changes on %l lines", changecnt, linecnt ); LastLineCount = linecnt; LastChangeCount = changecnt; } DCDisplayAllLines(); rc = ERR_NO_ERR; break; default: break; } return( rc ); } /* Substitute */
/* * FindRegularExpressionBackwards - do a reverse search for a regular expression */ vi_rc FindRegularExpressionBackwards( char *pat, i_mark *pos1, char **linedata, linenum termline, find_type flags ) { vi_rc rc; char *data; bool wrapped = false; bool found; linenum ilineno = 0; line *cline; fcb *cfcb; regexp rcpy; int scol; linenum sline; /* * initialize for search */ if( wrapMsgPrinted ) { wrapMsgPrinted = false; ClearWindow( message_window_id ); } sline = pos1->line; rc = CGimmeLinePtr( sline, &cfcb, &cline ); if( rc != ERR_NO_ERR ) { return( rc ); } if( flags & FINDFL_WRAP ) { ilineno = sline; } scol = pos1->column; if( pat != NULL ) { rc = CurrentRegComp( pat ); if( rc != ERR_NO_ERR ) { return( rc ); } } memset( &rcpy, 0, sizeof( rcpy ) ); /* * loop until string found */ for( ;; ) { data = cline->data; found = false; /* * run through all possible matches on the line, accepting * only the last one */ if( scol >= 0 ) { while( *data != '\0' && RegExec( CurrentRegularExpression, data, (data == cline->data) ) ) { int col, len; if( RegExpError != ERR_NO_ERR ) { return( RegExpError ); } col = GetCurrRegExpColumn( cline->data ); len = GetCurrRegExpLength(); if( col + len > scol ) { break; } found = true; memcpy( &rcpy, CurrentRegularExpression, sizeof( regexp ) ); data = &(cline->data[col + 1]); } if( found ) { break; } } /* * get next line */ rc = GimmePrevLinePtr( &cfcb, &cline ); if( rc == ERR_NO_ERR ) { --sline; } else if( rc == ERR_NO_MORE_LINES ) { if( (flags & FINDFL_WRAP) == 0 ) { return( ERR_FIND_TOP_OF_FILE ); } else { Message1( wrapMsg, "top" ); MyBeep(); wrapMsgPrinted = true; } if( wrapped ) { return( ERR_FIND_NOT_FOUND ); } rc = CFindLastLine( &sline ); if( rc != ERR_NO_ERR ) { return( rc ); } rc = CGimmeLinePtr( sline, &cfcb, &cline ); if( rc != ERR_NO_ERR ) { return( rc ); } wrapped = true; } else { return( rc ); } if( sline < termline ) { return( ERR_FIND_PAST_TERM_LINE ); } if( wrapped ) { if( sline < ilineno ) { return( ERR_FIND_NOT_FOUND ); } } scol = cline->len; } *linedata = cline->data; memcpy( CurrentRegularExpression, &rcpy, sizeof( regexp ) ); pos1->column = GetCurrRegExpColumn( cline->data ); pos1->line = sline; return( ERR_NO_ERR ); } /* FindRegularExpressionBackwards */
/* * processSetToken - set value for set token */ static vi_rc processSetToken( int j, char *value, int *winflag, bool isnonbool ) { char fn[MAX_STR], str[MAX_STR]; #ifndef VICOMP char tmp[3]; char settokstr[TOK_MAX_LEN + 1]; char save[MAX_STR]; vi_rc rc = ERR_NO_ERR; int i, clr, k; bool newset; bool set1, toggle, *ptr; jmp_buf jmpaddr; cursor_type ct; char *name; command_rtn fptr; event_bits eb; bool redisplay = FALSE; #endif bool bvalue; #ifdef VICOMP winflag = winflag; isnonbool = isnonbool; #endif /* * set up value for boolean set commands */ if( j < 0 ) { j *= -1; bvalue = FALSE; } else { bvalue = TRUE; } #ifndef VICOMP if( !(*winflag) ) { toggle = TRUE; set1 = isnonbool; } else { toggle = FALSE; #endif if( j >= SET1_T_ ) { #ifndef VICOMP if( EditFlags.CompileScript ) { #endif if( !bvalue ) { j *= -1; } itoa( j, str, 10 ); StrMerge( 2, WorkLine->data, str, SingleBlank ); return( ERR_NO_ERR ); #ifndef VICOMP } set1 = FALSE; j -= SET1_T_; } else { set1 = TRUE; #endif } #ifndef VICOMP } *winflag = FALSE; /* * process boolean settings */ if( !set1 ) { if( j >= SET2_T_ ) { return( ERR_INVALID_SET_COMMAND ); } ptr = &(((bool *)&EditFlags)[j]); newset = bvalue; if( toggle ) { newset = !(*ptr); } switch( j ) { case SET2_T_MODELESS: if( (newset && !EditFlags.Modeless) || (!newset && EditFlags.Modeless) ) { for( k = 0; k < MAX_EVENTS; k++ ) { fptr = EventList[k].rtn; eb = EventList[k].b; EventList[k].rtn = EventList[k].alt_rtn; EventList[k].alt_rtn = fptr; EventList[k].b = EventList[k].alt_b; EventList[k].alt_b = eb; } if( !EditFlags.Modeless ) { if( MenuWindow != NO_WINDOW ) { UpdateCurrentStatus( CSTATUS_INSERT ); } EditFlags.WasOverstrike = FALSE; NewCursor( CurrentWindow, EditVars.InsertCursorType ); } else { if( MenuWindow != NO_WINDOW ) { UpdateCurrentStatus( CSTATUS_COMMAND ); } NewCursor( CurrentWindow, EditVars.NormalCursorType ); // nomodeless must be line based or it dies! EditFlags.LineBased = TRUE; } /* re-position cursor in window */ SetWindowCursor(); } EditFlags.Modeless = newset; break; case SET2_T_UNDO: if( EditFlags.Undo && !newset ) { FreeAllUndos(); } EditFlags.Undo = newset; break; case SET2_T_STATUSINFO: EditFlags.StatusInfo = newset; #ifdef __WIN__ ResizeRoot(); #endif rc = NewStatusWindow(); break; case SET2_T_WINDOWGADGETS: EditFlags.WindowGadgets = newset; ResetAllWindows(); *winflag = TRUE; redisplay = TRUE; break; case SET2_T_REALTABS: EditFlags.RealTabs = newset; redisplay = TRUE; break; case SET2_T_CLOCK: EditFlags.Clock = newset; redisplay = TRUE; break; case SET2_T_TOOLBAR: EditFlags.Toolbar = newset; #ifdef __WIN__ ResizeRoot(); #endif break; case SET2_T_COLORBAR: EditFlags.Colorbar = newset; #ifdef __WIN__ if( Root == NULL ) { EditFlags.Colorbar = FALSE; } else { RefreshColorbar(); } #endif break; case SET2_T_SSBAR: EditFlags.SSbar = newset; #ifdef __WIN__ if( Root == NULL ) { EditFlags.SSbar = FALSE; } else { RefreshSSbar(); } #endif break; case SET2_T_FONTBAR: EditFlags.Fontbar = newset; #ifdef __WIN__ if( Root == NULL ) { EditFlags.Fontbar = FALSE; } else { RefreshFontbar(); } #endif break; case SET2_T_MARKLONGLINES: EditFlags.MarkLongLines = newset; break; case SET2_T_MENUS: EditFlags.Menus = newset; InitMenu(); break; case SET2_T_LINENUMBERS: if( toggle ) { newset = !EditFlags.LineNumbers; } if( newset != EditFlags.LineNumbers ) { EditFlags.LineNumbers = newset; rc = LineNumbersSetup(); *winflag = TRUE; } break; case SET2_T_CURRENTSTATUS: EditFlags.CurrentStatus = newset; InitMenu(); break; case SET2_T_DISPLAYSECONDS: EditFlags.DisplaySeconds = newset; redisplay = TRUE; break; case SET2_T_PPKEYWORDONLY: EditFlags.PPKeywordOnly = newset; redisplay = TRUE; break; case SET2_T_LASTEOL: #ifndef __WIN__ *ptr = TRUE; toggle = FALSE; break; #endif default: *ptr = newset; break; } if( msgFlag ) { if( !newset ) { tmp[0] = 'n'; tmp[1] = 'o'; tmp[2] = 0; } else { tmp[0] = 0; } MySprintf( fn, "%s%s set", tmp, GetTokenStringCVT( SetTokens2, j, settokstr, TRUE ) ); } if( toggle ) { strcpy( save, BoolStr[(int) newset] ); (*winflag) += 1; } /* * process value settings */ } else { if( toggle ) { rc = GetNewValueDialog( value ); if( rc != ERR_NO_ERR ) { return( rc ); } strcpy( save, value ); } #endif /* VICOMP */ RemoveLeadingSpaces( value ); if( value[0] == '"' ) { NextWord( value, fn, "\"" ); EliminateFirstN( value, 1 ); } else { NextWord1( value, fn ); } #ifndef VICOMP if( EditFlags.CompileScript ) { #endif itoa( j, str, 10 ); strcat( WorkLine->data, str ); if( fn[0] == '\0' ) return( ERR_NO_ERR ); switch( j ) { case SET1_T_STATUSSTRING: case SET1_T_FILEENDSTRING: case SET1_T_HISTORYFILE: case SET1_T_TMPDIR: case SET1_T_TAGFILENAME: StrMerge( 4, WorkLine->data, SingleBlank, SingleQuote, fn, SingleQuote ); break; case SET1_T_COMMANDCURSORTYPE: case SET1_T_OVERSTRIKECURSORTYPE: case SET1_T_INSERTCURSORTYPE: StrMerge( 2, WorkLine->data, SingleBlank, fn ); if( NextWord1( value, fn ) <= 0 ) { break; } StrMerge( 2, WorkLine->data, SingleBlank, fn ); break; case SET1_T_TILECOLOR: StrMerge( 2, WorkLine->data, SingleBlank, fn ); if( NextWord1( value, fn ) <= 0 ) { return( ERR_INVALID_SET_COMMAND ); } if( NextWord1( value, str ) <= 0 ) { return( ERR_INVALID_SET_COMMAND ); } StrMerge( 4, WorkLine->data, fn, SingleBlank, str, SingleBlank ); break; case SET1_T_STATUSSECTIONS: StrMerge( 2, WorkLine->data, SingleBlank, fn ); while( NextWord1( value, fn ) > 0 ) { #ifdef VICOMP int k; #endif k = atoi( fn ); if( k <= 0 ) { break; } StrMerge( 2, WorkLine->data, SingleBlank, fn ); } break; default: StrMerge( 2, WorkLine->data, SingleBlank, fn ); break; } return( ERR_NO_ERR ); #ifndef VICOMP } switch( j ) { case SET1_T_STATUSSECTIONS: if( EditVars.StatusSections != NULL ) { MemFree( EditVars.StatusSections ); EditVars.StatusSections = NULL; EditVars.NumStatusSections = 0; } for( ;; ) { k = atoi( fn ); if( k <= 0 ) { break; } EditVars.StatusSections = MemReAlloc( EditVars.StatusSections, sizeof( short ) * (EditVars.NumStatusSections + 1) ); EditVars.StatusSections[EditVars.NumStatusSections] = k; EditVars.NumStatusSections++; if( NextWord1( value, fn ) <= 0 ) { break; } } if( EditVars.StatusSections == NULL ) { MySprintf( fn, "statussections turned off" ); } else { MySprintf( fn, "statussections set" ); } break; case SET1_T_FILEENDSTRING: AddString2( &EditVars.FileEndString, fn ); ResetAllWindows(); redisplay = TRUE; break; case SET1_T_STATUSSTRING: AddString2( &EditVars.StatusString, fn ); if( StatusWindow != NO_WINDOW ) { ClearWindow( StatusWindow ); UpdateStatusWindow(); } if( msgFlag ) { MySprintf( fn, "statusstring set to %s", EditVars.StatusString ); } break; case SET1_T_GREPDEFAULT: AddString2( &EditVars.GrepDefault, fn ); break; case SET1_T_TILECOLOR: if( EditVars.TileColors == NULL ) { EditVars.TileColors = (type_style *) MemAlloc( sizeof( type_style ) * ( EditVars.MaxTileColors + 1 ) ); for( i = 0; i <= EditVars.MaxTileColors; ++i ) { EditVars.TileColors[i].foreground = -1; EditVars.TileColors[i].background = -1; EditVars.TileColors[i].font = -1; } } clr = atoi( fn ); if( clr > EditVars.MaxTileColors ) { return( ERR_INVALID_SET_COMMAND ); } if( NextWord1( value, fn ) <= 0 ) { return( ERR_INVALID_SET_COMMAND ); } EditVars.TileColors[clr].foreground = atoi( fn ); if( NextWord1( value, fn ) <= 0 ) { return( ERR_INVALID_SET_COMMAND ); } EditVars.TileColors[clr].background = atoi( fn ); EditVars.TileColors[clr].font = FONT_DEFAULT; if( msgFlag ) { MySprintf( fn, "tilecolor %d set", clr ); } break; case SET1_T_GADGETSTRING: SetGadgetString( fn ); if( msgFlag ) { MySprintf( fn, "gadget string set to %s", EditVars.GadgetString ); } ResetAllWindows(); break; case SET1_T_SHELLPROMPT: AddString2( &EditVars.SpawnPrompt, fn ); if( msgFlag ) { MySprintf( fn, "prompt string set to %s", EditVars.SpawnPrompt ); } break; case SET1_T_FIGNORE: if( fn[0] == 0 ) { MemFreePtr( (void **)&EditVars.FIgnore ); EditVars.CurrFIgnore = 0; if( msgFlag ) { MySprintf( fn, "fignore reset" ); } } else { EditVars.FIgnore = MemReAlloc( EditVars.FIgnore, EXTENSION_LENGTH * (EditVars.CurrFIgnore + 1) ); str[0] = '.'; str[1] = 0; strcat( str, fn ); str[EXTENSION_LENGTH - 1] = 0; strcpy( &EditVars.FIgnore[EXTENSION_LENGTH * EditVars.CurrFIgnore], str ); EditVars.CurrFIgnore++; if( msgFlag ) { MySprintf( fn, "%s added to fignore", str ); } } break; case SET1_T_HISTORYFILE: AddString2( &EditVars.HistoryFile, fn ); if( msgFlag ) { MySprintf( fn, "history file set to %s", EditVars.HistoryFile ); } break; case SET1_T_TAGFILENAME: AddString2( &EditVars.TagFileName, fn ); if( msgFlag ) { MySprintf( fn, "tag file name set to %s", EditVars.TagFileName ); } break; case SET1_T_FILENAME: if( CurrentFile != NULL ) { AddString2( &(CurrentFile->name), fn ); SetFileWindowTitle( CurrentWindow, CurrentInfo, TRUE ); if( msgFlag ) { MySprintf( fn, "filename set to %s", CurrentFile->name ); } FileSPVAR(); } break; case SET1_T_TMPDIR: AddString2( &EditVars.TmpDir, fn ); VerifyTmpDir(); if( msgFlag ) { MySprintf( fn, "tmpdir set to %s", EditVars.TmpDir ); } break; case SET1_T_WORD: AddString2( &EditVars.WordDefn, fn ); InitWordSearch( EditVars.WordDefn ); if( msgFlag ) { MySprintf( fn, "word set to %s", EditVars.WordDefn ); } break; case SET1_T_WORDALT: AddString2( &EditVars.WordAltDefn, fn ); if( msgFlag ) { MySprintf( fn, "wordalt set to %s", EditVars.WordAltDefn ); } break; case SET1_T_MAGICSTRING: AddString2( &EditVars.Majick, fn ); if( msgFlag ) { MySprintf( fn, "magicstring set to %s", EditVars.Majick ); } break; case SET1_T_COMMANDCURSORTYPE: case SET1_T_OVERSTRIKECURSORTYPE: case SET1_T_INSERTCURSORTYPE: i = setjmp( jmpaddr ); if( i != 0 ) { return( ERR_INVALID_SET_COMMAND ); } StartExprParse( fn, jmpaddr ); ct.height = GetConstExpr(); if( NextWord1( value, fn ) <= 0 ) { ct.width = 100; } else { i = setjmp( jmpaddr ); if( i != 0 ) { return( ERR_INVALID_SET_COMMAND ); } StartExprParse( fn, jmpaddr ); ct.width = GetConstExpr(); } if( j == SET1_T_COMMANDCURSORTYPE ) { EditVars.NormalCursorType = ct; name = "command"; } else if( j == SET1_T_OVERSTRIKECURSORTYPE ) { EditVars.OverstrikeCursorType = ct; name = "overstrike"; } else { EditVars.InsertCursorType = ct; name = "insert"; } if( msgFlag ) { MySprintf( fn, "%s cursor type set to %d,%d", name, ct.height, ct.width ); } break; default: i = setjmp( jmpaddr ); if( i != 0 ) { return( ERR_INVALID_SET_COMMAND ); } StartExprParse( fn, jmpaddr ); i = GetConstExpr(); if( i < 0 ) { i = 0; } switch( j ) { case SET1_T_WRAPMARGIN: EditVars.WrapMargin = i; break; case SET1_T_CURSORBLINKRATE: SetCursorBlinkRate( i ); break; case SET1_T_MAXPUSH: EditVars.MaxPush = i; if( EditVars.MaxPush < 1 ) { EditVars.MaxPush = 1; } InitFileStack(); break; case SET1_T_RADIX: EditVars.Radix = i; break; case SET1_T_AUTOSAVEINTERVAL: EditVars.AutoSaveInterval = i; SetNextAutoSaveTime(); break; case SET1_T_LANGUAGE: if( i < LANG_NONE || i >= LANG_MAX ) { return( ERR_INVALID_SET_COMMAND ); } if( CurrentInfo != NULL ) { LangFini( CurrentInfo->fsi.Language ); LangInit( i ); redisplay = TRUE; } break; case SET1_T_MOVECOLOR: EditVars.MoveColor = i; break; case SET1_T_RESIZECOLOR: EditVars.ResizeColor = i; break; case SET1_T_MOUSEDCLICKSPEED: EditVars.MouseDoubleClickSpeed = i; break; case SET1_T_MOUSESPEED: SetMouseSpeed( i ); break; case SET1_T_MOUSEREPEATDELAY: EditVars.MouseRepeatDelay = i; break; case SET1_T_CURRENTSTATUSCOLUMN: EditVars.CurrentStatusColumn = i; InitMenu(); break; case SET1_T_ENDOFLINECHAR: EditVars.EndOfLineChar = i; break; case SET1_T_EXITATTR: EditVars.ExitAttr = (char) i; break; case SET1_T_INACTIVEWINDOWCOLOR: EditVars.InactiveWindowColor = i; break; case SET1_T_TABAMOUNT: EditVars.TabAmount = i; break; case SET1_T_SHIFTWIDTH: EditVars.ShiftWidth = i; break; case SET1_T_PAGELINESEXPOSED: EditVars.PageLinesExposed = i; break; case SET1_T_HARDTAB: EditVars.HardTab = i; redisplay = TRUE; break; case SET1_T_STACKK: if( EditFlags.Starting ) { EditVars.StackK = i; } break; case SET1_T_LINENUMWINWIDTH: EditVars.LineNumWinWidth = i; break; case SET1_T_MAXWINDOWTILEX: EditVars.MaxWindowTileX = i; break; case SET1_T_MAXWINDOWTILEY: EditVars.MaxWindowTileY = i; break; case SET1_T_MAXSWAPK: SwapBlockInit( i ); break; case SET1_T_MAXEMSK: #ifndef NOEMS EMSBlockInit( i ); #endif break; case SET1_T_MAXXMSK: #ifndef NOXMS XMSBlockInit( i ); #endif break; case SET1_T_MAXFILTERHISTORY: FilterHistInit( i ); break; case SET1_T_MAXCLHISTORY: CLHistInit( i ); break; case SET1_T_MAXFINDHISTORY: FindHistInit( i ); break; case SET1_T_MAXLASTFILESHISTORY: LastFilesHistInit( i ); break; case SET1_T_MAXTILECOLORS: k = (EditVars.TileColors == NULL) ? 0 : EditVars.MaxTileColors + 1; EditVars.MaxTileColors = i; EditVars.TileColors = MemReAlloc( EditVars.TileColors, sizeof( type_style ) * ( EditVars.MaxTileColors + 1 ) ); for( ; k <= EditVars.MaxTileColors; ++k ) { EditVars.TileColors[k].foreground = -1; EditVars.TileColors[k].background = -1; EditVars.TileColors[k].font = -1; } break; case SET1_T_CLOCKX: EditVars.ClockX = i; GetClockStart(); break; case SET1_T_CLOCKY: EditVars.ClockY = i; GetClockStart(); break; case SET1_T_SPINX: EditVars.SpinX = i; GetSpinStart(); break; case SET1_T_SPINY: EditVars.SpinY = i; GetSpinStart(); break; case SET1_T_MAXLINELEN: /* file save fails if 1 line is > MAX_IO_BUFFER */ i = __min( i, MAX_IO_BUFFER ); EditVars.MaxLine = i; StaticStart(); WorkLine = MemReAlloc( WorkLine, sizeof( line ) + EditVars.MaxLine + 2 ); break; case SET1_T_TOOLBARBUTTONHEIGHT: EditVars.ToolBarButtonHeight = i; #ifdef __WIN__ ResizeRoot(); #endif break; case SET1_T_TOOLBARBUTTONWIDTH: EditVars.ToolBarButtonWidth = i; #ifdef __WIN__ ResizeRoot(); #endif break; case SET1_T_TOOLBARCOLOR: EditVars.ToolBarColor = i; #ifdef __WIN__ if( GetToolbarWindow() != NULL ) { InvalidateRect( GetToolbarWindow(), NULL, TRUE ); UpdateWindow( GetToolbarWindow() ); } #endif break; default: return( ERR_INVALID_SET_COMMAND ); } if( msgFlag ) { MySprintf( fn, "%s set to %d", GetTokenStringCVT( SetTokens1, j, settokstr, TRUE ), i ); } break; } } if( msgFlag && rc == ERR_NO_ERR && !EditFlags.Quiet ) { setMessage( fn, redisplay ); rc = DO_NOT_CLEAR_MESSAGE_WINDOW; } if( rc == ERR_NO_ERR && toggle ) { strcpy( value, save ); } return( rc ); #endif /* VICOMP */ } /* processSetToken */
void IntroMessage(void) { ClearWindow(); DrawIntroMessage(); }
void ButtonPressAction(Graph *graph, XButtonPressedEvent *buttonevent) { float x, y; int sx1, sy1; int sx2, sy2; int button; sx1 = buttonevent->x; sy1 = buttonevent->y; button = buttonevent->button; switch (ButtonMode()) { case DATAMODE: switch (button) { case 1: /* * mark the start of the drag location */ graph->dragx1 = sx1; graph->dragy1 = sy1; break; case 2: ClearWindow((BasicWindow *)graph->frame->text); if (snapmode) { /* * world coord xy readout of data */ Snap(graph, sx1, sy1, &x, &y); /* * get the screen coords of the data point */ ScreenTransform(graph, x, y, &sx2, &sy2); ShowCoords((BasicWindow *)graph, sx2, sy2, x, y); /* * mark the start of the drag location */ graph->dragx1 = sx2; graph->dragy1 = sy2; } else { /* * world coord xy readout of cursor location */ WorldTransform(graph, sx1, sy1, &x, &y); ShowCoords((BasicWindow *)graph, sx1, sy1, x, y); /* * mark the start of the drag location */ graph->dragx1 = sx1; graph->dragy1 = sy1; } graph->dragwx1 = x; graph->dragwy1 = y; break; case 3: /* * world coord xy readout closest above point */ Snap(graph, sx1, sy1, &x, &y); /* * draw a line to the point on the plot (sx2, sy2) */ ScreenTransform(graph, x, y, &sx2, &sy2); /* avoid writing on the last pixel */ if (sy2 > sy1) { sy2 -= 1; } else { sy2 += 1; } graph->dragx1 = sx1; graph->dragy1 = sy1; graph->dragx2 = sx2; graph->dragy2 = sy2; DrawSuperLine((BasicWindow *)graph, sx2, sy1, sx2, sy2); ClearWindow((BasicWindow *)graph->frame->text); NBShowCoords((BasicWindow *)graph->frame->text, 0, graph->fontheight, x, y); } break; case DRAWMODE: switch (button) { case 1: /* * mark the start of the line */ graph->dragx1 = sx1; graph->dragy1 = sy1; WorldTransform(graph, sx1, sy1, &x, &y); graph->dragwx1 = x; graph->dragwy1 = y; break; } break; case ZAPMODE: switch (button) { case 1: /* * delete the label */ ZapLabel(graph, (XKeyEvent *)buttonevent); break; } break; case PINCHMODE: switch (button) { case 1: /* * offset the plots */ OffsetPlotGraphically(graph, buttonevent->x, buttonevent->y, 0); break; } break; } }
void ButtonReleaseAction(Graph *graph, XButtonReleasedEvent *buttonevent) { int button; int sx2, sy2; int sx1, sy1; float x1, y1, x2, y2; button = buttonevent->button; sx2 = buttonevent->x; sy2 = buttonevent->y; switch (ButtonMode()) { case DATAMODE: switch (button) { case 1: /* zoom box */ /* * mark the end of the drag and zoom */ graph->dragx2 = sx2; graph->dragy2 = sy2; WorldTransform(graph, graph->dragx1, graph->dragy1, &x1, &y1); WorldTransform(graph, graph->dragx2, graph->dragy2, &x2, &y2); /* * Don't perform a zero scale action. */ if (x2 == x1 || y2 == y1) return; if (x2 > x1) { graph->wxmin = x1; graph->wxmax = x2; } else { graph->wxmin = x2; graph->wxmax = x1; } if (y2 > y1) { graph->wymin = y1; graph->wymax = y2; } else { graph->wymin = y2; graph->wymax = y1; } ScaleAndRefreshGraph(graph); /* * set the drag coords back to the invalid state */ graph->dragx1 = -1; graph->dragx2 = -1; break; case 2: /* ruler line */ /* * get the world coordinates of the starting point */ x1 = graph->dragwx1; y1 = graph->dragwy1; if (sx2 != graph->dragx1 || sy2 != graph->dragy1) { if (snapmode) { /* * display the final coords */ Snap(graph, sx2, sy2, &x2, &y2); /* * compute the screen coordinate of the data point */ ScreenTransform(graph, x2, y2, &sx1, &sy1); ShowCoords((BasicWindow *)graph, sx1, sy1, x2, y2); } else { /* * display the final coords */ WorldTransform(graph, sx2, sy2, &x2, &y2); ShowCoords((BasicWindow *)graph, sx2, sy2, x2, y2); } ClearWindow((BasicWindow *)graph->frame->text); ShowSlope((BasicWindow *)graph->frame->text, 0, graph->fontheight, x1, y1, x2, y2); AddLabelLine((BasicWindow *)graph, 0, 0, 0, 0, x1, y1, x2, y2, WORLD_LBL, TEMPORARY_LBL); } /* * set the drag coords back to the invalid state */ graph->dragx1 = -1; graph->dragx2 = -1; break; case 3: /* drag line */ /* * erase the old line */ EraseSuperLine((BasicWindow *)graph, graph->dragx2, graph->dragy1, graph->dragx2, graph->dragy2); /* * get the coords */ Snap(graph, sx2, sy2, &x2, &y2); ShowCoords((BasicWindow *)graph, graph->dragx2, graph->dragy2, x2, y2); graph->dragx1 = -1; graph->dragx2 = -1; break; } break; case DRAWMODE: switch (button) { case 1: /* draw line */ /* * mark the end of the drag and zoom */ graph->dragx2 = sx2; graph->dragy2 = sy2; WorldTransform(graph, graph->dragx1, graph->dragy1, &x1, &y1); WorldTransform(graph, graph->dragx2, graph->dragy2, &x2, &y2); /* * draw a line between the points */ AddLabelLine((BasicWindow *)graph, 0, 0, 0, 0, x1, y1, x2, y2, WORLD_LBL, TEMPORARY_LBL); /* * set the drag coords back to the invalid state */ graph->dragx1 = -1; graph->dragx2 = -1; break; } break; } }
void TaskStart ( void *data ) { PWINDOWS ptr = GetActiveWindow(); UBYTE i; char sCmd[MAX_X]; WORD key; WORD index, pos = 0x00; data = data; /* Prevent compiler warning */ OS_ENTER_CRITICAL(); PC_VectSet(0x08, OSTickISR); /* Install uC/OS-II's clock tick ISR */ PC_SetTickRate(OS_TICKS_PER_SEC); /* Reprogram tick rate */ OS_EXIT_CRITICAL(); PC_DispChar(0, 0, ' ', 0x00); PC_DispStr (8, 16, "Determining CPU's capacity ...", DISP_FGND_WHITE); CreateWindow (0, StartY, MAX_X, EndY, DISP_FGND_WHITE, DISP_BGND_BLUE, "[ Prompt Window ]"); CreateTaskWindows(); OSStatInit(); /* Initialize uC/OS-II's statistics */ for (i = 0; i < N_TASKS; i ++) { /* Create N_TASKS identical tasks */ TaskData[i] = '0' + i; /* Each task will display its own letter */ OSTaskCreate(Task, (void *)&TaskData[i], (void *)&TaskStk[i][TASK_STK_SIZE - 1], i + 1); } DisplayTitle(); ClearWindow(); memset(sCmd, 0x00, MAX_X); DisplayPrompt(); for (;;) { DisplayStatus(); // display status of tasks if (PC_GetKey(&key) == TRUE) { /* See if key has been pressed */ if (key == 0x1B) { /* Yes, see if it's the ESCAPE key */ PC_DOSReturn(); /* Return to DOS */ } else if (key == 0x08) // backspace { pos --; pos = pos <= 0x00 ? 0x00 : pos; sCmd[pos] = '\0'; PC_DispChar(ptr->cx + pos + strlen(sCmdPrompt), ptr->cy, ' ', ptr->color); DisplayCursor(ptr->cx + pos + strlen(sCmdPrompt), ptr->cy); } else if (key == 0x0d || key == 0x0a) // enter { if (pos) { index = ParseCommand(sCmd); HandleCommand(index); } memset(sCmd, 0x00, MAX_X); pos = 0x00; ptr->cy ++; if (ptr->cy == ptr->ey - 1) ClearWindow(); DisplayPrompt(); } else if ((key >= '0' && key <= '9') || (key >= 'a' && key <= 'z') || (key >= 'A' && key <= 'Z')) { if (pos < MAX_X) { sCmd[pos] = (char)key; PC_DispChar(ptr->cx + pos + strlen(sCmdPrompt), ptr->cy, key, ptr->color); DisplayCursor (ptr->cx + pos + strlen(sCmdPrompt) + 1, ptr->cy); } pos ++; } } OSTimeDlyHMSM(0, 0, 0, 200); /* Wait 200 ms */ } }