27 #if defined (HAVE_CONFIG_H)
57 QFileInfo info (infoPath);
59 bool info_file_exists = info.exists ();
60 QHash<QString, QString>::iterator it;
65 info_file_exists = QFileInfo (info.absoluteFilePath () +
"." +
71 QString path = info.absolutePath ();
72 QString fileName = info.fileName ();
76 filter.append (fileName +
"*");
78 _info_files = infoDir.entryInfoList (filter, QDir::Files);
97 QIODevice *iodevice = 0;
101 file_info.absoluteFilePath ());
112 ips.read (buffer,
sizeof (buffer));
113 result.append (buffer, ips.gcount ());
116 QBuffer *io =
new QBuffer (
this);
117 io->setData (result);
119 if (! io->open (QIODevice::ReadOnly | QIODevice::Text))
126 QFile *io =
new QFile (file_info.absoluteFilePath ());
127 if (! io->open (QIODevice::ReadOnly | QIODevice::Text))
154 QString node = node_arg;
181 if (! text.isEmpty())
196 while (! io->atEnd ())
212 QByteArray
line, line_buffer;
216 while (! io->atEnd ())
223 line = io->readLine ();
228 line_buffer = io->readLine ();
229 line = io->readLine ();
230 for (i=1; i<line_buffer.size ()+6; i++)
231 line.insert (line.size ()-1,QByteArray(
" "));
234 if (line.at (0) ==
'"' && line.size () == 5)
237 if (line.at(0) == 31)
243 text.append (QString::fromUtf8 (line));
252 int n = text.indexOf (
"\n");
259 QString first_line = text.left (n);
267 QStringList nodes = firstLine.split (
",");
268 for (
int i = 0;
i < nodes.size ();
i++)
270 QString node = nodes.at (
i).trimmed ();
272 if (node.startsWith (node_name))
274 return node.remove (0, node_name.size ()).trimmed ();
307 QRegExp re (
"(\\*[N|n]ote|\n\\*)([ |\n]+)([^:]+):([^:\\.,]*)([:,\\.]+)");
310 while ((i = re.indexIn (text,i)) != -1)
312 QString
type = re.cap (1);
313 QString note = re.cap (3);
314 QString url_link = re.cap (4);
315 QString term = re.cap (5);
317 if (url_link.isEmpty ())
322 term.replace(
":",
"");
323 note.replace(
":",
"");
324 note.replace (QRegExp (
"`([^']+)'"),
"\\1");
326 QRegExp re_break (
"(\n[ ]*)");
328 if (note ==
"fig" || note ==
"tab")
329 url_link.prepend(
"#");
335 if (re_break.indexIn (url_link) != -1)
336 term += re_break.cap (1);
337 else if (re_break.indexIn (re.cap (2)) != -1)
338 href = re_break.cap (1) +
" ";
339 else if (re_break.indexIn (note) != -1)
340 term += re_break.cap (1);
341 note.replace(re_break,
" ");
343 url_link = url_link.trimmed ();
344 url_link.replace (
"\n",
" ");
345 url_link.replace (QRegExp (
" +"),
" ");
346 url_link.replace (
"<b>",
"");
347 url_link.replace (
"</b>",
"");
349 href +=
"<font style=\"color:DarkGray; font-weight:bold;\">»</font>";
350 href +=
" <a href='" + url_link +
"'>" + note +
"</a>" + term;
351 f = re.matchedLength ();
352 text.replace (i,
f,href);
360 QRegExp re (
"`([^']+)'");
362 while ((i = re.indexIn (text, i)) != -1)
364 QString
t = re.cap (1);
365 QString bold =
"<font style=\"color:SteelBlue;font-weight:bold\">" + t +
368 f = re.matchedLength ();
369 text.replace (i,
f,bold);
377 text.replace (
"&",
"&");
378 text.replace (
"<",
"<");
379 text.replace (
">",
">");
381 text.replace (
"\n* Menu:",
382 "\n<font style=\"color:DarkRed;font-weight:bold\">Menu:</font>");
383 text.replace (
"See also:",
384 "<font style=\"color:DarkRed;font-style:italic;font-weight:bold\">See also:</font>");
391 const QString& anchor)
393 QString
text = text_arg;
402 QString text1 = text.left (anchorPos);
403 QString text2 = text.mid (anchorPos);
405 int n = text1.indexOf (
"\n");
411 text = text1 +
"<a name='" + anchor
412 +
"'/><font style=\"color:DarkBlue; font: bold monospace large;\">♦</font><br> "
417 int n = text.indexOf (
"\n");
422 QString navigationLinks = QString (
423 "<b>Section:</b> <font style=\"color:DarkRed\">%1</font><br>"
424 "<b>Previous Section:</b> <a href='%2'>%3</a><br>"
425 "<b>Next Section:</b> <a href='%4'>%5</a><br>"
426 "<b>Up:</b> <a href='%6'>%7</a><br>\n"
428 .arg (nodeName, nodePrev, nodePrev, nodeNext, nodeNext, nodeUp, nodeUp);
430 text.prepend (
"<hr>\n<pre style=\"font-family:monospace\">");
431 text.append (
"</pre>\n<hr><hr>\n");
432 text.prepend (navigationLinks);
433 text.append (navigationLinks);
434 text.prepend (
"<html><body>\n");
435 text.append (
"</body></html>\n");
444 QRegExp re (
"(Node|Ref): ([^\\0177]+)\\0177(\\d+)\n");
445 QRegExp re_files (
"([^:]+): (\\d+)\n");
459 while (! (nodeText=
get_next_node (io)).isEmpty () && foundCount < 2)
462 if (first_line.startsWith (
"Tag"))
468 while ((pos = re.indexIn (nodeText, pos)) != -1)
470 QString
type = re.cap (1);
471 QString node = re.cap (2);
472 int index = re.cap (3).toInt ();
481 else if (type ==
"Ref")
488 pos += re.matchedLength ();
492 else if (first_line.startsWith (
"Indirect:"))
497 while ((pos = re_files.indexIn (nodeText, pos)) != -1)
499 QString fileCap = re_files.cap (1).trimmed ();
500 int index = re_files.cap (2).toInt ();
506 if (info.fileName ().startsWith (fileCap))
514 pos += re_files.matchedLength ();
546 real_pos = pos - sum + header + 2;
553 while (! io->atEnd () && pos > 0)
565 while ((pos = re.indexIn (text, pos)) != -1)
567 QString cap = text.mid (pos,re.matchedLength ());
570 text.remove (pos, re.matchedLength ());
571 text.insert (pos, a);
580 QStringList
words = text.split (
" ",QString::SkipEmptyParts);
582 QString re_program (
"(" + QRegExp::escape (words.at (0)));
583 for (
int i = 1;
i < words.size ();
i++)
585 re_program +=
"|" + QRegExp::escape (words.at (
i));
589 QRegExp re (re_program, Qt::CaseInsensitive);
591 results.append (
"<html><body>\n<h1>Search results</h1>\n<b>Results for:</b> ");
592 results.append (text);
593 results.append (
"<br>\n");
614 int n = node_text.indexOf (
"\n");
615 node_text.remove (0, n);
620 for (; founds < words.size ()
621 && node_text.indexOf (words.at (founds)) >= 0; founds++)
624 if (founds<words.size ())
630 while ((pos = re.indexIn (node_text, pos)) != -1
631 && founds < max_founds)
633 int line_start, line_end;
634 line_start = node_text.lastIndexOf (
"\n", pos);
635 line_end = node_text.indexOf (
"\n", pos);
636 QString
line = node_text.mid (line_start,
637 line_end - line_start).trimmed ();
638 pos += re.matchedLength ();
643 "<br>\n<font style=\"color:DarkGray; font-weight:bold;\">»</font> <a href='"
646 results.append (node);
647 results.append (
"</a><br>\n");
650 replace (line, re,
"<i>%1</i>");
651 results.append (line);
652 results.append (
"<br>\n");
661 results.append (
"</body></html>");
670 QHash<QString,node_position>::iterator it;
673 QString
k = it.key ();
676 if (k ==
"XREF" + ref_name)
679 text =
"XREF" + ref_name;
686 QHash<QString, node_map_item>::iterator itn;
689 QString
k = itn.key ();
690 if (k ==
"The " + ref_name +
" Statement")
QList< info_file_item > _info_file_real_size_list
QString get_node_name(const QString &text)
the element is set to zero In other words
void seek(QIODevice *io, int pos)
Seeks to position pos.
F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_REAL const F77_REAL F77_REAL &F77_RET_T const F77_DBLE const F77_DBLE F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T F77_DBLE &F77_RET_T F77_REAL &F77_RET_T F77_REAL &F77_RET_T F77_DBLE &F77_RET_T const F77_DBLE F77_DBLE &F77_RET_T const F77_REAL F77_REAL &F77_RET_T F77_REAL F77_REAL &F77_RET_T F77_DBLE F77_DBLE &F77_RET_T const F77_DBLE const F77_DBLE * f
QString global_search(const QString &text, int maxFounds)
QString get_next_node(QIODevice *io)
QIODevice * open_file(QFileInfo &fileInfo)
Open info files and uncompress them.
QString get_node_next(const QString &text)
OCTAVE_EXPORT octave_value_list return the number of command line arguments passed to Octave If called with the optional argument the function t
to define functions rather than attempting to enter them directly on the command line The block of commands is executed as soon as you exit the editor To avoid executing any simply delete all the lines from the buffer before leaving the editor When invoked with no edit the previously executed command
QHash< QString, node_position > _ref_map
calling an anonymous function involves an overhead quite comparable to the overhead of an m file function Passing a handle to a built in function is because the interpreter is not involved in the internal loop For a
QHash< QString, QString > _compressors_map
static QString get_first_line(const QString &text)
static void replace_links(QString &text)
QFileInfoList _info_files
static void replace(QString &text, const QRegExp &re, const QString &after)
void parse_info_map()
Parses info files and gets map of node positions.
void real_position(int pos, QFileInfo &file_info, int &real_pos)
Calculates real position of nodes.
static QString parser_node(const QString &text, const QString &node_name)
MArray< T > filter(MArray< T > &b, MArray< T > &a, MArray< T > &x, MArray< T > &si, int dim=0)
the sparsity preserving column transformation such that that defines the pivoting threshold can be given in which case it defines the c
parser(QObject *parent=0)
With real return the complex result
QHash< QString, node_map_item > _node_map
QString node_text_to_html(const QString &text, int anchorPos=-1, const QString &anchor=QString())
Translates text of node to Html.
OCTAVE_EXPORT octave_value_list the first data row corresponds to an index of zero The a spreadsheet style form such as the file is read until end of file is reached The such as text
int is_ref(const QString &node)
Checks if this node is reference.
=val(i)}if ode{val(i)}occurs in table i
bool set_info_path(const QString &_info_path)
QString find_ref(const QString &name)
QString get_node_prev(const QString &text)
static void info_to_html(QString &text)
QString search_node(const QString &node)
QString get_node_up(const QString &text)
static void replace_colons(QString &text)