Remove now unused originaldir flag from Converter.{cpp,h}.

Update documentation to reflect removal.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@18824 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2007-06-19 14:29:57 +00:00
parent 98f355e5a7
commit 3d362bf35c
3 changed files with 124 additions and 52 deletions

View File

@ -1,5 +1,5 @@
#LyX 1.5.0rc1 created this file. For more info see http://www.lyx.org/ #LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
\lyxformat 271 \lyxformat 274
\begin_document \begin_document
\begin_header \begin_header
\textclass book \textclass book
@ -38,7 +38,6 @@
\tracking_changes false \tracking_changes false
\output_changes false \output_changes false
\author "usti" \author "usti"
\author "Richard Heck"
\end_header \end_header
\begin_body \begin_body
@ -17901,7 +17900,7 @@ Note that the only difference so far is in the name of the file, no special
If the document is of any literate class LyX will then use the internal If the document is of any literate class LyX will then use the internal
LyX to Noweb converter, followed by the Noweb to LaTeX converter LyX to Noweb converter, followed by the Noweb to LaTeX converter
\begin_inset Foot \begin_inset Foot
status open status collapsed
\begin_layout Standard \begin_layout Standard
The converters are defined in the The converters are defined in the
@ -17925,6 +17924,17 @@ Conversion
\end_inset \end_inset
tab. tab.
See section
\begin_inset LatexCommand ref
reference "sub:converters"
\end_inset
of the
\emph on
Customization
\emph default
manual for general information about converters.
\end_layout \end_layout
\end_inset \end_inset
@ -17968,7 +17978,9 @@ When the build menu option is chosen or the corresponding button in the
Noweb->Program Noweb->Program
\family default \family default
converter. converter.
Typically, this converter (like any other converter), has two parts: This converter needs to be defined by the user and is not installed by
default, though the Program format is.
This converter (like any other converter) will have two parts:
\end_layout \end_layout
\begin_layout Enumerate \begin_layout Enumerate
@ -18015,7 +18027,7 @@ build-script
\begin_inset Quotes erd \begin_inset Quotes erd
\end_inset \end_inset
(a program or script) with the name of the Noweb file (generally a file (a program or script) with the name of the Noweb file (normally a file
in the LyX temp directory). in the LyX temp directory).
\end_layout \end_layout
@ -18059,7 +18071,7 @@ Flags
\family typewriter \family typewriter
originaldir,parselog=listerrors parselog=listerrors
\family default \family default
\begin_inset Quotes erd \begin_inset Quotes erd
@ -18105,6 +18117,74 @@ listerrors
program. program.
\end_layout \end_layout
\begin_layout Standard
The build will normally take place in LyX's temporary directory, so the
files produced by the conversion will be in that directory.
LyX will copy out what it regards as the `main' file, but the
\family typewriter
Noweb->Program
\family default
conversion may produce several files, and so most of these would then be
deleted when LyX was closed.
The present solution is to use a `copier',
\begin_inset Foot
status collapsed
\begin_layout Standard
See section
\begin_inset LatexCommand ref
reference "sec:converters-etc"
\end_inset
of the
\emph on
Customization
\emph default
manual for information on these.
\end_layout
\end_inset
in this case, the
\family typewriter
ext_copy.py
\family default
script in its default mode, so that the entire contents of the temporary
directory is copied.
More will get copied than is needed, to be sure, but nothing will be lost.
If, however, you know what extensions the generated files will have, this
can be improved by using the
\family typewriter
-e
\family default
option to
\family typewriter
ext_copy
\family default
.
This option takes a comma-separated list of extensions to copy.
So, for example, if the conversion will generate only files with the extensions
\family typewriter
.c
\family default
and
\family typewriter
.h
\family default
, then the correct definition would be:
\end_layout
\begin_layout LyX-Code
python -tt $$s/scripts/ext_copy.py -e c,h $$i $$o
\end_layout
\begin_layout Standard
The result will be that only files with these two extensions will be copied
out.
\end_layout
\begin_layout Paragraph \begin_layout Paragraph
Build instructions in the document Build instructions in the document
\end_layout \end_layout

View File

