void JWebBrowser::ShowFileLocations ( const JPtrArray<JString>& fileList ) { if (fileList.IsEmpty()) { return; } const JSize count = fileList.GetElementCount(); if (itsShowFileLocationCmd.Contains("$")) { for (JIndex i=1; i<=count; i++) { ShowFileLocation(*(fileList.NthElement(i))); } } else { JString s = itsShowFileLocationCmd; for (JIndex i=1; i<=count; i++) { s += " '"; s += *(fileList.NthElement(i)); s += "'"; } JSimpleProcess::Create(s, kJTrue); } }
JBoolean ShouldGenerateForm ( const JString& form, const JPtrArray<JString>& list ) { if (list.IsEmpty()) { return kJTrue; } const JSize count = list.GetElementCount(); for (JIndex i=1; i<=count; i++) { if (form == *(list.NthElement(i))) { return kJTrue; } } return kJFalse; }
void JXFSBindingManager::Exec ( const JPtrArray<JString>& fileList, const JBoolean ignoreBindings ) { if (fileList.IsEmpty()) { return; } JXFSBindingManager* me = Instance(); if (me->itsFileList == NULL) { me->itsFileList = new JPtrArray<JFSBinding>(JPtrArrayT::kDeleteAll); assert( me->itsFileList != NULL ); me->itsFileList->SetCompareFunction(ComparePatterns); } const JSize count = fileList.GetElementCount(); for (JIndex i=1; i<=count; i++) { const JString* fileName = fileList.NthElement(i); JFSBinding* f = new JFSBinding(*fileName, "", JFSBinding::kRunPlain, kJTrue, kJFalse); assert( f != NULL ); if (!me->itsFileList->InsertSorted(f, kJFalse)) { delete f; } } me->itsIgnoreBindingsFlag = ignoreBindings; me->ProcessFiles(); }
JBoolean CBSymbolList::ConvertToFullNames ( JArray<JIndex>* noContextList, JArray<JIndex>* contextList, const JString& contextNamespace1, const JString& contextNamespace2, const CBLanguage contextLang, const JPtrArray<JString>& cContextNamespaceList, const JPtrArray<JString>& javaContextNamespaceList ) const { const JBoolean useLangNSContext = !contextNamespace1.IsEmpty(); const JBoolean useCNSContext = !cContextNamespaceList.IsEmpty(); const JBoolean useJavaNSContext = !javaContextNamespaceList.IsEmpty(); // substitute indicies of fully qualified symbols // and filter based on namespace context const JSize symCount = itsSymbolList->GetElementCount(); const SymbolInfo* sym = itsSymbolList->GetCArray(); const JSize count = noContextList->GetElementCount(); JString s1, s2; for (JIndex i=count; i>=1; i--) { const JIndex j = noContextList->GetElement(i) - 1; const SymbolInfo& info = sym[j]; const JBoolean caseSens = CBIsCaseSensitive(info.lang); s1 = "." + *(info.name); s2 = ":" + *(info.name); for (JIndex k=0; k<symCount; k++) { if (k != j && sym[k].fileID == info.fileID && sym[k].lineIndex == info.lineIndex && ((sym[k].name)->EndsWith(s1, caseSens) || (sym[k].name)->EndsWith(s2, caseSens))) { if ((info.lang == kCBCLang && useCNSContext && !InContext(*(sym[k].name), cContextNamespaceList, kJTrue)) || (info.lang == kCBJavaLang && useJavaNSContext && !InContext(*(sym[k].name), javaContextNamespaceList, kJTrue)) || (info.lang == contextLang && useLangNSContext && !(sym[k].name)->BeginsWith(contextNamespace1, caseSens) && !(sym[k].name)->Contains(contextNamespace2, caseSens))) { contextList->RemoveElement(i); } else { contextList->SetElement(i, k+1); } noContextList->SetElement(i, k+1); break; } } } return !contextList->IsEmpty(); }
JError CBSearchDocument::Create ( const JPtrArray<JString>& fileList, const JPtrArray<JString>& nameList, const JCharacter* searchStr, const JBoolean onlyListFiles, const JBoolean listFilesWithoutMatch ) { assert( !fileList.IsEmpty() ); assert( fileList.GetElementCount() == nameList.GetElementCount() ); int fd[2]; JError err = JCreatePipe(fd); if (!err.OK()) { return err; } pid_t pid; err = JThisProcess::Fork(&pid); if (!err.OK()) { return err; } // child else if (pid == 0) { close(fd[0]); // get rid of JXCreatePG, since we must not use X connection // (binary files may trigger it) JInitCore(); CBSearchTE te; JOutPipeStream output(fd[1], kJTrue); te.SearchFiles(fileList, nameList, onlyListFiles, listFilesWithoutMatch, output); output.close(); exit(0); } // parent else { close(fd[1]); JProcess* process = jnew JProcess(pid); assert( process != NULL ); const JCharacter* map[] = { "s", searchStr }; const JString windowTitle = JGetString("SearchTitle::CBSearchDocument", map, sizeof(map)); CBSearchDocument* doc = jnew CBSearchDocument(kJFalse, JI2B(onlyListFiles || listFilesWithoutMatch), fileList.GetElementCount(), process, fd[0], windowTitle); assert( doc != NULL ); doc->Activate(); RecordLink* link; const JBoolean ok = doc->GetRecordLink(&link); assert( ok ); CBSearchTE::SetProtocol(link); } return JNoError(); }