Re: [PATCH] Strip unused originaldir flag from Converters.{cpp,h}

2007-06-18 Thread Richard Heck

Georg Baum wrote:

Am Samstag, 16. Juni 2007 17:20 schrieb Richard Heck:
  

Jose, JMarc, Georg,

Views about whether this should now go in?



I think so, but why this return statement?
  

+// We're not waiting for the result, so we can't do anything
+// else here.
+return true; 


This should have been: return (res == 0).

AFAICS this is not equivalent to the old code.
  
Yes, you're right, and this shouldn't return right away. Here's an 
improvement.


Richard

--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

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

Re: [PATCH] Strip unused originaldir flag from Converters.{cpp,h}

2007-06-16 Thread Georg Baum
Am Samstag, 16. Juni 2007 17:20 schrieb Richard Heck:
> 
> Jose, JMarc, Georg,
> 
> Views about whether this should now go in?

I think so, but why this return statement?

>+   // We're not waiting for the result, so we 
can't do anything
>+   // else here.
>+   return true; 

AFAICS this is not equivalent to the old code.


Georg


Re: [PATCH] Strip unused originaldir flag from Converters.{cpp,h}

2007-06-16 Thread Richard Heck


Jose, JMarc, Georg,

Views about whether this should now go in?

rh

Richard Heck wrote:

Georg Baum wrote:

Jean-Marc Lasgouttes wrote:

Extended.lyx has a reference to it related to literate programming.
Are you sure it is not relevant anymore? 
The problem is that it is horribly broken currently, and fixing it 
would be

a lot of work (see old discussions). I guess that writing a copier for
literate programming files would be easier than fixing originaldir, so I
think removing the flag is the right thing to do. 
I've now added the default copier for the Program format with the HTML 
export fix.
Yes, I think Georg and I talked about this a while ago, when I was 
pursuing HTML export a quite different way. We agreed that this was 
broken. In fact, it could lead to data loss, especially if you 
combined originaldir with other flags. I got bit by this once.


Regarding the Extended Features manual, I've removed the originaldir 
reference. I've also added a cross-reference to the now more extensive 
discussion of converters in the Customization manual.


So, shall I commit? The now current patch is attached. Note that the 
bit about configure.py is not yet included in the patch, as I've got 
other stuff going on there at the moment.


Richard

  


--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Index: src/Converter.cpp
===
--- src/Converter.cpp	(revision 18803)
+++ src/Converter.cpp	(working copy)
@@ -119,7 +119,7 @@
 		 string const & c, string const & l)
 	: from(f), to(t), command(c), flags(l),
 	  From(0), To(0), latex(false), xml(false),
-	  original_dir(false), need_aux(false)
+	  need_aux(false)
 {}
 
 
@@ -134,8 +134,6 @@
 			latex = true;
 		else if (flag_name == "xml")
 			xml = true;
-		else if (flag_name == "originaldir")
-			original_dir = true;
 		else if (flag_name == "needaux")
 			need_aux = true;
 		else if (flag_name == "resultdir")
@@ -400,12 +398,10 @@
 			}
 
 			// FIXME UNICODE
-			string const infile2 = (conv.original_dir)
-? infile.absFilename() : to_utf8(makeRelPath(from_utf8(infile.absFilename()),
-	 from_utf8(path)));
-			string const outfile2 = (conv.original_dir)
-? outfile.absFilename() : to_utf8(makeRelPath(from_utf8(outfile.absFilename()),
-	  from_utf8(path)));
+			string const infile2 = 
+to_utf8(makeRelPath(from_utf8(infile.absFilename()), from_utf8(path)));
+			string const outfile2 = 
+to_utf8(makeRelPath(from_utf8(outfile.absFilename()), from_utf8(path)));
 
 			string command = conv.command;
 			command = subst(command, token_from, quoteName(infile2));
@@ -428,19 +424,19 @@
 buffer->message(_("Executing command: ")
 + from_utf8(command));
 
-			Systemcall::Starttype const type = (dummy)
-? Systemcall::DontWait : Systemcall::Wait;
 			Systemcall one;
 			int res;
