bool StreamReaderUnix::ProcessCSI(InputData& in) { static ExtKeyMap gExtKeyMap; if (gExtKeyMap.empty()) { // Gnome xterm gExtKeyMap['[']['A'] = InputData::kEIUp; gExtKeyMap['[']['B'] = InputData::kEIDown; gExtKeyMap['[']['C'] = InputData::kEIRight; gExtKeyMap['[']['D'] = InputData::kEILeft; gExtKeyMap['[']['F'] = InputData::kEIEnd; // Savannah 83478 gExtKeyMap['[']['H'] = InputData::kEIHome; gExtKeyMap['[']['O']['F'] = InputData::kEIEnd; gExtKeyMap['[']['O']['H'] = InputData::kEIHome; gExtKeyMap['[']['1']['~'] = InputData::kEIHome; gExtKeyMap['[']['2']['~'] = InputData::kEIIns; gExtKeyMap['[']['3']['~'] = InputData::kEIDel; gExtKeyMap['[']['4']['~'] = InputData::kEIEnd; gExtKeyMap['[']['5']['~'] = InputData::kEIPgUp; gExtKeyMap['[']['6']['~'] = InputData::kEIPgDown; gExtKeyMap['[']['1'][';']['5']['A'].Set(InputData::kEIUp, InputData::kModCtrl); gExtKeyMap['[']['1'][';']['5']['B'].Set(InputData::kEIDown, InputData::kModCtrl); gExtKeyMap['[']['1'][';']['5']['C'].Set(InputData::kEIRight, InputData::kModCtrl); gExtKeyMap['[']['1'][';']['5']['D'].Set(InputData::kEILeft, InputData::kModCtrl); // MacOS gExtKeyMap['O']['A'] = InputData::kEIUp; gExtKeyMap['O']['B'] = InputData::kEIDown; gExtKeyMap['O']['C'] = InputData::kEIRight; gExtKeyMap['O']['D'] = InputData::kEILeft; gExtKeyMap['O']['F'] = InputData::kEIEnd; gExtKeyMap['O']['H'] = InputData::kEIHome; gExtKeyMap['[']['5']['C'].Set(InputData::kEIRight, InputData::kModCtrl); gExtKeyMap['[']['5']['D'].Set(InputData::kEILeft, InputData::kModCtrl); } InputData::EExtendedInput ret = InputData::kEIUninitialized; char mod = 0; Rewind rwd(fReadAheadBuffer, ret); ExtKeyMap* EKM = &gExtKeyMap; while (EKM) { if (EKM->haveExtInp()) { ret = EKM->getExtInp(); mod = EKM->getMod(); EKM = 0; } else { char c1 = ReadRawCharacter(); rwd.push(c1); EKM = EKM->find(c1); } } in.SetExtended(ret); in.SetModifier(mod); return ret != InputData::kEIUninitialized; }
int CTestRTFTablePostProcessor::CheckResults(CRtfDocumentChainBuilder& builder, CChainElement* pIter, bool &bFoundJoin) { int iTableCount = 0; while (pIter) { RtfObjectTypes rotType = (RtfObjectTypes)pIter->GetType(); if (rotType == ROT_Table) { iTableCount++; CRTF_Table* pTable = (CRTF_Table *)pIter; if (pTable->m_TableSplittingWhitespace[0] != NULL) { bFoundJoin = true; OutputFileData outputFile; outputFile.SetWriteToBuffer(true); RtfWriterData rwd(pIter->GetFileContext(), outputFile, NULL, true, &builder); RtfWriterInfo info(pIter->GetFileContext(), false, false); RTFObjectCollection* pColl = new RTFObjectCollection(rotFieldInst,(pIter->GetFileContext())); rwd.m_pRoot = pColl; pTable->WriteRtf(rwd, info); assertMessage(rwd.GetCollectionSize() > 0, _T("Should have written something")); // pColl->GetCount() > 0 assertMessage(pColl->At(0)->GetType() == rotTable, _T("Should be a table here")); const RTFTable* pTable2 = (const RTFTable *)pColl->At(0); assertMessage(pTable2->m_pTableSplittingWhitespace.size() > 0, _T("Should have some objects")); assertMessage(pTable2->m_pTableSplittingWhitespace[0] != NULL, _T("Should have transferred the whitespace paraPluses")); rwd.m_bIgnoreWrittenCountsSoTestsCanCleanUpProperly = true; rwd.DisassembleWriterData(pColl); for (int i=0; i<pColl->GetCount(); i++) pColl->DetachObject(i); delete pColl; } else if ( pTable->GetCellCount() == 1) { CRTF_Cell* pCell = pTable->Cell(0); CChainElement* pInnerIter = pCell->GetContent(); iTableCount += CheckResults(builder, pInnerIter, bFoundJoin); } } pIter=pIter->GetNext(); } return iTableCount; }
int saveDir(struct NODE *inputCWD, char *outputFile){ struct NODE *Temp; FILE *outfile; outfile = fopen(outputFile, "a"); //appends file // fprintf(outfile, "\n"); fclose(outfile); rwd(inputCWD, outputFile); // writes cwd to file outfile = fopen(outputFile, "a"); //appends file fprintf(outfile, "\n"); if(inputCWD->childPtr){ Temp = inputCWD->childPtr; if(*Temp->Type == 'F'){ // checking to see if first childPtr of inputCWD is a file fprintf(outfile, "\n"); fprintf(outfile, "~%s", Temp->Name); } while(Temp->siblingPtr){ // going through directory and fprintf all files within Temp = Temp->siblingPtr; if(*Temp->Type == 'F'){ // checking to see if first childPtr of inputCWD is a file fprintf(outfile, "~%s", Temp->Name); } } fprintf(outfile, "\n"); fclose(outfile); // Now we recursively print the folders within the input directory Temp = inputCWD->childPtr; if(*Temp->Type == 'D'){ // checking to see if first childPtr of inputCWD is a file saveDir(Temp, outputFile); } while(Temp->siblingPtr){ // going through directory and fprintf all files within Temp = Temp->siblingPtr; if(*Temp->Type == 'D'){ // checking to see if first childPtr of inputCWD is a file // outfile = fopen(outputFile, "a"); //appends file // fprintf(outfile, "\n"); // fclose(outfile); saveDir(Temp, outputFile); } } } return 1; }