void PrintMsg(char *Msg) { int ret; char PrintBuff[1024]; START_PRINT: if(CheckPrinter() != TRUE) goto end1; //清空打印缓冲区 ClearPrintBuff(); SetPrintFont(24); memset(PrintBuff, 0, sizeof(PrintBuff)); strcpy(PrintBuff, Msg); ret = FillPrintBuff(PrintBuff); if(ret < 0) goto end1; ret = FillPrintBuff("PL"); if(ret < 0) goto end1; //开始打印 ret =StartPrint(); DebugOut("print error code:[%d]\n", ret); if(ret != 0) { if(ret == -1) goto START_PRINT; else if(ret == -2) goto end2; else if(ret == -3) goto end1; } return; end1: FailBeep(); ClearLine(1, 9); TextOut(0, 3, ALIGN_CENTER, "请检查打印机"); TextOut(0, 4, ALIGN_CENTER, "打印失败"); WaitKey(2000); return; end2: FailBeep(); ClearLine(1, 9); TextOut(0, 3, ALIGN_CENTER, "电量不足"); TextOut(0, 4, ALIGN_CENTER, "无法执行打印"); WaitKey(2000); }
void Window::DrawScreen(vector<Buffer*> &buffers, uint8_t ¤t_buffer) { uint8_t window_buffer[(CONSOLE_WIDTH*CONSOLE_HEIGHT)+1]; uint16_t index = 0; uint16_t length_of_text = buffers[current_buffer]->GetTextLength(); uint32_t x = 0; uint32_t y = 0; if(buffers.size() > 1) { //logic for drawing screen from two buffers goes here } else //single buffer mode { getyx(stdscr, y, x); //save the cursor location clear(); //Clear anything on the screen while(length_of_text != 0) { ClearLine(window_buffer, (CONSOLE_WIDTH*CONSOLE_HEIGHT)+1); //clearn anything in the line buffer GetWindow(buffers, current_buffer, window_buffer, index, length_of_text); //get the line and update any values as needed mvprintw(0, 0, (char*) window_buffer);//(char*)current_line); //print the current line } move(y, x); //return the cursor location where it was refresh(); //Print the screen } }
void Window::WriteStatus(uint8_t* status, uint32_t mode, int32_t ch, uint32_t line_num, uint32_t column_num) //Print the status line { uint8_t Mode[14] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0}; uint32_t y = 0; uint32_t x = 0; if(mode != WELCOME) //if not in Welcome mode turn on the status line { switch (mode) { case SEARCH: strncpy((char*)Mode, "-- SEARCH --", 12); break; case REPLACE: strncpy((char*)Mode, "-- REPLACE --", 13); break; case INSERT: strncpy((char*)Mode,"-- INSERT --", 12); break; default: ClearLine(Mode, 14); } getyx(stdscr, y, x); //Save the current location of the cursor if(status != NULL) { mvprintw(CONSOLE_HEIGHT, 0, "%s %s, char(%d) COL:%u LINE:%u",status, Mode, ch, line_num, column_num); } else mvprintw(CONSOLE_HEIGHT, 0, "%s char(%d) COL:%u LINE:%u", Mode, ch, line_num, column_num); move(y, x); //Restor the cursors original location refresh(); } }
void alias_title(int modified) { /** display a new title line, due to re-sync'ing the aliases **/ /* Stolen from update_title() */ char buffer[SLEN]; char modmsg[SLEN]; if (modified) { strcpy(modmsg, catgets(elm_msg_cat, AliasesSet, AliasesModified, "(modified, resync needed) ")); } else { modmsg[0] = '\0'; } if (selected) sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesSelect, "Alias mode: %d shown out of %d %s[ELM %s]"), selected, num_aliases, modmsg, version_buff); else if (num_aliases == 1) sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesSingle, "Alias mode: 1 alias %s[ELM %s]"), modmsg, version_buff); else sprintf(buffer, catgets(elm_msg_cat, AliasesSet, AliasesPlural, "Alias mode: %d aliases %s[ELM %s]"), num_aliases, modmsg, version_buff); ClearLine(1); CenterLine(1, buffer); }
void DisplayInfo(uint32 nbmess) { GotoLc(1,1); ClearLine(); GotoLc(1,1); printf("%u",nbmess); }
void LCD::write(uint8_t value) { if (_numlines == 4) { if (value != '\r' && value != '\n') { send(value, DATA); xpos++; } else if (value == '\n') { //ClearRestOfLine(xpos); ypos++; } if (xpos >= _cols || ypos >= _numlines) { xpos = 0; ypos++; if (ypos >= _numlines) ypos=0; ClearLine(ypos); setCursor(xpos, ypos); } } else { send(value, DATA); } }
size_t LCD::write(uint8_t value) { bool newline=false; if (_numlines == 4) { if (value != '\r' && value != '\n') { send(value, DATA); xpos++; if (xpos >= _cols) newline=true; } if (value == '\n' || newline) { //ClearRestOfLine(xpos); xpos = 0; ypos++; if (ypos >= _numlines) ypos=0; ClearLine(ypos); setCursor(xpos, ypos); } } else { send(value, DATA); } return 1; // assume OK }
// Initialize the console. void CConsole::Initialize(const CTFileName &fnmLog, INDEX ctCharsPerLine, INDEX ctLines) { con_csConsole.cs_iIndex = -1; // synchronize access to console CTSingleLock slConsole(&con_csConsole, TRUE); // allocate the buffer con_ctCharsPerLine = ctCharsPerLine; con_ctLines = ctLines; con_ctLinesPrinted = 0; // note: we add +1 for '\n' perline and +1 '\0' at the end of buffer con_strBuffer = (char *)AllocMemory((ctCharsPerLine+2)*ctLines+1); con_strLineBuffer = (char *)AllocMemory(ctCharsPerLine+2); // includes '\n' and '\0' con_atmLines = (TIME*)AllocMemory((ctLines+1)*sizeof(TIME)); // make it empty for(INDEX iLine=0; iLine<ctLines; iLine++) { ClearLine(iLine); } // add string terminator at the end con_strBuffer[(ctCharsPerLine+1)*ctLines] = 0; // start printing in last line con_strLastLine = con_strBuffer+(ctCharsPerLine+1)*(ctLines-1); con_strCurrent = con_strLastLine; //안태훈 수정 시작 //(Block Log)(0.1) //CreateLogFile(fnmLog); //로그파일 생성을 막는다. //안태훈 수정 끝 //(Block Log)(0.1) // print one dummy line on start CPrintF("\n"); }
static void DoInclude (void) /* Open an include file. */ { char RTerm; InputType IT; StrBuf Filename = STATIC_STRBUF_INITIALIZER; /* Preprocess the remainder of the line */ PreprocessLine (); /* Skip blanks */ SkipWhitespace (0); /* Get the next char and check for a valid file name terminator. Setup * the include directory spec (SYS/USR) by looking at the terminator. */ switch (CurC) { case '\"': RTerm = '\"'; IT = IT_USRINC; break; case '<': RTerm = '>'; IT = IT_SYSINC; break; default: PPError ("`\"' or `<' expected"); goto Done; } NextChar (); /* Get a copy of the filename */ while (CurC != '\0' && CurC != RTerm) { SB_AppendChar (&Filename, CurC); NextChar (); } SB_Terminate (&Filename); /* Check if we got a terminator */ if (CurC == RTerm) { /* Open the include file */ OpenIncludeFile (SB_GetConstBuf (&Filename), IT); } else if (CurC == '\0') { /* No terminator found */ PPError ("#include expects \"FILENAME\" or <FILENAME>"); } Done: /* Free the allocated filename data */ SB_Done (&Filename); /* Clear the remaining line so the next input will come from the new * file (if open) */ ClearLine (); }
void __stdcall WriteMsgStdErr( WORD wAttributes, BOOL fBuildPrefix, BOOL fPrintFrbInfo, const char *pszFormat, va_list *vaArgs) { EnterMessageMode(); if (fBuildPrefix) ClearLine(); if (fBuildPrefix) fprintf(stderr, "BUILD: "); if (fPrintFrbInfo && Frb.fOpen) { fprintf (stderr, "%s(%hu): ", Frb.pszFile, Frb.cLine); } vfprintf(stderr, pszFormat, *vaArgs); fflush(stderr); LeaveMessageMode(); }
void LClearLine(Layer *l, int y, int xs, int xe, int bce, struct mline *ol) { int y2, xs2, xe2; /* check for magic margin condition */ if (xs >= l->l_width) xs = l->l_width - 1; if (xe >= l->l_width) xe = l->l_width - 1; if (l->l_pause.d) LayPauseUpdateRegion(l, xs, xe, y, y); for (Canvas *cv = l->l_cvlist; cv; cv = cv->c_lnext) { if (l->l_pause.d && cv->c_slorient) continue; for (Viewport *vp = cv->c_vplist; vp; vp = vp->v_next) { xs2 = xs + vp->v_xoff; xe2 = xe + vp->v_xoff; y2 = y + vp->v_yoff; if (y2 < vp->v_ys || y2 > vp->v_ye) continue; if (xs2 < vp->v_xs) xs2 = vp->v_xs; if (xe2 > vp->v_xe) xe2 = vp->v_xe; if (xs2 > xe2) continue; display = cv->c_display; if (D_blocked) continue; ClearLine(ol ? mlineoffset(RECODE_MLINE(ol), -vp->v_xoff) : NULL, y2, xs2, xe2, bce); } } }
int clear_error(void) { if (err_buffer[0] == '\0') return FALSE; ClearLine(LINES); err_buffer[0] = '\0'; return TRUE; }
static void AskForDisk (const char* Name, unsigned char Drive) /* Ask the user to insert a specific disk */ { ClearLine (); cprintf ("\rInsert %s Disk into Drive %d !", Name, Drive); cgetc (); }
void display_central_message(void) { /** display the message if set... **/ if (central_message_buffer[0] != '\0') { ClearLine(LINES-15); CenterLine(LINES-15, central_message_buffer); FlushOutput(); } }
/*---------------------------------------------------------------------- Clear specified lines on the screen Result: The lines starting at 'x' and ending at 'y' are blanked and the cursor is left at row 'x', column 0 ----*/ void ClearLines(int x, int y) { int i; for(i = x; i <= y; i++) ClearLine(i); MoveCursor(x, 0); }
long CScrollBufL3::AllocateLines(long nInsertionLine) { long nIndex; /*VerifyCritical();*/ for (nIndex = m_vecLine.size() - 1; nIndex < nInsertionLine; nIndex++) { SFullLine sFullLine; m_vecLine.push_back(sFullLine); ClearLine(m_vecLine.size() - 1); } return RemoveLines(); }
static int MacName (char* Ident) /* Get a macro symbol name into Ident. If we have an error, print a * diagnostic message and clear the line. */ { if (IsSym (Ident) == 0) { PPError ("Identifier expected"); ClearLine (); return 0; } else { return 1; } }
static void DoWarning (void) /* Print a warning */ { SkipWhitespace (0); if (CurC == '\0') { PPError ("Invalid #warning directive"); } else { PPWarning ("#warning: %s", SB_GetConstBuf (Line) + SB_GetIndex (Line)); } /* Clear the rest of line */ ClearLine (); }
static void DoError (void) /* Print an error */ { SkipWhitespace (0); if (CurC == '\0') { PPError ("Invalid #error directive"); } else { PPError ("#error: %s", SB_GetConstBuf (Line) + SB_GetIndex (Line)); } /* Clear the rest of line */ ClearLine (); }
int edit_message(const char *filename, SEND_HEADER *shdr, const char *sel_editor) { /* Return 0 if successful, -1 on error. */ char buffer[SLEN]; int rc, return_value = 0, err; /* pick default editor on NULL */ if (sel_editor == NULL) sel_editor = (IS_BUILTIN(editor) ? alternative_editor : editor); /* handle request for the builtin editor */ if (IS_BUILTIN(sel_editor)) return builtin_editor(filename, shdr); /* we will be running an external editor */ PutLine(LINES, 0, catgets(elm_msg_cat, ElmSet, ElmInvokeEditor, "Invoking editor...")); if (strstr(sel_editor, "%s") != NULL) sprintf(buffer, sel_editor, filename); else sprintf(buffer, "%s %s", sel_editor, filename); chown(filename, userid, groupid); if ((rc = system_call(buffer, SY_COOKED|SY_ENAB_SIGHUP|SY_DUMPSTATE)) < 0) { err = errno; dprint(1, (debugfile, "System call failed with status %d (edit_message)\n", rc)); dprint(1, (debugfile, "** %s **\n", strerror(err))); ClearLine(LINES-1); show_error(catgets(elm_msg_cat, ElmSet, ElmCantInvokeEditor, "Can't invoke editor '%s' for composition."), sel_editor); if (sleepmsg > 0) sleep(sleepmsg); return_value = -1; } /* Flush input buffer. This is especially important under X, * where accidental keystrokes in the elm window could make * things messy. */ if (edit_flush) FlushInput(); return return_value; }
bool Erase(u32 *addr, u32 len){ u32 *ptr, *end=addr+len/4; // erase block loop. for (ptr=addr; ptr<end; ptr+=FLASH_BLOCK_SIZE/4){ ClearLine(); printf("\tCurrent block address\t: 0x%08lx", (long)ptr); // erase block. if (!EraseBlock(ptr)){ return false; } } printf("\n"); return true; }
static void DspLine(void) { unsigned short i=0; double TempMul_Y2; double TempY_Scale; unsigned short tempvalue; unsigned short *p = NULL; ClearLine(0x57); vTaskDelay(200 / portTICK_RATE_MS); for(i=0; i<MaxPointLen;i++) { if(i%50 == 0) { p = &(S_ShowPageBuffer->testdata.testline.TestPoint[i]); DisPlayLine(1 , p , 50); vTaskDelay(2 / portTICK_RATE_MS); } if(S_ShowPageBuffer->lineinfo.MaxData <= S_ShowPageBuffer->testdata.testline.TestPoint[i]) S_ShowPageBuffer->lineinfo.MaxData = S_ShowPageBuffer->testdata.testline.TestPoint[i]; } ////////////////////////针对当前曲线最大值计算y轴放大倍数////////////////////////////////////// TempMul_Y2 = TestLineHigh; TempMul_Y2 /= S_ShowPageBuffer->lineinfo.MaxData; TempMul_Y2 *= 0.8; //*0.8是将最大值缩放到满刻度的0.8高度处 tempvalue = (unsigned short)(TempMul_Y2*10); S_ShowPageBuffer->lineinfo.MUL_Y = ((tempvalue%10) > 5)?(tempvalue/10 + 1):(tempvalue/10); if(S_ShowPageBuffer->lineinfo.MUL_Y < 1) //最小值为1 S_ShowPageBuffer->lineinfo.MUL_Y = 1; /////////////////////////针对当前放大倍数,计算y轴刻度递增基数///////////////////////////////////// TempY_Scale = TestLineHigh ; TempY_Scale /= S_ShowPageBuffer->lineinfo.MUL_Y; TempY_Scale /= 2.0; //目前显示2个y轴刻度 S_ShowPageBuffer->lineinfo.Y_Scale = (unsigned short)TempY_Scale; SetChartSize(0x2370 , S_ShowPageBuffer->lineinfo.MUL_Y); DspNum(0x230b , S_ShowPageBuffer->lineinfo.Y_Scale, 2); DspNum(0x230a , S_ShowPageBuffer->lineinfo.Y_Scale*2, 2); }
bool EraseFlashBlocks(FUNIT *addr, ulong len) { FUNIT *ptr, *end=addr+len/FBOUND; // erase block loop. for (ptr=addr; ptr<end; ptr+=FLASH_BLOCK_SIZE/FBOUND){ ClearLine(); printf("\tErase Block at : 0x%08lx.", (long)ptr); // erase block. if (!EraseOneFlashBlock(ptr)){ return false; } } printf("\n"); return true; }
void DisplayValueFor(t_th *th) { char buf[100]; GotoLc(th->th_num+2,1); ClearLine(); // printf("%d",th->th_value); GotoLc(th->th_num+2,1); printf ("%09d %09d ",th->th_send,th->th_recv); memset (buf,'.',80); buf[79] = 0; memset (buf,'@'+th->th_num+1,th->th_value); printf ("%s",buf); }
//////////////////////////////////////// // ControlLine // int GameDataControl::ControlLine( void ) //////////////////////////////////////// { int cleared= 0; for( int y= 1 ; y < GAMEBOARD_HEIGHT - 1 ; y++ ) { if( CheckLine( y ) ) { cleared++; ClearLine( y ); y--; } } return cleared; }
void LCD::PrintLine(INT32 line, const char *message, ...) { DriverStationLCD::Line lcdLine; //consoleLog("printLine %d, %d", line, dsLcd); if (dsLcd == 0) InitLcd(); ClearLine(line); switch (line) { case 1: lcdLine = DriverStationLCD::kUser_Line1; break; case 2: lcdLine = DriverStationLCD::kUser_Line2; break; case 3: lcdLine = DriverStationLCD::kUser_Line3; break; case 4: lcdLine = DriverStationLCD::kUser_Line4; break; case 5: lcdLine = DriverStationLCD::kUser_Line5; break; case 6: lcdLine = DriverStationLCD::kUser_Line6; break; } va_list vl; va_start(vl, message); //consoleLog("printLine %d, %d: %s", line, dsLcd, message); dsLcd->VPrintfLine(lcdLine, message, vl); dsLcd->UpdateLCD(); }
/*-----------*/ int main(void) { uint8_t x; _INIT(); wdt_enable(WDTO_1S); usbInit(); usbDeviceDisconnect(); // enforce re-enumeration, do this while interrupts are disabled! x = 25; while(--x) { // fake USB disconnect for > 250 ms wdt_reset(); _delay_ms(10); } usbDeviceConnect(); pulse_counter = 0; sei(); DisplayRefresh(1); x = 100; while(--x) { wdt_reset(); _delay_ms(10); } ClearLine(SecondLine); DisplayRefresh(1); uart_init(__UBRR); uart_putstr("\r\n"); uart_putstr("Radioactive@Home V2.60\r\n"); uart_putstr("Firmware 1.0 (27.03.14)\r\n"); while(1) { wdt_reset(); usbPoll(); HV_Supply_EVENT(); BeepIfChange_EVENT(); Switch_EVENT(); RadCalc_EVENT(); DisplayRefresh_EVENT(); } return 0; }
void show_last_error(void) { int lines_of_msg; if (Term.status & TERM_IS_INIT) { lines_of_msg = (strlen(err_buffer) + COLS - 1) / COLS; ClearLine(LINES); if (lines_of_msg > 1) PutLine(LINES + 1 - lines_of_msg, 0, err_buffer); else CenterLine(LINES, err_buffer); } else { fputs(err_buffer, stderr); putc('\r', stderr); putc('\n', stderr); } FlushOutput(); }
/*------------------------------------------------------------------------------ -- FUNCTION: ClearScreen -- -- DATE: Oct 19, 2010 -- -- REVISIONS: (Date and Description) -- -- DESIGNER: Dean Morin -- -- PROGRAMMER: Dean Morin -- -- INTERFACE: VOID ClearScreen(HWND hWnd, UINT cxCoord, UINT cyCoord, -- INT iDirection) -- hWnd - the handle to the window -- cxCoord - the row of the first -- character to clear - (0,0) origin -- cyCoord - the line of the first -- character to clear - (0,0) origin -- iDirection - the direction (up or down) to clear -- the screen -- -- RETURNS: VOID. -- -- NOTES: -- Clears the screen in the direction specified by iDirection (all -- preceding characters, or all following characters). The -- character under the cursor will be cleared as well. Please note -- that cxCoord and cyCoord use a (0,0) origin. ------------------------------------------------------------------------------*/ VOID ClearScreen(HWND hWnd, UINT cxCoord, UINT cyCoord, INT iDirection) { PWNDDATA pwd = NULL; UINT i = 0; UINT j = 0; pwd = (PWNDDATA) GetWindowLongPtr(hWnd, 0); ClearLine(hWnd, cxCoord, cyCoord, iDirection); i = cyCoord + iDirection; while (i < LINES_PER_SCRN && i >= 0) { for (j = 0; j < CHARS_PER_LINE; j++) { CHARACTER(j, i).character = ' '; CHARACTER(j, i).bgColor = CUR_BG_COLOR; CHARACTER(j, i).style = 0; } i += iDirection; } }
void Clear(){ asm("lda #$00"); //for(i=0;i<100;i++) asm("ldx #$63");//99 times fori: //Board[i]=0; asm("sta %w,X",Board); asm("dex"); asm("bne %g",fori); //Board[0]=0; asm("sta %w",Board); waitvblank(); //Clear_hi=0x20; asm("lda #$20"); asm("sta %b",Clear_hi); //Clear_lo=0x62; asm("lda #$62"); asm("sta %b",Clear_lo); asm("lda #$14");//20 times asm("sta %b",Clear_i); fori2: //*(char*)(0x2006)=Clear_hi; asm("lda %b",Clear_hi); asm("sta $2006"); //*(char*)(0x2006)=Clear_lo; asm("lda %b",Clear_lo); asm("sta $2006"); asm("clc"); asm("adc #$20"); asm("sta %b",Clear_lo); asm("lda %b",Clear_hi); asm("adc #$00"); asm("sta %b",Clear_hi); ClearLine(); asm("dec %b",Clear_i); asm("bne %g",fori2); }