-			if (conv.original_dir) {
-FileName path(buffer->filePath());
-support::Path p(path);
-res = one.startscript(type,
+			if (dummy) {
+res = one.startscript(Systemcall::DontWait,
 	to_filesystem8bit(from_utf8(command)));
-			} else
-res = one.startscript(type,
-	to_filesystem8bit(from_utf8(command)));
+// We're not waiting for the result, so we can't do anything
+// else here.
+return true; 
+			}
 
+			res = one.startscript(Systemcall::Wait,
+to_filesystem8bit(from_utf8(command)));
+			
 			if (!real_outfile.empty()) {
 Mover const & mover = getMover(conv.to);
 if (!mover.rename(outfile, real_outfile))
Index: src/Converter.h
===
--- src/Converter.h	(revision 18803)
+++ src/Converter.h	(working copy)
@@ -55,8 +55,6 @@
 	bool latex;
 	/// The converter is xml
 	bool xml;
-	/// Do we need to run the converter in the original directory?
-	bool original_dir;
 	/// This converter needs the .aux files
 	bool need_aux;
 	/// If the converter put the result in a directory, then result_dir
Index: lib/doc/Extended.lyx
===
--- lib/doc/Extended.lyx	(revision 18803)
+++ lib/doc/Extended.lyx	(working copy)
@@ -1,5 +1,5 @@
-#LyX 1.5.0rc1 created this file. For more info see http://www.lyx.org/
-\lyxformat 271
+#LyX 1.5.0svn created this file. For more info see http://www.lyx.org/
+\lyxformat 274
 \begin_document
 \begin_header
 \textclass book
@@ -38,7 +38,6 @@
 \tracking_changes false
 \output_changes false
 \author "usti" 
-\author "Richard Heck" 
 \end_header
 
 \begin_body
@@ -17901,7 +17900,7 @@
 If the document is of any literate class LyX will then use th

Re: [PATCH] Strip unused originaldir flag from Converters.{cpp,h}

2007-06-15 Thread Richard Heck

Georg Baum wrote:

Jean-Marc Lasgouttes wrote:
  

Richard> As said. This flag was removed from configure.py a while ago.
Richard> It was only ever used with HTML export, and it didn't work
Richard> there, anyway. I didn't remove it from Converters.* at that
Richard> time, because I was intending to make more extensive changes
Richard> to this file in connection with HTML export. But it turned
Richard> out I didn't need to do that, so all that needs doing now is
Richard> this little bit of cleanup.

Extended.lyx has a reference to it related to literate programming.
Are you sure it is not relevant anymore?


The problem is that it is horribly broken currently, and fixing it would be
a lot of work (see old discussions). I guess that writing a copier for
literate programming files would be easier than fixing originaldir, so I
think removing the flag is the right thing to do.
  
Yes, I think Georg and I talked about this a while ago, when I was 
pursuing HTML export a quite different way. We agreed that this was 
broken. In fact, it could lead to data loss, especially if you combined 
originaldir with other flags. I got bit by this once.


Regarding the Extended Features manual, I've removed the originaldir 
reference. I've also added a cross-reference to the now more extensive 
discussion of converters in the Customization manual.


As for the copier, we can just use ext_copy.py in stupidity mode, i.e., 
so it copies everything. I've added that to configure.py. Too much gets 
copied, but at least nothing is lost. I've added some comments about 
this to the documentation, as well as a comment of the form: If you know 
what extensions get generated, here is what you can do.


So, shall I commit? The now current patch is attached. Note that the bit 
about configure.py is not yet included in the patch, as I've got other 
stuff going on there at the moment.


Richard

--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto

Index: src/Converter.cpp
===
--- src/Converter.cpp	(revision 18775)
+++ src/Converter.cpp	(working copy)
@@ -118,7 +118,7 @@
 		 string const & c, string const & l)
 	: from(f), to(t), command(c), flags(l),
 	  From(0), To(0), latex(false), xml(false),
-	  original_dir(false), need_aux(false)
+	  need_aux(false)
 {}
 
 
@@ -133,8 +133,6 @@
 			latex = true;
 		else if (flag_name == "xml")
 			xml = true;
-		else if (flag_name == "originaldir")
-			original_dir = true;
 		else if (flag_name == "needaux")
 			need_aux = true;
 		else if (flag_name == "resultdir")
@@ -399,12 +397,10 @@
 			}
 
 			// FIXME UNICODE