@ -119,7 +119,7 @@ Converter::Converter(string const & f, string const & t,
string const & c, string const & l) string const & c, string const & l)
: from(f), to(t), command(c), flags(l), : from(f), to(t), command(c), flags(l),
From(0), To(0), latex(false), xml(false), From(0), To(0), latex(false), xml(false),
original_dir(false), need_aux(false) need_aux(false)
{} {}
@ -134,8 +134,6 @@ void Converter::readFlags()
latex = true; latex = true;
else if (flag_name == "xml") else if (flag_name == "xml")
xml = true; xml = true;
else if (flag_name == "originaldir")
original_dir = true;
else if (flag_name == "needaux") else if (flag_name == "needaux")
need_aux = true; need_aux = true;
else if (flag_name == "resultdir") else if (flag_name == "resultdir")
@ -400,12 +398,10 @@ bool Converters::convert(Buffer const * buffer,
} }
// FIXME UNICODE // FIXME UNICODE
string const infile2 = (conv.original_dir) string const infile2 =
? infile.absFilename() : to_utf8(makeRelPath(from_utf8(infile.absFilename()), to_utf8(makeRelPath(from_utf8(infile.absFilename()), from_utf8(path)));
from_utf8(path))); string const outfile2 =
string const outfile2 = (conv.original_dir) to_utf8(makeRelPath(from_utf8(outfile.absFilename()), from_utf8(path)));
? outfile.absFilename() : to_utf8(makeRelPath(from_utf8(outfile.absFilename()),
from_utf8(path)));
string command = conv.command; string command = conv.command;
command = subst(command, token_from, quoteName(infile2)); command = subst(command, token_from, quoteName(infile2));
@ -428,43 +424,41 @@ bool Converters::convert(Buffer const * buffer,
buffer->message(_("Executing command: ") buffer->message(_("Executing command: ")
+ from_utf8(command)); + from_utf8(command));
Systemcall::Starttype const type = (dummy)
? Systemcall::DontWait : Systemcall::Wait;
Systemcall one; Systemcall one;
int res; int res;
if (conv.original_dir) { if (dummy) {
FileName path(buffer->filePath()); res = one.startscript(Systemcall::DontWait,
support::Path p(path);
res = one.startscript(type,
to_filesystem8bit(from_utf8(command))); to_filesystem8bit(from_utf8(command)));
} else // We're not waiting for the result, so we can't do anything
res = one.startscript(type, // else here.
to_filesystem8bit(from_utf8(command))); } else {
res = one.startscript(Systemcall::Wait,
if (!real_outfile.empty()) { to_filesystem8bit(from_utf8(command)));
Mover const & mover = getMover(conv.to); if (!real_outfile.empty()) {
if (!mover.rename(outfile, real_outfile)) Mover const & mover = getMover(conv.to);
res = -1; if (!mover.rename(outfile, real_outfile))
else res = -1;
LYXERR(Debug::FILES) else
<< "renaming file " << outfile LYXERR(Debug::FILES)
<< " to " << real_outfile << "renaming file " << outfile
<< endl; << " to " << real_outfile
// Finally, don't forget to tell any future << endl;
// converters to use the renamed file... // Finally, don't forget to tell any future
outfile = real_outfile; // converters to use the renamed file...
} outfile = real_outfile;
}
if (!conv.parselog.empty()) {
string const logfile = infile2 + ".log"; if (!conv.parselog.empty()) {
string const script = libScriptSearch(conv.parselog); string const logfile = infile2 + ".log";
string const command2 = script + string const script = libScriptSearch(conv.parselog);
" < " + quoteName(infile2 + ".out") + string const command2 = script +
" > " + quoteName(logfile); " < " + quoteName(infile2 + ".out") +
one.startscript(Systemcall::Wait, " > " + quoteName(logfile);
to_filesystem8bit(from_utf8(command2))); one.startscript(Systemcall::Wait,
if (!scanLog(*buffer, command, makeAbsPath(logfile, path), errorList)) to_filesystem8bit(from_utf8(command2)));
return false; if (!scanLog(*buffer, command, makeAbsPath(logfile, path), errorList))
return false;
}
} }
if (res) { if (res) {

View File

@ -55,8 +55,6 @@ public:
bool latex; bool latex;
/// The converter is xml /// The converter is xml
bool xml; bool xml;
/// Do we need to run the converter in the original directory?
bool original_dir;
/// This converter needs the .aux files /// This converter needs the .aux files
bool need_aux; bool need_aux;
/// If the converter put the result in a directory, then result_dir /// If the converter put the result in a directory, then result_dir