std::vector<CompileCommand> JSONCompilationDatabase::getCompileCommands(StringRef FilePath) const { llvm::SmallString<128> NativeFilePath; llvm::sys::path::native(FilePath, NativeFilePath); std::vector<StringRef> PossibleMatches; std::string Error; llvm::raw_string_ostream ES(Error); StringRef Match = MatchTrie.findEquivalent(NativeFilePath.str(), ES); if (Match.empty()) { if (Error.empty()) Error = "No match found."; llvm::outs() << Error << "\n"; return std::vector<CompileCommand>(); } llvm::StringMap< std::vector<CompileCommandRef> >::const_iterator CommandsRefI = IndexByFile.find(Match); if (CommandsRefI == IndexByFile.end()) return std::vector<CompileCommand>(); const std::vector<CompileCommandRef> &CommandsRef = CommandsRefI->getValue(); std::vector<CompileCommand> Commands; for (int I = 0, E = CommandsRef.size(); I != E; ++I) { llvm::SmallString<8> DirectoryStorage; llvm::SmallString<1024> CommandStorage; Commands.push_back(CompileCommand( // FIXME: Escape correctly: CommandsRef[I].first->getValue(DirectoryStorage), unescapeCommandLine(CommandsRef[I].second->getValue(CommandStorage)))); } return Commands; }
int ArchivePanel::AddFiles(const ArchiveItemArray& items, const TCHAR* lpSourceDiskPath, const TCHAR* lpConfig) { OnStartOperation(OPERATION_ADD, nullptr); string strSourceDiskPath = lpSourceDiskPath; AddEndSlash(strSourceDiskPath); int nResult = m_pArchive->AddFiles(items, strSourceDiskPath, lpConfig); if ( nResult == RESULT_ERROR ) { string strCommand; if ( GetCommand(COMMAND_ADD, strCommand) ) { ExecuteStruct ES(items); ES.lpCommand = strCommand; ES.lpCurrentDiskPath = strSourceDiskPath; nResult = m_pArchive->ExecuteAsOperation(OPERATION_ADD, ExecuteCommand, &ES); } } return nResult; }
//--------------------------------------------------------------------------- void File_Aac::Read_Buffer_Continue () { //Tags if (File_Offset==0) { if (!Skip_ID3v2()) return; } //Parsing headers if (Buffer_Size<=8) ES(); //AAC in ES (.MP4) else if (CC4(Buffer)==CC4("ADIF")) ADIF(); //ADIF header else if ((CC2(Buffer+Buffer_Offset)&0xFFF6)==0xFFF0) ADTS(); //ADTS header (12 bits + ID + 2 bits) else if (CC3(Buffer)==CC3("AAC")) AAC(); //AAC header //No need of more File_Offset=File_Size; //Tags #if defined(MEDIAINFO_ID3_YES) /* File_Id3 Id3; if (Id3.Open(CompleteFileName)<0) Id3.Open(Buffer, Id3v2_Size); Merge(Id3); */ #endif //ID3 }
bool ElasticityForce::evalForce (ElmMats& elmat, const Vec3& th, const FiniteElement& fe) const { // Integrate the nodal force vector Vector& ES = elmat.b.front(); size_t nsd = fe.dNdX.cols(); for (size_t a = 1; a <= fe.N.size(); a++) for (size_t d = 1; d <= nsd; d++) ES(nsd*(a-1)+d) += th[d-1]*fe.N(a)*fe.detJxW; return true; }
int ArchivePanel::MakeDirectory(const TCHAR* lpDirectory) { OnStartOperation(OPERATION_ADD, nullptr); int nResult = RESULT_ERROR; ArchiveItemArray items; ArchiveItem *item = items.add(); item->lpFileName = lpDirectory; item->dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; nResult = m_pArchive->AddFiles(items, _T(""), nullptr); if ( nResult == RESULT_ERROR ) { string strCommand; if ( GetCommand(COMMAND_ADD, strCommand) ) { string strTempPath; TCHAR* lpTempPath = strTempPath.GetBuffer(260); #ifdef UNICODE FSF.MkTemp(lpTempPath, 260, _T("NADT")); #else FSF.MkTemp(lpTempPath, _T("NADT")); #endif strTempPath.ReleaseBuffer(); string strFullTempPath = strTempPath; AddEndSlash(strFullTempPath); strFullTempPath += lpDirectory; apiCreateDirectoryEx(strFullTempPath); ExecuteStruct ES(items); ES.lpCurrentDiskPath = strTempPath; ES.lpCommand = strCommand; nResult = m_pArchive->ExecuteAsOperation(OPERATION_ADD, ExecuteCommand, &ES); } } return nResult; }
int ArchivePanel::Extract( const ArchiveItemArray& items, const TCHAR* lpDestDiskPath, bool bWithoutPath ) { OnStartOperation(OPERATION_EXTRACT, nullptr); string strDestDiskPath = lpDestDiskPath; AddEndSlash(strDestDiskPath); int nResult = m_pArchive->Extract(items, strDestDiskPath, bWithoutPath); if ( nResult == RESULT_ERROR ) { string strCommand; if ( GetCommand(bWithoutPath?COMMAND_EXTRACT_WITHOUT_PATH:COMMAND_EXTRACT, strCommand) ) { ExecuteStruct ES(items); ES.lpCommand = strCommand; ES.lpCurrentDiskPath = strDestDiskPath; nResult = m_pArchive->ExecuteAsOperation(OPERATION_EXTRACT, ExecuteCommand, &ES); } } if ( nResult == RESULT_ERROR ) msgError(_T("Extract failed")); if ( nResult == RESULT_PARTIAL ) msgError(_T("Extract succeded partially")); if ( nResult == RESULT_CANCEL ) msgError(_T("Extract was aborted by user")); // if ( nResult == RESULT_SUCCESS ) // msgError(_T("Extract success")); return nResult; }
int ArchivePanel::Test(const ArchiveItemArray& items) { OnStartOperation(OPERATION_TEST, nullptr); int nResult = m_pArchive->Test(items); if ( nResult == RESULT_ERROR ) { string strCommand; if ( GetCommand(COMMAND_TEST, strCommand) ) { ExecuteStruct ES(items); ES.lpCommand = strCommand; nResult = m_pArchive->ExecuteAsOperation(OPERATION_TEST, ExecuteCommand, &ES); } } return nResult; }
bool Elasticity::evalBou (LocalIntegral& elmInt, const FiniteElement& fe, const Vec3& X, const Vec3& normal) const { if (!tracFld && !fluxFld) { std::cerr <<" *** Elasticity::evalBou: No tractions."<< std::endl; return false; } else if (!eS) { std::cerr <<" *** Elasticity::evalBou: No load vector."<< std::endl; return false; } // Axi-symmetric integration point volume; 2*pi*r*|J|*w const double detJW = axiSymmetry ? 2.0*M_PI*X.x*fe.detJxW : fe.detJxW; // Evaluate the surface traction Vec3 T = this->getTraction(X,normal); // Store traction value for visualization if (fe.iGP < tracVal.size() && !T.isZero()) { tracVal[fe.iGP].first = X; tracVal[fe.iGP].second += T; } // Pull-back traction to reference configuration if (!this->pullBackTraction(T)) return false; // Integrate the force vector Vector& ES = static_cast<ElmMats&>(elmInt).b[eS-1]; for (size_t a = 1; a <= fe.N.size(); a++) for (unsigned short int i = 1; i <= nsd; i++) ES(nsd*(a-1)+i) += T[i-1]*fe.N(a)*detJW; return true; }
bool ElasticBase::evalPoint (LocalIntegral& elmInt, const FiniteElement& fe, const Vec3& pval) { if (!eS) { std::cerr <<" *** ElasticBase::evalPoint: No load vector."<< std::endl; return false; } Vector& ES = static_cast<ElmMats&>(elmInt).b[eS-1]; for (size_t a = 1; a <= fe.N.size(); a++) for (unsigned short int i = 1; i <= npv && i <= 3; i++) ES(npv*(a-1)+i) += pval(i)*fe.N(a)*fe.detJxW; if (eS == 1) { RealArray& sumLoad = static_cast<ElmMats&>(elmInt).c; for (size_t i = 0; i < sumLoad.size() && i < 3; i++) sumLoad[i] += pval[i]*fe.detJxW; } return true; }
StringRef find(StringRef Path) { llvm::raw_string_ostream ES(Error); return Trie.findEquivalent(Path, ES); }
* Mapping table -- please maintain in numeric sorted order with respect to * the BSM constant. Today we do a linear lookup, but could switch to a * binary search if it makes sense. We only ifdef errors that aren't * generally available, but it does make the table a lot more ugly. * * XXXRW: It would be nice to have a similar ordered table mapping to BSM * constant from local constant, but the order of local constants varies by * OS. Really we need to build that table at compile-time but don't do that * yet. * * XXXRW: We currently embed English-language error strings here, but should * support catalogues; these are only used if the OS doesn't have an error * string using strerror(3). */ static const struct bsm_errno bsm_errnos[] = { { BSM_ERRNO_ESUCCESS, 0, ES("Success") }, { BSM_ERRNO_EPERM, EPERM, ES("Operation not permitted") }, { BSM_ERRNO_ENOENT, ENOENT, ES("No such file or directory") }, { BSM_ERRNO_ESRCH, ESRCH, ES("No such process") }, { BSM_ERRNO_EINTR, EINTR, ES("Interrupted system call") }, { BSM_ERRNO_EIO, EIO, ES("Input/output error") }, { BSM_ERRNO_ENXIO, ENXIO, ES("Device not configured") }, { BSM_ERRNO_E2BIG, E2BIG, ES("Argument list too long") }, { BSM_ERRNO_ENOEXEC, ENOEXEC, ES("Exec format error") }, { BSM_ERRNO_EBADF, EBADF, ES("Bad file descriptor") }, { BSM_ERRNO_ECHILD, ECHILD, ES("No child processes") }, { BSM_ERRNO_EAGAIN, EAGAIN, ES("Resource temporarily unavailable") }, { BSM_ERRNO_ENOMEM, ENOMEM, ES("Cannot allocate memory") }, { BSM_ERRNO_EACCES, EACCES, ES("Permission denied") }, { BSM_ERRNO_EFAULT, EFAULT, ES("Bad address") }, { BSM_ERRNO_ENOTBLK, ENOTBLK, ES("Block device required") },
void Editor::Open(OpenMode mode) { AssertClosed(); if (ValueUserScreen::Get()) //???? { ValueUserScreen::Set(false); Far::Api->UI->SaveUserScreen(); } // strings PIN_ES(pinFileName, _FileName); PIN_ES(pinTitle, _Title); // frame int nLine = _frameStart.CaretLine >= 0 ? _frameStart.CaretLine + 1 : -1; int nPos = _frameStart.CaretColumn >= 0 ? _frameStart.CaretColumn + 1 : -1; // from dialog? set modal WindowKind wt = Far::Api->Window->Kind; if (wt == WindowKind::Dialog || Far::Api->UI->IsCommandMode) mode = OpenMode::Modal; // flags int flags = 0; if (ES(_FileName)) // Far 3.0.2400 flags |= EF_CREATENEW; if (_DisableHistory) flags |= EF_DISABLEHISTORY; switch(_Switching) { case FarNet::Switching::Enabled: flags |= VF_ENABLE_F6; break; case FarNet::Switching::Auto: if (_DeleteSource == FarNet::DeleteSource::None && _Closed == nullptr && _GotFocus == nullptr && _LosingFocus == nullptr && _Opened == nullptr && _Saving == nullptr && _KeyDown == nullptr && _KeyUp == nullptr && _MouseClick == nullptr && _MouseDoubleClick == nullptr && _MouseMove == nullptr && _MouseWheel == nullptr && _Redrawing == nullptr) flags |= VF_ENABLE_F6; break; } switch(_DeleteSource) { case FarNet::DeleteSource::UnusedFile: flags |= EF_DELETEONLYFILEONCLOSE; break; case FarNet::DeleteSource::UnusedFolder: flags |= EF_DELETEONCLOSE; break; } switch(mode) { case OpenMode::None: flags |= (EF_NONMODAL | EF_IMMEDIATERETURN); break; case OpenMode::Wait: flags |= EF_NONMODAL; break; } // open: // - set ID to -1 just in case if it is reopened; // - it fires READ event and the host sets the Id; // - in any case after this ID = -1 means an error _id = -1; Editor0::_editorWaiting = this; Info.Editor( pinFileName, pinTitle, _Window.Left, _Window.Top, _Window.Right, _Window.Bottom, flags, nLine, nPos, _CodePage); //?? test window values, make window settable // redraw Far if (wt == WindowKind::Dialog) Far::Api->UI->Redraw(); //! Check errors: ID must not be -1 (even if it is already closed then ID = -2). //! Using Far diagnostics fires false errors, e.g.: //! Test-CallStack-.ps1 \ s \ type: exit \ enter //! SVN tag 4.2.26 if (_id == -1) { // - error or a file was already opened in the editor and its window is activated Editor^ editor = Editor0::GetCurrentEditor(); if (editor) { String^ fileName1 = Path::GetFullPath(_FileName); String^ fileName2 = Path::GetFullPath(editor->_FileName); if (Compare(fileName1, fileName2) == 0) { // goto? if (nLine >= 0 || nPos >= 0) editor->GoTo(_frameStart.CaretColumn, _frameStart.CaretLine); return; } } throw gcnew InvalidOperationException("Cannot open the file '" + (FileName ? FileName : "<null>") + "'"); } }
int ArchivePanel::pProcessHostFile( const PluginPanelItem *PanelItem, int ItemsNumber, int OpMode ) { int nMenuItem = -1; if ( (nMenuItem = mnuChooseOperation()) == -1 ) return FALSE; int nCommand = -1; switch ( nMenuItem ) { case MENU_OPERATION_TEST: nCommand = COMMAND_TEST; break; case MENU_OPERATION_ADD_ARCHIVE_COMMENT: nCommand = COMMAND_ARCHIVE_COMMENT; break; case MENU_OPERATION_ADD_FILE_COMMENT: nCommand = COMMAND_FILE_COMMENT; break; case MENU_OPERATION_CONVERT_TO_SFX: nCommand = COMMAND_CONVERT_TO_SFX; break; case MENU_OPERATION_RECOVER: nCommand = COMMAND_RECOVER; break; case MENU_OPERATION_ADD_RECOVERY_RECORD: nCommand = COMMAND_ADD_RECOVERY_RECORD; break; case MENU_OPERATION_LOCK: nCommand = COMMAND_LOCK; break; }; if ( nCommand == -1 ) return FALSE; string strCommand; bool bCommandEnabled = GetCommand(nCommand, strCommand); bool bInternalTest = (nCommand == COMMAND_TEST) && m_pArchive->QueryCapability(AFF_SUPPORT_INTERNAL_TEST); if ( bCommandEnabled || bInternalTest ) { ArchiveItemArray items; if ( OptionIsOn(OpMode, OPM_TOPLEVEL) ) { ArchiveTreeNode* root = m_pArchive->GetRoot(); m_OS.uTotalSize = GetArchiveItemsToProcessFromNode(root, items); m_OS.uTotalFiles = items.count(); } else GetArchiveItemsToProcess(PanelItem, ItemsNumber, items); int nOperationResult = RESULT_ERROR; if ( bInternalTest ) nOperationResult = Test(items); if ( bCommandEnabled && (nOperationResult == RESULT_ERROR) ) { ExecuteStruct ES(items); ES.lpCommand = strCommand; nOperationResult = m_pArchive->ExecuteAsOperation(bInternalTest?OPERATION_TEST:OPERATION_OTHER, ExecuteCommand, &ES); } return nOperationResult == RESULT_SUCCESS; } return FALSE; }
/************************************************************************* module :[エンドセンサ監視] function :[ 1. エンドセンサ監視状態を見る 2. 監視中の状態変化を検出すると、パルスカウンタをクリアする 3. ミラーキャリッジの状態を変更する ** ADF読取り位置への移動中と初期化中以外の時にエンドセンサがOnすると ** ミラーキャリッジのエラーとする ] return :[] common :[] condition :[ 10ms割込みからコールされる ] comment :[] machine :[SH7043] language :[MS-C(Ver.6.0)] keyword :[SCN] date :[1996/07/08] author :[竹内茂樹] *************************************************************************/ void SCN_CheckEndSensor( void ) { UBYTE debug = FALSE; /* 1996/10/17 */ switch (SCN_WatchEndSensorStatus) { case WATCH_ES_ON: /* ADF読取り位置へ移動中にエンドセンサがOnすると、 ** G/Aの割込み間隔を初期ラッチで初期化して、モーターパルスカウンタを0クリアする ** モーター減速指示し、エンドセンサのOff待ちにする ** 輸送用の固定位置への移動もこの処理 1996/12/10 */ if ((SCN_MirrorCarriageStatus == MIRROR_MOVE_TO_ADF) && ES()) { SCN_MotorSpeedControl = SCN_MOTOR_SPEED_DOWN; SCN_AdjustMotorSpeed(); /* 1996/10/17 */ SCN_LatchMotorSpeedAndInterval(); SCN_MirrorMotorPulseCount = 0; SCN_WatchEndSensorStatus = WATCH_ES_OFF; inp( INTST1_PORT ); /* モーター割込み要因をクリアする 1996/10/17 */ } /* FBS1ページ読取り完了後の空送り中にエンドセンサがONすると、 ** ESからFBSシェーディング位置までのステップをG/Aにセットし、初期ラッチする ** モーターパルスカウンタを0クリアする ** エンドセンサOFFを監視する(但し、ES OFFを検知したらエラー) */ else if ((SCN_MirrorCarriageStatus == MIRROR_MOVE_TO_FBS_END) && ES()) { SCN_SetMotorIntStep( (UWORD)SYB_MaintenanceSwitch[MNT_SW_C7], SCN_MotorPointer->ExciteMethod ); SCN_LatchMotorSpeedAndInterval(); SCN_MirrorMotorPulseCount = 0; SCN_WatchEndSensorStatus = WATCH_ES_OFF; inp( INTST1_PORT ); /* モーター割込み要因をクリアする */ } break; case WATCH_ES_OFF: /* ADF読取り位置へ移動中にエンドセンサがOffすると、 ** ESからADF読み取り位置までのステップをG/Aにセットし、初期ラッチする ** モーターパルスカウンタを0クリアする ** モーター減速指示し、エンドセンサ監視を無効にする ** チャタリングを考慮して最終速度になってからOffを見る (通り過ぎないように) ** 輸送用の固定位置への移動もこの処理 1996/12/10 */ if ((SCN_MirrorCarriageStatus == MIRROR_MOVE_TO_ADF) && (SCN_MotorTablePoint == SCN_MotorPointer->LowSpeed) && !ES()) { if (debug) { SCN_SetSoftCTSCAN( SCN_ENABLE ); } SCN_WatchEndSensorStatus = WATCH_ES_DISABLE; SCN_SetMotorIntStep( SCN_StepFromES_Off, SCN_MotorPointer->ExciteMethod ); SCN_LatchMotorSpeedAndInterval(); SCN_MirrorMotorPulseCount = 0; inp( INTST1_PORT ); /* モーター割込み要因をクリアする 1996/10/17 */ } /* FBS1ページ読取り完了後の空送り中にエンドセンサがOFFすると、 ** ミラーキャリッジエラーとしてモーター減速指示する */ else if ((SCN_MirrorCarriageStatus == MIRROR_MOVE_TO_FBS_END) && !ES()) { SCN_MotorSpeedControl = SCN_MOTOR_SPEED_DOWN; SCN_MirrorMoveStatus = MIRROR_MOVE_ERROR; SYB_MaintenanceSwitch[MNT_SW_C5] = 6; /* エラーコードをセット */ } /* ミラーキャリッジ待機位置切り替え可能仕様 */ else if ((SCN_MirrorCarriageStatus == MIRROR_MOVE_FBS_END_TO_ADF) && !ES()) { /* SCN_MotorSpeedControl = SCN_MOTOR_SPEED_DOWN; */ SCN_SetMotorIntStep( SCN_StepFromES_Off, SCN_MotorPointer->ExciteMethod ); SCN_LatchMotorSpeedAndInterval(); SCN_WatchEndSensorStatus = WATCH_ES_DISABLE; SCN_MirrorMotorPulseCount = 0; } break; default: /* WATCH_ES_DISABLE */ /* エンドセンサの監視中でなくても、 ** ミラーがHS上へ移動中以外の時でエンドセンサがOnすると、 ** ミラーキャリッジエラーとしてモーター減速指示する */ if ((SCN_MirrorCarriageStatus != MIRROR_MOVE_TO_HS) && (SCN_MotorDriveMode == SCN_FBS) && ES()) { SCN_MotorSpeedControl = SCN_MOTOR_SPEED_DOWN; SCN_MirrorMoveStatus = MIRROR_MOVE_ERROR; /* ミラーエラーの状況: ** FBS読取り時Txモーターが停止位置を超えた ** エンドセンサが死んでる */ SYB_MaintenanceSwitch[MNT_SW_C5] = 6; /* エラーコードをセット */ /* ICHOU CHK_SetMirrorCarriageErrorCode( 6 ); */ } break; } }