-			string const infile2 = (conv.original_dir)
-? infile.absFilename() : to_utf8(makeRelPath(from_utf8(infile.absFilename()),
-	 from_utf8(path)));
-			string const outfile2 = (conv.original_dir)
-? outfile.absFilename() : to_utf8(makeRelPath(from_utf8(outfile.absFilename()),
-	  from_utf8(path)));
+			string const infile2 = 
+to_utf8(makeRelPath(from_utf8(infile.absFilename()), from_utf8(path)));
+			string const outfile2 = 
+to_utf8(makeRelPath(from_utf8(outfile.absFilename()), from_utf8(path)));
 
 			string command = conv.command;
 			command = subst(command, token_from, quoteName(infile2));
@@ -427,19 +423,19 @@
 buffer->message(_("Executing command: ")
 + from_utf8(command));
 
-			Systemcall::Starttype const type = (dummy)
-? Systemcall::DontWait : Systemcall::Wait;
 			Systemcall one;
 			int res;
-			if (conv.original_dir) {
-FileName path(buffer->filePath());
-support::Path p(path);
-res = one.startscript(type,
+			if (dummy) {
+res = one.startscript(Systemcall::DontWait,
 	to_filesystem8bit(from_utf8(command)));
-			} else
-res = one.startscript(type,
-	to_filesystem8bit(from_utf8(command)));
+// We're not waiting for the result, so we can't do anything
+// else here.
+return true; 
+			}
 
+			res = one.startscript(Systemcall::Wait,
+to_filesystem8bit(from_utf8(command)));
+			
 			if (!real_outfile.empty()) {
 Mover const & mover = getMover(conv.to);
 if (!mover.rename(outfile, real_outfile))
Index: src/Converter.h
===
--- src/Converter.h	(revision 18775)
+++ src/Converter.h	(working copy)
@@ -55,8 +55,6 @@
 	bool latex;
 	/// The converter is xml
 	bool xml;
-	/// Do we need to run the converter in the original directory?
-	bool original_dir;
 	/// This converter needs the .aux files
 	bool need_aux;
 	/// If the converter put the result in a directory, then result_dir
Index: lib/doc/

Re: [PATCH] Strip unused originaldir flag from Converters.{cpp,h}

2007-06-15 Thread Georg Baum
Jean-Marc Lasgouttes wrote:

>> "Richard" == Richard Heck
>> <[EMAIL PROTECTED]> writes:
> 
> Richard> This time with the patch...
> 
> Richard> As said. This flag was removed from configure.py a while ago.
> Richard> It was only ever used with HTML export, and it didn't work
> Richard> there, anyway. I didn't remove it from Converters.* at that
> Richard> time, because I was intending to make more extensive changes
> Richard> to this file in connection with HTML export. But it turned
> Richard> out I didn't need to do that, so all that needs doing now is
> Richard> this little bit of cleanup.
> 
> Extended.lyx has a reference to it related to literate programming.
> Are you sure it is not relevant anymore?

The problem is that it is horribly broken currently, and fixing it would be
a lot of work (see old discussions). I guess that writing a copier for
literate programming files would be easier than fixing originaldir, so I
think removing the flag is the right thing to do.


Georg



Re: [PATCH] Strip unused originaldir flag from Converters.{cpp,h}

2007-06-14 Thread Jean-Marc Lasgouttes
> "Richard" == Richard Heck <[EMAIL PROTECTED]> writes:

Richard> This time with the patch...

Richard> As said. This flag was removed from configure.py a while ago.
Richard> It was only ever used with HTML export, and it didn't work
Richard> there, anyway. I didn't remove it from Converters.* at that
Richard> time, because I was intending to make more extensive changes
Richard> to this file in connection with HTML export. But it turned
Richard> out I didn't need to do that, so all that needs doing now is
Richard> this little bit of cleanup.

Extended.lyx has a reference to it related to literate programming.
Are you sure it is not relevant anymore?

JMarc


[PATCH] Strip unused originaldir flag from Converters.{cpp,h}

2007-06-14 Thread Richard Heck


This time with the patch...

As said. This flag was removed from configure.py a while ago. It was
only ever used with HTML export, and it didn't work there, anyway. I
didn't remove it from Converters.* at that time, because I was intending
to make more extensive changes to this file in connection with HTML
export. But it turned out I didn't need to do that, so all that needs
doing now is this little bit of cleanup.

OK to commit?

Richard

--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto
Index: src/Converter.cpp
===
--- src/Converter.cpp	(revision 18769)
+++ src/Converter.cpp	(working copy)
@@ -118,7 +118,7 @@
 		 string const & c, string const & l)
 	: from(f), to(t), command(c), flags(l),
 	  From(0), To(0), latex(false), xml(false),
-	  original_dir(false), need_aux(false)
+	  need_aux(false)
 {}
 
 
@@ -133,8 +133,6 @@
 			latex = true;
 		else if (flag_name == "xml")
 			xml = true;
-		else if (flag_name == "originaldir")
-			original_dir = true;
 		else if (flag_name == "needaux")
 			need_aux = true;
 		else if (flag_name == "resultdir")
@@ -399,12 +397,10 @@
 			}
 
 			// FIXME UNICODE
