WrapperStr UmlPackage::source_path(const WrapperStr & f) { if (!dir.read) { dir.src = cppSrcDir(); dir.h = cppHDir(); QDir d_root(rootDir(cppLanguage)); if (dir.src.isEmpty()) dir.src = RootDir; else if (QDir::isRelativePath(dir.src)) dir.src = d_root.filePath(dir.src); if (dir.h.isEmpty()) dir.h = RootDir; else if (QDir::isRelativePath(dir.h)) dir.h = d_root.filePath(dir.h); if (dir.src.isEmpty()) { UmlCom::trace(WrapperStr("<font color=\"red\"><b><b> The generation directory " "must be specified for the package<i> ") + name() + "</i>, edit the <i> generation settings</i> (tab 'directory') " "or edit the package (tab 'C++')</b></font><br>"); UmlCom::bye(n_errors() + 1); UmlCom::fatal_error("UmlPackage::source_path"); } dir.read = TRUE; } QDir d(dir.src); return WrapperStr(d.filePath(f).toLatin1().constData()) + WrapperStr(".") + CppSettings::sourceExtension(); }
slong hypgeom_estimate_terms(const mag_t z, int r, slong prec) { double y, t; t = mag_get_d(z); if (t == 0) return 1; if (r == 0) { if (t >= 1) { flint_printf("z must be smaller than 1\n"); abort(); } y = (log(1-t) - prec * LOG2) / log(t) + 1; } else { y = (prec * LOG2) / (d_root(t, r) * EXP1 * r); y = (prec * LOG2) / (r * d_lambertw(y)) + 1; } if (y >= WORD_MAX / 2) { flint_printf("error: series will converge too slowly\n"); abort(); } return y; }
Q3CString UmlPackage::path(const Q3CString & f) { if (!read) { dir = idlDir(); if (! RootDirRead) { RootDirRead = TRUE; RootDir = IdlSettings::rootDir(); if (!RootDir.isEmpty() && // empty -> error QDir::isRelativePath(RootDir)) { QFileInfo f(getProject()->supportFile()); QDir d(f.dirPath()); RootDir = d.filePath(RootDir); } } QDir d_root(RootDir); if (dir.isEmpty()) dir = RootDir; else if (QDir::isRelativePath(dir)) dir = d_root.filePath(dir); if (dir.isEmpty()) { UmlCom::trace(Q3CString("<font color=\"red\"><b><b> The generation directory " "must be specified for the package<i> ") + name() + "</i>, edit the <i> generation settings</i> (tab 'directory') " "or edit the package (tab 'Idl')</b></font><br>"); UmlCom::bye(n_errors() + 1); UmlCom::fatal_error("UmlPackage::file_path"); } if (QDir::isRelativePath(dir)) { UmlCom::trace(Q3CString("<font color=\"red\"><b><i>") + name() + "</i>'s source path <i>(" + dir + "</i>) is not absolute, edit the <i> generation settings</i> " "(tab 'directory'), or edit the package (tab 'Idl')</b></font><br>"); UmlCom::bye(n_errors() + 1); UmlCom::fatal_error("UmlPackage::file_path"); } read = TRUE; } QDir d(dir); if (! d.exists()) create_directory(dir); // don't return on error return Q3CString(d.filePath(f).toAscii().constData()) + Q3CString(".") + IdlSettings::sourceExtension(); }
WrapperStr UmlPackage::source_path(const WrapperStr & f, WrapperStr relto) { if (!dir.read) { dir.src = cppSrcDir(); dir.h = cppHDir(); dir.src_absolute = dir.h_absolute = FALSE; QDir d_root(rootDir()); if (dir.src.isEmpty()) // considered given relative dir.src = RootDir; else if (QDir::isRelativePath(dir.src)) dir.src = d_root.filePath(dir.src); else dir.src_absolute = TRUE; if (dir.h.isEmpty()) // considered given relative dir.h = RootDir; else if (QDir::isRelativePath(dir.h)) dir.h = d_root.filePath(dir.h); else dir.h_absolute = TRUE; if (dir.src.isEmpty()) { UmlCom::trace(WrapperStr("<font color=\"red\"><b><b> The generation directory " "must be specified for the package<i> ") + name() + "</i>, edit the <i> generation settings</i> (tab 'directory') " "or edit the package (tab 'C++')</b></font><br>"); UmlCom::bye(n_errors() + 1); UmlCom::fatal_error("UmlPackage::source_path"); } dir.read = TRUE; } if (f.isEmpty()) return dir.src; QDir d(dir.src); if (! d.exists()) create_directory(dir.src); // don't return on error QByteArray temp = d.filePath(f).toLatin1(); WrapperStr df = (dir.src_absolute || relto.isEmpty()) ? WrapperStr(temp.constData()) : relative_path(d, relto) + f; return df + WrapperStr(".") + CppSettings::sourceExtension(); }
QString BrowserArtifact::get_path(QString path, QString root, const char * ext) const { if (QDir::isRelativePath(root)) root = BrowserView::get_dir().filePath(root); QDir d_root(root); if (path.isEmpty()) path = root; else if (QDir::isRelativePath(path)) path = d_root.filePath(path); if (path.isEmpty() || QDir::isRelativePath(path)) return QString(); QDir d(path); path = (ext != 0) ? d.filePath(name + "." + ext) : d.filePath(name); return (QFile::exists(path)) ? path : QString(); }
QCString UmlPackage::file_path(const QCString & f) { if (!dir.read) { dir.file = pythonDir(); if (! RootDirRead) { RootDirRead = TRUE; RootDir = PythonSettings::rootDir(); if (!RootDir.isEmpty() && // empty -> error QDir::isRelativePath(RootDir)) { QFileInfo f(getProject()->supportFile()); QDir d(f.dirPath()); RootDir = d.filePath(RootDir); } } QDir d_root(RootDir); if (dir.file.isEmpty()) dir.file = RootDir; else if (QDir::isRelativePath(dir.file)) dir.file = d_root.filePath(dir.file); if (dir.file.isEmpty()) { UmlCom::trace(QCString("<font color=\"red\"><b><b> The generation directory " "must be specified for the package<i> ") + name() + "</i>, edit the <i> generation settings</i> (tab 'directory') " "or edit the package (tab 'Python')</b></font><br>"); UmlCom::bye(n_errors() + 1); UmlCom::fatal_error("UmlPackage::file_path"); } dir.read = TRUE; } QDir d(dir.file); if (! d.exists()) { // create directory including the intermediates QCString s = dir.file; int index = 0; char sep = QDir::separator(); if (sep != '/') { while ((index = s.find(sep, index)) != -1) s.replace(index++, 1, "/"); } s = QDir::cleanDirPath(s) + "/"; index = s.find("/"); int index2; while ((index2 = s.find("/", index + 1)) != -1) { QCString s2 = s.left(index2); QDir sd(s2); if (!sd.exists()) { if (!sd.mkdir(s2)) { UmlCom::trace(QCString("<font color=\"red\"><b> cannot create directory <i>") + s2 + "</i></b></font><br>"); UmlCom::bye(n_errors() + 1); UmlCom::fatal_error("UmlPackage::file_path"); } } index = index2; } } return QCString(d.filePath(f)) + QCString(".") + PythonSettings::sourceExtension(); }
Q3CString UmlPackage::file_path(const Q3CString & f, Q3CString relto) { if (!dir.read) { dir.file = phpDir(); dir.file_absolute = FALSE; QDir d_root(rootDir()); if (dir.file.isEmpty()) dir.file = RootDir; else if (QDir::isRelativePath(dir.file)) dir.file = d_root.filePath(dir.file); else dir.file_absolute = TRUE; if (dir.file.isEmpty()) { UmlCom::trace(Q3CString("<font color=\"red\"><b><b> The generation directory " "must be specified for the package<i> ") + name() + "</i>, edit the <i> generation settings</i> (tab 'directory') " "or edit the package (tab 'Php')</b></font><br>"); UmlCom::bye(n_errors() + 1); UmlCom::fatal_error("UmlPackage::file_path"); } dir.read = TRUE; } if (f.isEmpty()) return dir.file; QDir d(dir.file); if (! d.exists()) { // create directory including the intermediates Q3CString s = dir.file; int index = 0; QChar sep = QDir::separator(); if (sep != '/') { while ((index = s.find(sep, index)) != -1) s.replace(index++, 1, "/"); } s = QDir::cleanDirPath(s) + "/"; index = s.find("/"); int index2; while ((index2 = s.find("/", index + 1)) != -1) { Q3CString s2 = s.left(index2); QDir sd(s2); if (!sd.exists()) { if (!sd.mkdir(s2)) { UmlCom::trace(Q3CString("<font color=\"red\"><b> cannot create directory <i>") + s2 + "</i></b></font><br>"); UmlCom::bye(n_errors() + 1); UmlCom::fatal_error("UmlPackage::file_path"); } } index = index2; } } Q3CString df = (dir.file_absolute || relto.isEmpty()) ? Q3CString(d.filePath(f).toAscii().constData()) : relative_path(d, relto) + f; if (PhpSettings::isRelativePath() && (df[0] != '/') && (df[0] != '.')) df = "./" + df; return df + Q3CString(".") + PhpSettings::sourceExtension(); }