//显示源文件中指定的行 void DisplaySourceLines(LPCTSTR sourceFile, int lineNum, unsigned int address, int after, int before) { std::wcout << std::endl; std::wifstream inputStream(sourceFile); if (inputStream.fail() == true) { std::wcout << TEXT("Open source file failed.") << std::endl << TEXT("Path: ") << sourceFile << std::endl; return; } inputStream.imbue(std::locale("chs", std::locale::ctype)); int curLineNumber = 1; //计算从第几行开始输出 int startLineNumber = lineNum - before; if (startLineNumber < 1) { startLineNumber = 1; } std::wstring line; //跳过不需要显示的行 while (curLineNumber < startLineNumber) { std::getline(inputStream, line); ++curLineNumber; } //输出开始行到当前行之间的行 while (curLineNumber < lineNum) { std::getline(inputStream, line); DisplayLine(sourceFile, line, curLineNumber, FALSE); ++curLineNumber; } //输出当前行 getline(inputStream, line); DisplayLine(sourceFile, line, curLineNumber, TRUE); ++curLineNumber; //输出当前行到最后行之间的行 int lastLineNumber = lineNum + after; while (curLineNumber <= lastLineNumber) { if (!getline(inputStream, line)) { break; } DisplayLine(sourceFile, line, curLineNumber, FALSE); ++curLineNumber; } inputStream.close(); }
//------------ // dword YesNoBox::OnKey( dword key, dword extKey ) { (extKey); switch ( key ) { case RKEY_VolUp: if ( option < 1 ) option++; else option = 0; DisplayLine(); break; case RKEY_VolDown: if ( option > 0 ) option--; else option = 1; DisplayLine(); break; case RKEY_Ok : switch ( option ) { case 0 : result = true; break; // YES case 1 : result = false; break; // NO default : result = false; break; } EndDialog(result ? Dialog_Ok : Dialog_Cancel); break; case RKEY_Exit : result = false; EndDialog(Dialog_Cancel); break; case RKEY_Mute : return key; } return 0; }
void LCDisplayLine(Layer *l, struct mline *ml, int y, int xs, int xe, int isblank) { int xs2, xe2, y2; 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; display = cv->c_display; if (D_blocked) 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; DisplayLine(isblank ? &mline_blank : &mline_null, mlineoffset(RECODE_MLINE(ml), -vp->v_xoff), y2, xs2, xe2); } } }
void TWODDRAW_CLASS::DrawLine (float x1in, float y1in, float x2in, float y2in) { int x0, y0, x1, y1; float x2, y2; x1in *= aspectRatio; x2in *= aspectRatio; x2 = x1in * matrix00 + y1in * matrix01; y2 = x1in * matrix10 + y1in * matrix11; x1in = x2 + x_offset; y1in = y2 + y_offset; x2 = x2in * matrix00 + y2in * matrix01; y2 = x2in * matrix10 + y2in * matrix11; x2in = x2 + x_offset; y2in = y2 + y_offset; if (x1in <= x2in) { x0 = (short)(xRes / 2 * (1.0F + x1in)); y0 = (short)(yRes / 2 * (1.0F - y1in)); x1 = (short)(xRes / 2 * (1.0F + x2in)); y1 = (short)(yRes / 2 * (1.0F - y2in)); } else { x0 = (short)(xRes / 2 * (1.0F + x2in)); y0 = (short)(yRes / 2 * (1.0F - y2in)); x1 = (short)(xRes / 2 * (1.0F + x1in)); y1 = (short)(yRes / 2 * (1.0F - y1in)); } DisplayLine (x0, y0 , x1, y1 ); }
void CMSourceDirector::DisplayFile ( const JCharacter* fileName, const JIndex lineNumber, const JBoolean markLine ) { assert( !JStringEmpty(fileName) ); if (!itsCurrentFile.IsEmpty() && JSameDirEntry(fileName, itsCurrentFile)) { DisplayLine(lineNumber, markLine); UpdateWindowTitle(NULL); } else if (JFileReadable(fileName)) { itsCurrentFile = fileName; JTextEditor::PlainTextFormat format; itsText->ReadPlainText(itsCurrentFile, &format); // Assembly must not end with newline, so we have to enforce this for // source code, too. const JString& text = itsText->GetText(); JIndex i = text.GetLength(); while (text.GetCharacter(i) == '\n') { i--; } if (i < text.GetLength()) { itsText->SetSelection(i+1, text.GetLength()); itsText->DeleteSelection(); } itsText->SetCaretLocation(1); DisplayLine(lineNumber, markLine); itsFileDisplay->SetText(itsCurrentFile); UpdateFileType(); UpdateWindowTitle(NULL); } }
// helper to print the "success" message -- moved out of line to reduce // stack usage of main routine. VOID NEAR DisplaySuccess ( CHAR * szTypeLibFile ) { CHAR szBuf[255]; sprintf (szBuf, szFmtSuccess, szTypeLibFile); DisplayLine(szBuf); // then display the message }
//------------ // dword YesNoBox::OnKey( dword key, dword extKey ) { switch ( key ) { case RKEY_VolUp: if ( option < 1 ) option++; else option = 0; DisplayLine(); break; case RKEY_VolDown: if ( option > 0 ) option--; else option = 1; DisplayLine(); break; case RKEY_Ok : switch ( option ) { case 0 : result = true; break; // YES case 1 : result = false; break; // NO default : result = false; break; } Close(); // Close the yes/no window break; case RKEY_Exit : result = false; Close(); // Close the edit window break; case RKEY_Mute : return key; } return 0; }
void YesNoBox::OnOpen() { // Store the currently displayed screen area where we're about to put our pop-up window on. windowCopy = TAP_Osd_SaveBox(GetTAPScreenRegion(), YESNO_WINDOW_X, YESNO_WINDOW_Y, YESNO_WINDOW_W, YESNO_WINDOW_H); // Display the pop-up window. TAP_Osd_PutGd( GetTAPScreenRegion(), YESNO_WINDOW_X, YESNO_WINDOW_Y, &_popup360x180Gd, TRUE ); // Display Title and information in pop-up window PrintCenter( GetTAPScreenRegion(), YESNO_WINDOW_X+5, YESNO_WINDOW_Y + 13, YESNO_WINDOW_X+YESNO_WINDOW_W-5, title, MAIN_TEXT_COLOUR, 0, FNT_Size_1926 ); PrintCenter( GetTAPScreenRegion(), YESNO_WINDOW_X+5, YESNO_WINDOW_Y + 56, YESNO_WINDOW_X+YESNO_WINDOW_W-5, line1, MAIN_TEXT_COLOUR, 0, FNT_Size_1622 ); PrintCenter( GetTAPScreenRegion(), YESNO_WINDOW_X+5, YESNO_WINDOW_Y + 89, YESNO_WINDOW_X+YESNO_WINDOW_W-5, line2, MAIN_TEXT_COLOUR, 0, FNT_Size_1622 ); DisplayLine(); }
// redraw the screen (except for the status line) static void _near ListUpdateScreen( void ) { register int nRow; long lTemp = LFile.lViewPtr; Scroll( 1, 0, nScreenRows, nScreenColumns, 0, nNormal ); // if no name yet, we're still initializing! if ( LFile.szName[0] == _TEXT('\0') ) return; for ( nRow = 1; ( nRow <= nScreenRows ); nRow++ ) lTemp += DisplayLine( nRow, lTemp ); LFile.fDisplaySearch = 0; }
void CMSourceDirector::DisplayDisassembly ( const CMLocation& loc ) { const JString& fnName = loc.GetFunctionName(); const JString& addr = loc.GetMemoryAddress(); assert( !JStringEmpty(fnName) ); assert( !JStringEmpty(addr) ); if (fnName == itsCurrentFn) { JIndex i; if (dynamic_cast<CMLineAddressTable*>(itsTable)->FindAddressLineNumber(addr, &i)) { DisplayLine(i); } else { itsTable->SetCurrentLine(0); } UpdateWindowTitle(NULL); } else { itsCurrentFn = fnName; if (itsGetAssemblyCmd == NULL) { itsGetAssemblyCmd = (CMGetLink())->CreateGetAssembly(this); } if (itsGetAssemblyCmd != NULL) { itsAsmLocation = loc; itsGetAssemblyCmd->Send(); } UpdateWindowTitle(NULL); } }
void CMSourceDirector::DisplayDisassembly ( JPtrArray<JString>* addrList, const JCharacter* instText ) { itsTable->SetLineNumbers(addrList); itsText->SetText(instText); JIndex i; if (itsTable->FindLineNumber(itsAsmLocation.GetMemoryAddress(), &i)) { DisplayLine(i); } else { itsTable->SetCurrentLine(0); } }
// Cleans up, and reports an error. Doesn't return unless this is a warning. // Reports an error. If this is a warning, returns. // If this is an error, cleans up and exits VOID NEAR ParseErrorLnCol ( ERR err, DWORD lnCur, WORD colCur ) { CHAR szError[255]; BOOL fWarning; fWarning = ((err >= WARN_FIRST && err < GENERAL_ERR_LAST) || (err >= PWARN_FIRST && err < OERR_FIRST)); if (fWarning && fSuppressWarnings) return; // first figure out the error text if (err < OERR_FIRST) { // parser/lexer error or warning Assert(err); sprintf (szError, (fWarning ? szFmtWarnFileLineCol : szFmtErrFileLineCol), szFileCur, lnCur, lnCur, colCur, rgszErr[err-1], szExpected); } else { // output errors shoudn't come through here. Assert(err >= ERR_FIRST && err < GENERAL_ERR_LAST); sprintf (szError, (fWarning ? szFmtWarnGeneral : szFmtErrGeneral), rgszErr[err-1]); } // display error/warning DisplayLine(szError); // If not a warning, then clean up and exit(1) if (!fWarning) ErrorExit(); }
// Cleans up, and reports an error with an insertion string. Doesn't return. VOID FAR ItemError ( CHAR * szErrFormat, LPSTR lpszItem, ERR err ) { CHAR szItem[255]; CHAR szBuf[255]; Assert(lpszItem); _fstrcpy(szItem, lpszItem); // copy item name near // format the error sprintf (szBuf, szErrFormat, szFileCur, szItem, rgszErr[err-1], scodeErrCur); // then display the error DisplayLine(szBuf); // then clean up and exit(1) ErrorExit(); }
void LCDInit(void) { int i; P5SEL = 0xFE; P4SEL = 0xFF; P2SEL = 0xFF; P3SEL = 0xFF; // Configure LCD_A LCDACTL = LCDFREQ_128 | LCDMX1 | LCDMX0 | LCDSON | LCDON;// LCDAPCTL0 = LCDS0 | LCDS4 | LCDS8 | LCDS12 | LCDS16 | LCDS20; LCDAPCTL1 = 0; LCDAVCTL0 = LCDCPEN; LCDAVCTL1 = VLCD_3_02; for (i=0; i<26; i++) //清屏 LCDMEM[i]=0x0; DisplayLine(1); //显示框架 DisplayBattery(3); DisplayBedNum((unsigned char )ModelAddress); DisplayRFRSSI(0); DisplayRate(0); DisplayVoice(VoiceLevel); DisplayUpAlarm(AlarmUpperValue); DisplayDownAlarm(AlarmLowerValue); if(VoiceLevel >= VOICELEVELMID) { DisplayMoon(OFF); DisplaySun(ON); } else { DisplayMoon(ON); DisplaySun(OFF); } }
flagType DoText ( int yLow, int yHigh ) { REGISTER int yCur; int yMin = -1; int yMax = 0; flagType fReturn = TRUE; struct lineAttr *plaFile = NULL; struct lineAttr *plaScr = NULL; struct lineAttr *plaFileLine; struct lineAttr *plaScrLine; char *pchFileLine = NULL; char pchScrLine[ 2 * sizeof(linebuf) * (1 + sizeof(struct lineAttr))]; int cchScrLine; // int chkpnt = yHigh - yLow > 25 ? 20 : 5; int chkpnt = yHigh - yLow > 25 ? 10 : 3; fReDraw = FALSE; plaScr = (struct lineAttr *) (pchScrLine + sizeof(linebuf)); if (cWin > 1) { pchFileLine = pchScrLine + sizeof(linebuf) * (1 + sizeof(struct lineAttr)); plaFile = (struct lineAttr *) (pchFileLine + sizeof(linebuf)); } /* * For each line in the window, if the line is marked changed, update it. */ for (yCur = yLow; yCur < yHigh; ) { if (TESTFLAG(fChange[yCur], FMODIFY)) { if (yMin == -1) { yMin = yCur; } yMax = yCur; /* * get and display the line */ plaScrLine = plaScr; plaFileLine = plaFile; cchScrLine = DisplayLine (yCur, pchScrLine, &plaScrLine, pchFileLine, &plaFileLine); coutb (0, yCur, pchScrLine, cchScrLine, plaScrLine); RSETFLAG(fChange[yCur],FMODIFY); /* * if it is time to check, and there is a character waiting, stop * the update process, and go process it */ if ( (yCur % chkpnt == 0) && TypeAhead() ) { fReturn = FALSE; break; } } yCur++; } if (fReturn) { RSETFLAG (fDisplay, RTEXT); } // // Update the screen // fReDraw = TRUE; vout(0,0,NULL,0,0); return fReturn; }
void YesNoBox::CreateDialog() { DialogBox::CreateDialog(); DisplayLine(); }
// MkTypLib entry point VOID main ( #ifndef NO_MPW int argc, /* Number of strings in array argv */ CHAR *argv[] /* Array of command-line argument strings */ #endif // NO_MPW ) { #ifdef USE_DIMALLOC IMalloc FAR *pmalloc; #endif //USE_DIMALLOC #ifdef NO_MPW #define MAX_ARGS 21 int argc; /* Number of strings in array argv */ CHAR *argv[MAX_ARGS]; /* Array of command-line argument strings */ FILE * hFileArgs; #endif // NO_MPW int fArgErr; HRESULT res; #ifndef MAC OPENFILENAME ofn; #endif #ifdef NODEBUGALERTS WINDEBUGINFO debuginfo; GetWinDebugInfo(&debuginfo, WDI_OPTIONS); Olddebuginfo = debuginfo; // save for restoration debuginfo.dwOptions |= DBO_SILENT; SetWinDebugInfo(&debuginfo); #endif //NODEBUGALERTS // init key fields in the main 'typlib' structure before we use them typlib.pEntry = NULL; // no entries seen so far typlib.pImpLib = NULL; // no imported libraries initially #ifdef MAC #ifdef NO_MPW // Do mysterious MAC init stuff MaxApplZone(); #endif //NO_MPW InitGraf((Ptr) &qd.thePort); #ifdef NO_MPW InitFonts(); InitWindows(); InitMenus(); InitDialogs(nil); InitCursor(); #endif //NO_MPW PPCInit(); // required by OleInitialize // init the OLE Applet if ((res = InitOleManager(0)) != NOERROR) ParseError(ERR_OM); // UNDONE: correct error? fAppletInitialized = TRUE; #ifdef NO_MPW // If a file exists called "MKTYPLIB.ARG", load up argc, argv[] to satisfy // our command line parser. if (hFileArgs = fopen("mktyplib.arg", "r")) { argc = 1; while (argc < MAX_ARGS) { argv[argc] = malloc(50); if (fscanf(hFileArgs, " %s ", argv[argc]) == EOF) break; argc++; } fclose(hFileArgs); } else { // activate to output to file instead of using lame MAC MessageBox's // szOutputFile = "m.log"; // redirected output szInputFile = "m.odl"; // input file fHFile = TRUE; // want a .H file fArgErr = FALSE; // no arg error goto ArgsParsed; } #endif //NO_MPW #endif //MAC InitLeadByteTable(); fArgErr = FParseCl(argc, argv); // parse the command line #ifdef MAC #ifdef NO_MPW ArgsParsed: #endif //NO_MPW #endif //MAC if (szOutputFile) { #ifdef WIN16 // perform in-place conversion to OEM char set AnsiToOem(szOutputFile, szOutputFile); // (don't bother converting back - this string is not used again) #endif // WIN16 hFileOutput = fopen(szOutputFile, "w"); // if problem opening output file, then just revert to normal // MessageBox output. // CONSIDER: give an error, too? } if (!fNologo) { DisplayLine(szBanner); // display the copyright banner // add a blank line in some cases to make it look better if (hFileOutput) fputs("\n", hFileOutput); #ifndef WIN16 #ifndef NO_MPW else printf("\n"); #endif //NO_MPW #endif //!WIN16 } if (fArgErr || fGiveUsage) { GiveUsage: DisplayLine(szUsage); ErrorExit(); // clean up and exit(1) } #ifndef MAC // use common dialog to get input filename if user didn't specify one if (szInputFile == NULL) { szInputFile = malloc(CB_MAX_PATHNAME+1); memset(&ofn, 0, sizeof(OPENFILENAME)); ofn.lStructSize = sizeof(OPENFILENAME); // ofn.hwndOwner = g_hwndMain; ofn.hwndOwner = NULL; ofn.lpstrFile = szInputFile; ofn.nMaxFile = CB_MAX_PATHNAME+1; *szInputFile = '\0'; ofn.lpstrFilter = "Object Description Lang.\0*.odl\0\0"; ofn.nFilterIndex = 1; ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; // if anything went wrong -- just give the usage message if (GetOpenFileName(&ofn) == 0) goto GiveUsage; } #endif //!MAC Assert(szInputFile); // now compute filenames based off the input filename if (szTypeLibFile == NULL) // if output file not specified { // use input filename with ".tlb" extension szTypeLibFile = CloneNameAddExt(szInputFile, ".tlb"); } if (fHFile && szHFile == NULL) // if header filename not specified { // use input filename with ".h" extension szHFile = CloneNameAddExt(szInputFile, ".h"); } // If output file ends up with the same name as the input file, then // the user is screwed. Just give the usage message. if (!strcmp(szInputFile, szTypeLibFile)) goto GiveUsage; // If .h file ends up with the same name as either the input file or output // file, then the user is screwed. Just give the usage message. if (szHFile && (!strcmp(szInputFile, szHFile) || !strcmp(szTypeLibFile, szHFile))) goto GiveUsage; #ifdef USE_DIMALLOC // Use the dimalloc implementation, since the default implementation // doesn't work yet in mac ole. if (!GetDebIMalloc(&pmalloc)) ParseError(ERR_OM); // UNDONE: correct error? res = OLEINITIALIZE(pmalloc); pmalloc->lpVtbl->Release(pmalloc); #else // must init OLE res = OLEINITIALIZE(NULL); #endif if (FAILED(res)) ParseError(ERR_OM); // UNDONE: correct error? fOLEInitialized = TRUE; #ifndef MAC hcrsWait = LoadCursor(NULL, (LPSTR)IDC_WAIT); SetCursor(hcrsWait); // turn on the hourglass cursor // UNDONE: this doesn't always stay on in WIN16, nor does it seem to // UNDONE: have any affect in WIN32. #endif //!MAC #if FV_CPP if (fCPP) // if we're to pre-process input file DoPreProcess(); #endif //FV_CPP strcpy(szFileCur, szInputFile); // init current file name (for // error reporting) #if FV_CPP ParseOdlFile(fCPP ? szTempFile : szInputFile); // parse the input file #else ParseOdlFile(szInputFile); // parse the input file #endif #if FV_CPP if (szTempFile) { SideAssert(MyRemove(szTempFile) == 0); // delete tmp file created above szTempFile = NULL; } #endif //FV_CPP if (fHFile) // output .H file if desired OutputHFile(szHFile); // Now emit the type library OutputTyplib(szTypeLibFile); #ifdef NO_MPW // Now dump the type library DumpTypeLib(szTypeLibFile); #endif CleanupImportedTypeLibs(); // release any imported typelibs OLEUNINITIALIZE(); // terminate OLE #ifdef MAC UninitOleManager(); // clean up applet #endif //MAC DisplaySuccess(szTypeLibFile); // holy *&*%&^%, it worked!!! if (hFileOutput) // close redirected output file fclose(hFileOutput); #ifdef NODEBUGALERTS SetWinDebugInfo(&Olddebuginfo); #endif //NODEBUGALERTS exit(0); }
int main(void) { /* Enable Rotary Encoder Inputs */ /* GPIOE Periph clock enable */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOE, ENABLE); /* Configure PE8, PE9, and PE10 in input pushpull mode */ GPIO_InitStructure.GPIO_Pin = GPIO_Pin_7 | GPIO_Pin_8 | GPIO_Pin_9 | GPIO_Pin_10; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_DOWN; GPIO_Init(GPIOE, &GPIO_InitStructure); /* Enable USART1 */ /* GPIOC Periph clock enable */ RCC_AHBPeriphClockCmd(RCC_AHBPeriph_GPIOC, ENABLE); GPIO_PinAFConfig(GPIOC, GPIO_PinSource4, GPIO_AF_7); GPIO_InitStructure.GPIO_Pin = GPIO_Pin_4; GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz; GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF; GPIO_InitStructure.GPIO_OType = GPIO_OType_PP; GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP; GPIO_Init(GPIOC, &GPIO_InitStructure); /* USART1 Periph clock enable */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE); /* Configure USART1 for Rx with Baud Rate of 9600 */ USART1_InitStructure.USART_BaudRate = 9600; USART1_InitStructure.USART_WordLength = USART_WordLength_8b; USART1_InitStructure.USART_StopBits = USART_StopBits_1; USART1_InitStructure.USART_Parity = USART_Parity_No; USART1_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None; USART1_InitStructure.USART_Mode = USART_Mode_Tx; USART_Init(USART1, &USART1_InitStructure); /* Turn on USART1 */ USART_Cmd(USART1,ENABLE); /* Initialize Display */ DisplayLine ( 0, " " ); DisplayLine ( 1, " " ); DisplayLine ( 2, " " ); DisplayLine ( 3, " " ); //Enter UI forever UI_hl(); } //end main
int main(int argc,char **argv) { AppCtx user; /* user-defined work context */ PetscInt mx,my,its; PetscErrorCode ierr; MPI_Comm comm; SNES snes; DM da; Vec x,X,b; PetscBool youngflg,poissonflg,muflg,lambdaflg,view=PETSC_FALSE,viewline=PETSC_FALSE; PetscReal poisson=0.2,young=4e4; char filename[PETSC_MAX_PATH_LEN] = "ex16.vts"; char filename_def[PETSC_MAX_PATH_LEN] = "ex16_def.vts"; ierr = PetscInitialize(&argc,&argv,(char*)0,help);if (ierr) return ierr; ierr = FormElements();CHKERRQ(ierr); comm = PETSC_COMM_WORLD; ierr = SNESCreate(comm,&snes);CHKERRQ(ierr); ierr = DMDACreate3d(PETSC_COMM_WORLD,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DM_BOUNDARY_NONE,DMDA_STENCIL_BOX,11,2,2,PETSC_DECIDE,PETSC_DECIDE,PETSC_DECIDE,3,1,NULL,NULL,NULL,&da);CHKERRQ(ierr); ierr = DMSetFromOptions(da);CHKERRQ(ierr); ierr = DMSetUp(da);CHKERRQ(ierr); ierr = SNESSetDM(snes,(DM)da);CHKERRQ(ierr); ierr = SNESSetNGS(snes,NonlinearGS,&user);CHKERRQ(ierr); ierr = DMDAGetInfo(da,0,&mx,&my,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE,PETSC_IGNORE);CHKERRQ(ierr); user.loading = 0.0; user.arc = PETSC_PI/3.; user.mu = 4.0; user.lambda = 1.0; user.rad = 100.0; user.height = 3.; user.width = 1.; user.ploading = -5e3; ierr = PetscOptionsGetReal(NULL,NULL,"-arc",&user.arc,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-mu",&user.mu,&muflg);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-lambda",&user.lambda,&lambdaflg);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-rad",&user.rad,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-height",&user.height,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-width",&user.width,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-loading",&user.loading,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-ploading",&user.ploading,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-poisson",&poisson,&poissonflg);CHKERRQ(ierr); ierr = PetscOptionsGetReal(NULL,NULL,"-young",&young,&youngflg);CHKERRQ(ierr); if ((youngflg || poissonflg) || !(muflg || lambdaflg)) { /* set the lame' parameters based upon the poisson ratio and young's modulus */ user.lambda = poisson*young / ((1. + poisson)*(1. - 2.*poisson)); user.mu = young/(2.*(1. + poisson)); } ierr = PetscOptionsGetBool(NULL,NULL,"-view",&view,NULL);CHKERRQ(ierr); ierr = PetscOptionsGetBool(NULL,NULL,"-view_line",&viewline,NULL);CHKERRQ(ierr); ierr = DMDASetFieldName(da,0,"x_disp");CHKERRQ(ierr); ierr = DMDASetFieldName(da,1,"y_disp");CHKERRQ(ierr); ierr = DMDASetFieldName(da,2,"z_disp");CHKERRQ(ierr); ierr = DMSetApplicationContext(da,&user);CHKERRQ(ierr); ierr = DMDASNESSetFunctionLocal(da,INSERT_VALUES,(PetscErrorCode (*)(DMDALocalInfo*,void*,void*,void*))FormFunctionLocal,&user);CHKERRQ(ierr); ierr = DMDASNESSetJacobianLocal(da,(DMDASNESJacobian)FormJacobianLocal,&user);CHKERRQ(ierr); ierr = SNESSetFromOptions(snes);CHKERRQ(ierr); ierr = FormCoordinates(da,&user);CHKERRQ(ierr); ierr = DMCreateGlobalVector(da,&x);CHKERRQ(ierr); ierr = DMCreateGlobalVector(da,&b);CHKERRQ(ierr); ierr = InitialGuess(da,&user,x);CHKERRQ(ierr); ierr = FormRHS(da,&user,b);CHKERRQ(ierr); ierr = PetscPrintf(comm,"lambda: %f mu: %f\n",(double)user.lambda,(double)user.mu);CHKERRQ(ierr); /* show a cross-section of the initial state */ if (viewline) { ierr = DisplayLine(snes,x);CHKERRQ(ierr); } /* get the loaded configuration */ ierr = SNESSolve(snes,b,x);CHKERRQ(ierr); ierr = SNESGetIterationNumber(snes,&its);CHKERRQ(ierr); ierr = PetscPrintf(comm,"Number of SNES iterations = %D\n", its);CHKERRQ(ierr); ierr = SNESGetSolution(snes,&X);CHKERRQ(ierr); /* show a cross-section of the final state */ if (viewline) { ierr = DisplayLine(snes,X);CHKERRQ(ierr); } if (view) { PetscViewer viewer; Vec coords; ierr = PetscViewerVTKOpen(PETSC_COMM_WORLD,filename,FILE_MODE_WRITE,&viewer);CHKERRQ(ierr); ierr = VecView(x,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); ierr = DMGetCoordinates(da,&coords);CHKERRQ(ierr); ierr = VecAXPY(coords,1.0,x);CHKERRQ(ierr); ierr = PetscViewerVTKOpen(PETSC_COMM_WORLD,filename_def,FILE_MODE_WRITE,&viewer);CHKERRQ(ierr); ierr = VecView(x,viewer);CHKERRQ(ierr); ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); } ierr = VecDestroy(&x);CHKERRQ(ierr); ierr = VecDestroy(&b);CHKERRQ(ierr); ierr = DMDestroy(&da);CHKERRQ(ierr); ierr = SNESDestroy(&snes);CHKERRQ(ierr); ierr = PetscFinalize(); return ierr; }
void UI_hl(void) { int currentLevel = 1; int level1CurrentSelection = 0; int level2CurrentSelection = 0; int buttonFlag = 0; int rotaryPressFlag = 0; int rotaryFlag = 0; DisplayLine ( 0, " Manual " ); while ( 1 ) { switch ( Rotary () ) { case 0: // No change rotaryFlag = 0; break; case 1: // Clockwise if ( rotaryFlag == 1 ) break; rotaryFlag = 1; switch ( currentLevel ) { case 1: switch (level1CurrentSelection) { case 0: level1CurrentSelection = 1; DisplayLine ( 0, " Automode " ); break; case 1: level1CurrentSelection = 2; DisplayLine ( 0, " Bypass " ); break; case 2: level1CurrentSelection = 0; DisplayLine ( 0, " Manual " ); break; } break; case 2: switch (level1CurrentSelection) { case 0: if ( level2CurrentSelection == 4 ) level2CurrentSelection = 0; else level2CurrentSelection ++; switch ( level2CurrentSelection ) { case 0: DisplayLine ( 1, " Threshold " ); break; case 1: DisplayLine ( 1, " MakeUp Gain " ); break; case 2: DisplayLine ( 1, " Attack " ); break; case 3: DisplayLine ( 1, " Release " ); break; case 4: DisplayLine ( 1, " Ratio " ); break; } break; case 1: if ( autoEN == 1 ) { autoEN = 0; DisplayLine ( 1, " Disabled " ); } else { autoEN = 1; DisplayLine ( 1, " Enabled " ); } break; case 2: if ( bypassEN == 1 ) { bypassEN = 0; DisplayLine ( 1, " Disabled " ); } else { bypassEN = 1; DisplayLine ( 1, " Enabled " ); } break; } break; case 3: switch ( level2CurrentSelection ) { case 0: if ( threshold == thresholdMax ) break; threshold += thresholdStep; DisplayLine ( 2, DoubleToChar( threshold ) ); break; case 1: if ( mug == mugMax ) break; mug += mugStep; DisplayLine ( 2, DoubleToChar( mug ) ); break; case 2: if ( attack == attackMax) break; attack += attackStep; DisplayLine ( 2, DoubleToChar( attack ) ); break; case 3: if ( release == releaseMax ) break; release += releaseStep; DisplayLine ( 2, DoubleToChar( release ) ); break; case 4: if ( ratio == ratioMax ) break; ratio += ratioStep; DisplayLine ( 2, DoubleToChar( ratio ) ); break; default: break; } case 4: // No level 4, yet break; default: break; } case 2: // Counter-Clockwise if ( rotaryFlag == 1 ) break; rotaryFlag = 1; switch ( currentLevel ) { case 1: switch ( level1CurrentSelection ) { case 0: level1CurrentSelection = 2; DisplayLine ( 0, " Bypass " ); break; case 1: level1CurrentSelection = 0; DisplayLine ( 0, " Manual " ); break; case 2: level1CurrentSelection = 1; DisplayLine (0, " Automode " ); break; } break; case 2: switch ( level1CurrentSelection ) { case 0: if ( level2CurrentSelection == 0 ) level2CurrentSelection = 4; else level2CurrentSelection --; switch ( level2CurrentSelection ) { case 0: DisplayLine ( 1, " Threshold " ); break; case 1: DisplayLine ( 1, " MakeUp Gain " ); break; case 2: DisplayLine ( 1, " Attack " ); break; case 3: DisplayLine ( 1, " Release " ); break; case 4: DisplayLine ( 1, " Ratio " ); break; } break; case 1: if ( autoEN == 1 ) { autoEN = 0; DisplayLine ( 1, " Disabled " ); } else { autoEN = 1; DisplayLine ( 1, " Enabled " ); } break; case 2: if ( bypassEN == 1 ) { bypassEN = 0; DisplayLine ( 1, " Disabled " ); } else { bypassEN = 1; DisplayLine ( 1, " Enabled " ); } break; } break; case 3: switch ( level2CurrentSelection ) { case 0: if ( threshold == thresholdMin ) break; threshold -= thresholdStep; DisplayLine ( 2, DoubleToChar( threshold ) ); break; case 1: if ( mug == mugMin) break; mug -= mugStep; DisplayLine ( 2, DoubleToChar( mug ) ); break; case 2: if ( attack == attackMin ) break; attack -= attackStep; DisplayLine ( 2, DoubleToChar( attack ) ); break; case 3: if ( release == releaseMin ) break; release -= releaseStep; DisplayLine ( 2, DoubleToChar( release ) ); break; case 4: if ( ratio == ratioMin ) break; ratio -= ratioStep; DisplayLine ( 2, DoubleToChar( ratio ) ); break; default: break; } case 4: // No level 4, yet break; default: break; } default: break; } /* Rotary Button code */ //If flag is low and INPUT = HIGH, flag = HIGH if ( rotaryPressFlag == 0 ) { if( GPIO_ReadInputDataBit( GPIOE, GPIO_Pin_9 ) > 0 ) { rotaryPressFlag = 1; switch ( currentLevel ) { case 1: currentLevel ++; switch ( level1CurrentSelection ) { case 0: DisplayLine ( 1, " Threshold " ); level2CurrentSelection = 0; break; case 1: DisplayLine ( 1, " Disabled " ); break; case 2: DisplayLine ( 1, " Disabled " ); break; } break; case 2: if ( level1CurrentSelection == 0 ) currentLevel ++; break; case 3: // Do Nothing break; } } } //Otherwise, if flag = HIGH, wait until INPUT = LOW to reset flag else { if( GPIO_ReadInputDataBit( GPIOE, GPIO_Pin_9 ) == 0 ) { rotaryPressFlag = 0; } } /* Back Button code */ //If flag is low and INPUT = HIGH, flag = HIGH if ( buttonFlag == 0 ) { if( GPIO_ReadInputDataBit( GPIOE, GPIO_Pin_10 ) > 0 ) { buttonFlag = 1; switch ( currentLevel ) { case 1: // Do Nothing break; case 2: currentLevel-- ; DisplayLine ( 1, " " ); if ( autoEN == 1 ) autoEN = 0; if ( bypassEN == 1 ) bypassEN = 0; break; case 3: currentLevel-- ; DisplayLine ( 2, " " ); break; } } } //Otherwise, if flag = HIGH, wait until INPUT = LOW to reset flag else { if( GPIO_ReadInputDataBit( GPIOE, GPIO_Pin_10 ) == 0 ) { buttonFlag = 0; } } } //end while } //end UI_hl
static int _fastcall _list( LPTSTR pszFileName ) { register int c, i; TCHAR szDescription[512], szHeader[132], szLine[32]; long lTemp, lRow; POPWINDOWPTR wn = NULL; FILESEARCH dir; // get default normal and inverse attributes if ( gpIniptr->ListColor != 0 ) { SetScrColor( nScreenRows, nScreenColumns, gpIniptr->ListColor ); } // set colors GetAtt( (unsigned int *)&nNormal, (unsigned int *)&nInverse ); if ( gpIniptr->ListStatusColor != 0 ) nInverse = gpIniptr->ListStatusColor; // flip the first line to inverse video clear_header(); // open the file & initialize buffers if ( ListOpenFile( pszFileName )) return ERROR_EXIT; // kludge for empty files or pipes if ( LFile.lSize == 0L ) LFile.lSize = 1L; for ( ; ; ) { // display header if ( fDirtyHeader ) { clear_header(); sprintf( szHeader, LIST_HEADER, fname_part(LFile.szName), gchVerticalBar, gchVerticalBar, gchVerticalBar ); WriteStrAtt( 0, 0, nInverse, szHeader ); fDirtyHeader = 0; } // display location within file // (don't use color_printf() so we won't have // problems with windowed sessions) i = sprintf( szHeader, LIST_LINE, LFile.nListHorizOffset, LFile.lCurrentLine + gpIniptr->ListRowStart, (int)((( LFile.lViewPtr + 1 ) * 100 ) / LFile.lSize )); WriteStrAtt( 0, ( nScreenColumns - i ), nInverse, szHeader ); SetCurPos( 0, 0 ); if ( lListFlags & LIST_SEARCH ) { lListFlags &= ~LIST_SEARCH; fSearchFlags = 0; if ( lListFlags & LIST_REVERSE ) { c = LIST_FIND_CHAR_REVERSE; fSearchFlags |= FFIND_REVERSE_SEARCH; // goto the last row while ( ListMoveLine( 1 ) != 0 ) ; } else c = LIST_FIND_CHAR; if ( lListFlags & LIST_NOWILDCARDS ) fSearchFlags |= FFIND_NOWILDCARDS; bListSkipLine = 0; goto FindNext; } // get the key from the BIOS, because // STDIN might be redirected if ((( c = cvtkey( GetKeystroke( EDIT_NO_ECHO | EDIT_BIOS_KEY | EDIT_UC_SHIFT), MAP_GEN | MAP_LIST)) == (TCHAR)ESC )) break; switch ( c ) { case CTRLC: return CTRLC; case CUR_LEFT: case CTL_LEFT: if (( lListFlags & LIST_WRAP ) || ( LFile.nListHorizOffset == 0 )) goto bad_key; if (( LFile.nListHorizOffset -= (( c == CUR_LEFT ) ? 8 : 40 )) < 0 ) LFile.nListHorizOffset = 0; break; case CUR_RIGHT: case CTL_RIGHT: if (( lListFlags & LIST_WRAP ) || ( LFile.nListHorizOffset >= MAXLISTLINE + 1 )) goto bad_key; if ((LFile.nListHorizOffset += ((c == CUR_RIGHT) ? 8 : 40 )) > MAXLISTLINE + 1 ) LFile.nListHorizOffset = MAXLISTLINE+1; break; case CUR_UP: if ( ListMoveLine( -1 ) == 0 ) goto bad_key; Scroll(1, 0, nScreenRows, nScreenColumns, -1, nNormal); DisplayLine( 1, LFile.lViewPtr ); continue; case CUR_DOWN: if ( ListMoveLine( 1 ) == 0 ) goto bad_key; Scroll( 1, 0, nScreenRows, nScreenColumns, 1, nNormal ); // display last line lTemp = LFile.lViewPtr; lRow = (nScreenRows - 1); lTemp += MoveViewPtr( lTemp, &lRow ); if ( lRow == ( nScreenRows - 1 )) DisplayLine( nScreenRows, lTemp ); continue; case HOME: ListHome(); break; case END: // goto the last row list_wait( LIST_WAIT ); while ( ListMoveLine( 1 ) != 0 ) ; case PgUp: // already at TOF? if ( LFile.lViewPtr == 0L ) goto bad_key; for ( i = 1; (( i < nScreenRows ) && ( ListMoveLine( -1 ) != 0 )); i++ ) ; break; case PgDn: case SPACE: if ( ListMoveLine( nScreenRows - 1 ) == 0 ) goto bad_key; break; case F1: // help // don't allow a ^X exit from HELP _help( gpInternalName, HELP_NX ); continue; case TAB: // change tab size // disable ^C / ^BREAK handling HoldSignals(); wn = wOpen( 2, 5, 4, strlen( LIST_TABSIZE ) + 10, nInverse, LIST_TABSIZE_TITLE, NULL ); wn->nAttrib = nNormal; wClear(); wWriteListStr( 0, 1, wn, LIST_TABSIZE ); egets( szLine, 2, (EDIT_DIALOG | EDIT_BIOS_KEY | EDIT_NO_CRLF | EDIT_DIGITS)); wRemove( wn ); if (( i = atoi( szLine )) > 0 ) TABSIZE = i; // enable ^C / ^BREAK handling EnableSignals(); break; case DEL: // delete this file if (( lListFlags & LIST_STDIN ) == 0 ) { // disable ^C / ^BREAK handling HoldSignals(); wn = wOpen( 2, 5, 4, strlen( LIST_DELETE ) + 10, nInverse, LIST_DELETE_TITLE, NULL ); wn->nAttrib = nNormal; wClear(); wWriteListStr( 0, 1, wn, LIST_DELETE ); i = GetKeystroke( EDIT_ECHO | EDIT_BIOS_KEY | EDIT_UC_SHIFT ); wRemove( wn ); // enable ^C / ^BREAK handling EnableSignals(); if ( i == (TCHAR)YES_CHAR ) { if ( LFile.hHandle > 0 ) _close( LFile.hHandle ); LFile.hHandle = -1; remove( pszFileName ); return 0; } } break; case INS: // save to a file ListSaveFile(); break; case LIST_INFO_CHAR: { unsigned int uSize = 1024; TCHAR _far *lpszText, _far *lpszArg; int fFSType, fSFN = 1; TCHAR szBuf[16]; DOSFILEDATE laDir, crDir; // disable ^C / ^BREAK handling HoldSignals(); memset( &dir, '\0', sizeof(FILESEARCH) ); if (( lListFlags & LIST_STDIN ) == 0 ) { if ( find_file( FIND_FIRST, LFile.szName, 0x07 | FIND_CLOSE | FIND_EXACTLY, &dir, NULL ) == NULL ) { honk(); continue; } } // display info on the current file i = (( lListFlags & LIST_STDIN ) ? 5 : 10 ); if (( fFSType = ifs_type( LFile.szName )) != FAT ) i = 11; wn = wOpen( 2, 1, i, 77, nInverse, gpInternalName, NULL ); wn->nAttrib = nNormal; wClear(); i = 0; if ( lListFlags & LIST_STDIN ) wWriteStrAtt( 0, 1, nNormal, LIST_INFO_PIPE ); else { szDescription[0] = _TEXT('\0'); process_descriptions( LFile.szName, szDescription, DESCRIPTION_READ ); lpszText = lpszArg = (TCHAR _far *)AllocMem( &uSize ); strcpy(szBuf, FormatDate( dir.fd.file_date.months, dir.fd.file_date.days, dir.fd.file_date.years + 80, 0 )); if (fFSType != FAT) { FileTimeToDOSTime( &(dir.ftLastAccessTime), &( laDir.ft.wr_time), &( laDir.fd.wr_date) ); FileTimeToDOSTime( &(dir.ftCreationTime), &(crDir.ft.wr_time), &(crDir.fd.wr_date) ); strcpy( szLine, FormatDate( laDir.fd.file_date.months, laDir.fd.file_date.days, laDir.fd.file_date.years + 80, 0 )); sprintf_far( lpszText, LIST_INFO_LFN, LFile.szName, szDescription, dir.ulSize, szBuf, dir.ft.file_time.hours, gaCountryInfo.szTimeSeparator[0],dir.ft.file_time.minutes, szLine, laDir.ft.file_time.hours, gaCountryInfo.szTimeSeparator[0], laDir.ft.file_time.minutes, FormatDate( crDir.fd.file_date.months, crDir.fd.file_date.days, crDir.fd.file_date.years + 80, 0 ), crDir.ft.file_time.hours, gaCountryInfo.szTimeSeparator[0], crDir.ft.file_time.minutes); } else { sprintf_far( lpszText, LIST_INFO_FAT, LFile.szName, szDescription, dir.ulSize, szBuf, dir.ft.file_time.hours, gaCountryInfo.szTimeSeparator[0],dir.ft.file_time.minutes ); } // print the text for ( ; ( *lpszArg != _TEXT('\0') ); i++ ) { sscanf_far( lpszArg, _TEXT("%[^\n]%*c%n"), szHeader, &uSize ); // allow for long filenames ... if (( i == 0 ) && ( strlen( szHeader ) > 73 )) { c = szHeader[73]; szHeader[73] = _TEXT('\0'); wWriteStrAtt( i++, 1, nNormal, szHeader ); szHeader[73] = (TCHAR)c; wWriteStrAtt( i, 15, nNormal, szHeader+73 ); fSFN = 0; } else wWriteStrAtt( i, 1, nNormal, szHeader ); lpszArg += uSize; } FreeMem( lpszText ); } wWriteListStr( i+fSFN, 1, wn, PAUSE_PROMPT ); GetKeystroke( EDIT_NO_ECHO | EDIT_BIOS_KEY ); wRemove( wn ); // enable ^C / ^BREAK handling EnableSignals(); continue; } case LIST_GOTO_CHAR: // goto the specified line / hex offset // disable ^C / ^BREAK handling HoldSignals(); wn = wOpen( 2, 5, 4, strlen( LIST_GOTO_OFFSET ) + 20, nInverse, LIST_GOTO_TITLE, NULL ); wn->nAttrib = nNormal; wClear(); wWriteListStr( 0, 1, wn, (( lListFlags & LIST_HEX) ? LIST_GOTO_OFFSET : LIST_GOTO)); i = egets( szLine, 10, (EDIT_DIALOG | EDIT_BIOS_KEY | EDIT_NO_CRLF)); wRemove( wn ); // enable ^C / ^BREAK handling EnableSignals(); if ( i == 0 ) break; list_wait( LIST_WAIT ); // if in hex mode, jump to offset if ( lListFlags & LIST_HEX ) { strupr( szLine ); sscanf( szLine, _TEXT("%lx"), &lRow ); lRow = lRow / 0x10; } else if ( sscanf( szLine, FMT_LONG, &lRow ) == 0 ) continue; lRow -= gpIniptr->ListRowStart; if ( lRow >= 0 ) { LFile.lViewPtr = MoveViewPtr( 0L, &lRow ); LFile.lCurrentLine = lRow; } else { LFile.lViewPtr += MoveViewPtr( LFile.lViewPtr, &lRow ); LFile.lCurrentLine += lRow; } break; case LIST_HIBIT_CHAR: // toggle high bit filter lListFlags ^= LIST_HIBIT; break; case LIST_WRAP_CHAR: // toggle line wrap lListFlags ^= LIST_WRAP; nRightMargin = (( lListFlags & LIST_WRAP ) ? GetScrCols() : MAXLISTLINE ); // recalculate current line list_wait( LIST_WAIT ); // get start of line LFile.nListHorizOffset = 0; // line number probably changed, so recompute everything LFile.lCurrentLine = ComputeLines( 0L, LFile.lViewPtr ); LFile.lViewPtr = MoveViewPtr( 0L, &(LFile.lCurrentLine )); break; case LIST_HEX_CHAR: // toggle hex display lListFlags ^= LIST_HEX; // if hex, reset to previous 16-byte // boundary if ( lListFlags & LIST_HEX ) { LFile.lViewPtr -= ( LFile.lViewPtr % 16 ); } else { // if not hex, reset to start of line ListMoveLine( 1 ); ListMoveLine( -1 ); } // recalculate current line list_wait( LIST_WAIT ); LFile.lCurrentLine = ComputeLines( 0L, LFile.lViewPtr ); break; case LIST_FIND_CHAR: case LIST_FIND_CHAR_REVERSE: // find first matching string bListSkipLine = 0; //lint -fallthrough case LIST_FIND_NEXT_CHAR: case LIST_FIND_NEXT_CHAR_REVERSE: // find next matching string if (( c == LIST_FIND_CHAR ) || ( c == LIST_FIND_CHAR_REVERSE )) { // disable ^C / ^BREAK handling HoldSignals(); fSearchFlags = 0; wn = wOpen( 2, 1, 4, 75, nInverse, (( c == LIST_FIND_NEXT_CHAR_REVERSE ) ? LIST_FIND_TITLE_REVERSE : LIST_FIND_TITLE ), NULL ); wn->nAttrib = nNormal; wClear(); if ( lListFlags & LIST_HEX ) { wWriteListStr( 0, 1, wn, LIST_FIND_HEX ); if ( GetKeystroke( EDIT_ECHO | EDIT_BIOS_KEY | EDIT_UC_SHIFT ) == YES_CHAR ) fSearchFlags |= FFIND_HEX_SEARCH; wClear(); } wWriteListStr( 0, 1, wn, LIST_FIND ); egets( szListFindWhat, 64, (EDIT_DIALOG | EDIT_BIOS_KEY | EDIT_NO_CRLF)); wRemove( wn ); // enable ^C / ^BREAK handling EnableSignals(); } else { FindNext: // a "Next" has to be from current position fSearchFlags &= ~FFIND_TOPSEARCH; } if ( szListFindWhat[0] == _TEXT('\0') ) continue; sprintf( szDescription, LIST_FIND_WAIT, szListFindWhat ); list_wait( szDescription ); // save start position lTemp = LFile.lViewPtr; lRow = LFile.lCurrentLine; if (( c == LIST_FIND_CHAR_REVERSE ) || ( c == LIST_FIND_NEXT_CHAR_REVERSE )) { // start on the previous line fSearchFlags |= FFIND_REVERSE_SEARCH; } else { fSearchFlags &= ~FFIND_REVERSE_SEARCH; // skip the first line (except on /T"xxx") if ( bListSkipLine ) ListMoveLine( 1 ); } bListSkipLine = 1; if ( SearchFile( fSearchFlags ) != 1 ) { ListSetCurrent( lTemp ); LFile.lViewPtr = lTemp; LFile.lCurrentLine = lRow; } else LFile.fDisplaySearch = (( fSearchFlags & FFIND_CHECK_CASE ) ? 2 : 1 ); break; case LIST_PRINT_CHAR: // print the file ListPrintFile(); continue; case LIST_CONTINUE_CHAR: case CTL_PgDn: return 0; case LIST_PREVIOUS_CHAR: case CTL_PgUp: // previous file if ( nCurrent > 0 ) { nCurrent--; return 0; } //lint -fallthrough default: bad_key: honk(); continue; } // rewrite the display ListUpdateScreen(); } return 0; }