-			string const infile2 = (conv.original_dir)
-? infile.absFilename() : to_utf8(makeRelPath(from_utf8(infile.absFilename()),
-	 from_utf8(path)));
-			string const outfile2 = (conv.original_dir)
-? outfile.absFilename() : to_utf8(makeRelPath(from_utf8(outfile.absFilename()),
-	  from_utf8(path)));
+			string const infile2 = 
+to_utf8(makeRelPath(from_utf8(infile.absFilename()), from_utf8(path)));
+			string const outfile2 = 
+to_utf8(makeRelPath(from_utf8(outfile.absFilename()), from_utf8(path)));
 
 			string command = conv.command;
 			command = subst(command, token_from, quoteName(infile2));
@@ -427,19 +423,19 @@
 buffer->message(_("Executing command: ")
 + from_utf8(command));
 
-			Systemcall::Starttype const type = (dummy)
-? Systemcall::DontWait : Systemcall::Wait;
 			Systemcall one;
 			int res;
-			if (conv.original_dir) {
-FileName path(buffer->filePath());
-support::Path p(path);
-res = one.startscript(type,
+			if (dummy) {
+res = one.startscript(Systemcall::DontWait,
 	to_filesystem8bit(from_utf8(command)));
-			} else
-res = one.startscript(type,
-	to_filesystem8bit(from_utf8(command)));
+// We're not waiting for the result, so we can't do anything
+// else here.
+return true; 
+			}
 
+			res = one.startscript(Systemcall::Wait,
+to_filesystem8bit(from_utf8(command)));
+			
 			if (!real_outfile.empty()) {
 Mover const & mover = getMover(conv.to);
 if (!mover.rename(outfile, real_outfile))
Index: src/Converter.h
===
--- src/Converter.h	(revision 18769)
+++ src/Converter.h	(working copy)
@@ -55,8 +55,6 @@
 	bool latex;
 	/// The converter is xml
 	bool xml;
-	/// Do we need to run the converter in the original directory?
-	bool original_dir;
 	/// This converter needs the .aux files
 	bool need_aux;
 	/// If the converter put the result in a directory, then result_dir


[PATCH] Strip unused originaldir flag from Converters.{cpp,h}

2007-06-14 Thread Richard Heck


As said. This flag was removed from configure.py a while ago. It was 
only ever used with HTML export, and it didn't work there, anyway. I 
didn't remove it from Converters.* at that time, because I was intending 
to make more extensive changes to this file in connection with HTML 
export. But it turned out I didn't need to do that, so all that needs 
doing now is this little bit of cleanup.


OK to commit?

Richard

--
==
Richard G Heck, Jr
Professor of Philosophy
Brown University
http://frege.brown.edu/heck/
==
Get my public key from http://sks.keyserver.penguin.de
Hash: 0x1DE91F1E66FFBDEC
Learn how to sign your email using Thunderbird and GnuPG at:
http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto