Re: lyx-devel src/: ChangeLog LaTeX.C LaTeX.h converter.C outp ...

2004-10-08 Thread Martin Vermeer
On Thu, 2004-10-07 at 18:55, Angus Leeming wrote:
 [EMAIL PROTECTED] wrote:
  Log message:
  Implement use of babel language in xindy.
 
 Incidentally, it would make sense to document use of the $$lang parameter
 in lyxrc::getDescription which is displayed in the xforms preferences
 dialog when your mouse goes over the 'index command' input widget...

OK, like this?

- Martin
Index: lyxrc.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.C,v
retrieving revision 1.177
diff -u -r1.177 lyxrc.C
--- lyxrc.C	5 Oct 2004 10:11:28 -	1.177
+++ lyxrc.C	8 Oct 2004 05:44:24 -
@@ -2169,7 +2169,7 @@
 		break;
 
 	case RC_INDEX_COMMAND:
-		str = _(Define the options of makeindex (cf. man makeindex) or select an alternative compiler (e.g. xindy).);
+		str = _(Define the options of makeindex (cf. man makeindex) or select an alternative compiler (e.g., xindy/make-rules; use the command string \makeindex.sh -m $$lang\).);
 		break;
 
 	case RC_CURSOR_FOLLOWS_SCROLLBAR:


signature.asc
Description: This is a digitally signed message part


Re: lyx-devel src/: ChangeLog LaTeX.C LaTeX.h converter.C outp ...

2004-10-08 Thread Angus Leeming
Martin Vermeer wrote:

 On Thu, 2004-10-07 at 18:55, Angus Leeming wrote:
 [EMAIL PROTECTED] wrote:
  Log message:
  Implement use of babel language in xindy.
 
 Incidentally, it would make sense to document use
 of the $$lang parameter in lyxrc::getDescription
 which is displayed in the xforms preferences dialog
 when your mouse goes over the 'index command' input widget...
 
 OK, like this?

Well, I can't parse it. Don't know about anyone else.

+   str = _(Define the options of makeindex 
(cf. man makeindex) or select an alternative compiler (e.g.,
xindy/make-rules; use the command string 
\makeindex.sh -m $$lang\).);

Why not:
...
an alternative compiler. E.g., using xindy, the 
command string would be \makeindex.sh -m $$lang\.);


-- 
Angus



Re: lyx-devel src/: ChangeLog LaTeX.C LaTeX.h converter.C outp ...

2004-10-08 Thread Martin Vermeer
On Thu, 2004-10-07 at 18:55, Angus Leeming wrote:
> [EMAIL PROTECTED] wrote:
> > Log message:
> > Implement use of babel language in xindy.
> 
> Incidentally, it would make sense to document use of the $$lang parameter
> in lyxrc::getDescription which is displayed in the xforms preferences
> dialog when your mouse goes over the 'index command' input widget...

OK, like this?

- Martin
Index: lyxrc.C
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/lyxrc.C,v
retrieving revision 1.177
diff -u -r1.177 lyxrc.C
--- lyxrc.C	5 Oct 2004 10:11:28 -	1.177
+++ lyxrc.C	8 Oct 2004 05:44:24 -
@@ -2169,7 +2169,7 @@
 		break;
 
 	case RC_INDEX_COMMAND:
-		str = _("Define the options of makeindex (cf. man makeindex) or select an alternative compiler (e.g. xindy).");
+		str = _("Define the options of makeindex (cf. man makeindex) or select an alternative compiler (e.g., xindy/make-rules; use the command string \"makeindex.sh -m $$lang\").");
 		break;
 
 	case RC_CURSOR_FOLLOWS_SCROLLBAR:


signature.asc
Description: This is a digitally signed message part


Re: lyx-devel src/: ChangeLog LaTeX.C LaTeX.h converter.C outp ...

2004-10-08 Thread Angus Leeming
Martin Vermeer wrote:

> On Thu, 2004-10-07 at 18:55, Angus Leeming wrote:
>> [EMAIL PROTECTED] wrote:
>> > Log message:
>> > Implement use of babel language in xindy.
>> 
>> Incidentally, it would make sense to document use
>> of the $$lang parameter in lyxrc::getDescription
>> which is displayed in the xforms preferences dialog
>> when your mouse goes over the 'index command' input widget...
> 
> OK, like this?

Well, I can't parse it. Don't know about anyone else.

+   str = _("Define the options of makeindex 
(cf. man makeindex) or select an alternative compiler (e.g.,
xindy/make-rules; use the command string 
\"makeindex.sh -m $$lang\").");

Why not:
...
an alternative compiler. E.g., using xindy, the 
command string would be \"makeindex.sh -m $$lang\".");


-- 
Angus



Re: lyx-devel src/: ChangeLog LaTeX.C LaTeX.h converter.C outp ...

2004-10-07 Thread Angus Leeming
[EMAIL PROTECTED] wrote:
 Log message:
 Implement use of babel language in xindy.

Incidentally, it would make sense to document use of the $$lang parameter
in lyxrc::getDescription which is displayed in the xforms preferences
dialog when your mouse goes over the 'index command' input widget...

-- 
Angus



Re: lyx-devel src/: ChangeLog LaTeX.C LaTeX.h converter.C outp ...

2004-10-07 Thread Angus Leeming
[EMAIL PROTECTED] wrote:
> Log message:
> Implement use of babel language in xindy.

Incidentally, it would make sense to document use of the $$lang parameter
in lyxrc::getDescription which is displayed in the xforms preferences
dialog when your mouse goes over the 'index command' input widget...

-- 
Angus



Re: converter.C

2003-02-28 Thread Alfredo Braunstein
 Lsstream.h
-#include converter.h
+#include format.h
 #include BufferView.h
 #include ParagraphParameters.h
 #include iterators.h
Index: converter.C
===
RCS file: /cvs/lyx/lyx-devel/src/converter.C,v
retrieving revision 1.64
diff -u -r1.64 converter.C
--- converter.C	2003/02/14 14:49:48	1.64
+++ converter.C	2003/02/28 08:44:16
@@ -1,16 +1,18 @@
-/* This file is part of
- * ==
+/**
+ * \file converter.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *   LyX, The Document Processor
+ * \author Dekel Tsur
  *
- *   Copyright 1995 Matthias Ettrich
- *   Copyright 1995-2001 The LyX Team.
- *
- * == */
+ * Full author contact details are available in file CREDITS
+ */
 
 #include config.h
 
 #include converter.h
+#include graph.h
+#include format.h
 #include lyxrc.h
 #include buffer.h
 #include bufferview_funcs.h
@@ -37,12 +39,8 @@
 #endif
 
 using std::vector;
-using std::queue;
 using std::endl;
-using std::fill;
 using std::find_if;
-using std::reverse;
-using std::sort;
 
 namespace {
 
@@ -50,10 +48,9 @@
 string const token_base($$b);
 string const token_to($$o);
 string const token_path($$p);
+
 
-//
 
-inline
 string const add_options(string const  command, string const  options)
 {
 	string head;
@@ -63,189 +60,13 @@
 
 } // namespace anon
 
-//
-
-bool Format::dummy() const
-{
-	return extension().empty();
-}
-
-
-bool Format::isChildFormat() const
-{
-	if (name_.empty())
-		return false;
-	return isdigit(name_[name_.length() - 1]);
-}
-
-
-string const Format::parentFormat() const
-{
-	return name_.substr(0, name_.length() - 1);
-}
-
-//
-
-// This method should return a reference, and throw an exception
-// if the format named name cannot be found (Lgb)
-Format const * Formats::getFormat(string const  name) const
-{
-	FormatList::const_iterator cit =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(Format::name, name));
-	if (cit != formatlist.end())
-		return (*cit);
-	else
-		return 0;
-}
-
-
-int Formats::getNumber(string const  name) const
-{
-	FormatList::const_iterator cit =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(Format::name, name));
-	if (cit != formatlist.end())
-		return cit - formatlist.begin();
-	else
-		return -1;
-}
-
-
-void Formats::add(string const  name)
-{
-	if (!getFormat(name))
-		add(name, name, name, string());
-}
-
-
-// FIXME: horrednously mis-named, especially given the other ::add
-// function
-void Formats::add(string const  name, string const  extension,
-		  string const  prettyname, string const  shortcut)
-{
-	FormatList::iterator it =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(Format::name, name));
-	if (it == formatlist.end())
-		formatlist.push_back(Format(name, extension, prettyname,
-	shortcut, ));
-	else {
-		string viewer = it-viewer();
-		*it = Format(name, extension, prettyname, shortcut, viewer);
-	}
-}
-
-
-void Formats::erase(string const  name)
-{
-	FormatList::iterator it =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(Format::name, name));
-	if (it != formatlist.end())
-		formatlist.erase(it);
-}
-
-
-void Formats::sort()
-{
-	std::sort(formatlist.begin(), formatlist.end());
-}
-
-
-void Formats::setViewer(string const  name, string const  command)
-{
-	add(name);
-	FormatList::iterator it =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(Format::name, name));
-	if (it != formatlist.end())
-		it-setViewer(command);
-}
 
+Converter::Converter(string const  f, string const  t, string const  c,
+	  string const  l): from(f), to(t), command(c), flags(l), 
+			 From(0), To(0), latex(false), 
+			 original_dir(false), need_aux(false) 
+{}
 
-bool Formats::view(Buffer const * buffer, string const  filename,
-		   string const  format_name) const
-{
-	if (filename.empty())
-		return false;
-
-	Format const * format = getFormat(format_name);
-	if (format  format-viewer().empty() 
-	format-isChildFormat())
-		format = getFormat(format-parentFormat());
-	if (!format || format-viewer().empty()) {
-#if USE_BOOST_FORMAT
-		Alert::alert(_(Cannot view file),
-			 boost::io::str(boost::format(_(No information for viewing %1$s))
-			   % prettyName(format_name)));
-#else
-		Alert::alert(_(Cannot view file),
-			 _(No information for viewing )
-			 + prettyName(format_name));
-#endif
-			   return false;
-	}
-
-	string command = format-viewer();
-
-	if (format_name == dvi 
-	!lyxrc.view_dvi_paper_option.empty()) {
-		command

Re: converter.C

2003-02-28 Thread Andre Poenitz
On Fri, Feb 28, 2003 at 09:45:15AM +0100, Alfredo Braunstein wrote:
 Sorry for the delay, the patch didn't applied cleanly anymore and had to
 backup some new changes to recreate it.

Applied.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-28 Thread Edwin Leuven
compile fails for me:

g++ -DHAVE_CONFIG_H -I. -I../../lyx-devel/src -I. -I../../lyx-devel/boost 
-I/usr/include  -I/usr/X11R6/include  -g -O -fno-exceptions -W -Wall -Winline 
-c -o graph.o `test -f '../../lyx-devel/src/graph.C' || echo 
'../../lyx-devel/src/'`../../lyx-devel/src/graph.C
cc1plus: warning: changing search order for system directory /usr/include
cc1plus: warning:   as it has already been specified as a non-system directory
In file included from /usr/include/c++/3.2/backward/streambuf.h:31,
 from ../../lyx-devel/src/support/sstream.h:40,
 from ../../lyx-devel/src/Lsstream.h:22,
 from ../../lyx-devel/src/support/lstrings.h:21,
 from ../../lyx-devel/src/format.h:22,
 from ../../lyx-devel/src/graph.C:12:
/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning This 
file includes at least one deprecated or antiquated header. Please consider 
using one of the 32 headers found in section 17.4.1.2 of the C++ standard. 
Examples include substituting the X header for the X.h header for C++ 
includes, or sstream instead of the deprecated header strstream.h. To 
disable this warning use -Wno-deprecated.
In file included from ../../lyx-devel/src/Lsstream.h:22,
 from ../../lyx-devel/src/support/lstrings.h:21,
 from ../../lyx-devel/src/format.h:22,
 from ../../lyx-devel/src/graph.C:12:
../../lyx-devel/src/support/sstream.h:44: conflicting types for `struct
   std::stringbuf'
/usr/include/c++/3.2/iosfwd:110: previous declaration as `typedef struct
   std::basic_stringbufchar, std::char_traitschar, std::allocatorchar 
   std::stringbuf'
../../lyx-devel/src/support/sstream.h:98: syntax error before `;' token
../../lyx-devel/src/support/sstream.h:45: destructor `stringbuf' must match
   class name `basic_ios'
../../lyx-devel/src/support/sstream.h:45: `virtual std::basic_ioschar,
   std::char_traitschar ::~basic_ios()' and `void std::basic_ios_CharT,
   _Traits::basic_ios() [with _CharT = char, _Traits = 
std::char_traitschar]
   ' cannot be overloaded
../../lyx-devel/src/support/sstream.h:45: `virtual std::basic_ioschar,
   std::char_traitschar ::~basic_ios()' and `void std::basic_ios_CharT,
   _Traits::basic_ios() [with _CharT = char, _Traits = 
std::char_traitschar]
   ' cannot be overloaded
../../lyx-devel/src/support/sstream.h:45: `std::basic_ioschar,
   std::char_traitschar ::~basic_ios()' and `void std::basic_ios_CharT,
   _Traits::basic_ios() [with _CharT = char, _Traits = 
std::char_traitschar]
   ' cannot be overloaded
../../lyx-devel/src/support/sstream.h: In constructor
   `std::stringbuf::stringbuf(int)':
../../lyx-devel/src/support/sstream.h:53: parse error before `;' token
../../lyx-devel/src/support/sstream.h:54: class `std::stringbuf' does not have
   any field named `rpos'
../../lyx-devel/src/support/sstream.h:54: class `std::stringbuf' does not have
   any field named `bufsize'
../../lyx-devel/src/support/sstream.h:55: no matching function for call to `
   std::basic_streambufchar, std::char_traitschar ::basic_streambuf(int)'
/usr/include/c++/3.2/streambuf:486: candidates are:
   std::basic_streambuf_CharT, _Traits::basic_streambuf(const
   std::basic_streambuf_CharT, _Traits) [with _CharT = char, _Traits =
   std::char_traitschar]
/usr/include/c++/3.2/streambuf:350:
   std::basic_streambuf_CharT, _Traits::basic_streambuf() [with _CharT =
   char, _Traits = std::char_traitschar]
../../lyx-devel/src/support/sstream.h: In constructor
   `std::stringbuf::stringbuf(const std::string, int)':
../../lyx-devel/src/support/sstream.h:58: parse error before `;' token
../../lyx-devel/src/support/sstream.h:59: class `std::stringbuf' does not have
   any field named `bufsize'
../../lyx-devel/src/support/sstream.h:60: no matching function for call to `
   std::basic_streambufchar, std::char_traitschar ::basic_streambuf(int)'
/usr/include/c++/3.2/streambuf:486: candidates are:
   std::basic_streambuf_CharT, _Traits::basic_streambuf(const
   std::basic_streambuf_CharT, _Traits) [with _CharT = char, _Traits =
   std::char_traitschar]
/usr/include/c++/3.2/streambuf:350:
   std::basic_streambuf_CharT, _Traits::basic_streambuf() [with _CharT =
   char, _Traits = std::char_traitschar]
../../lyx-devel/src/support/sstream.h:61: `mode' undeclared (first use this
   function)
../../lyx-devel/src/support/sstream.h:61: (Each undeclared identifier is
   reported only once for each function it appears in.)
../../lyx-devel/src/support/sstream.h:63: `defbuf' undeclared (first use this
   function)
../../lyx-devel/src/support/sstream.h:63: `bufsize' undeclared (first use this
   function)
../../lyx-devel/src/support/sstream.h:69: `rpos' undeclared (first use this
   function)
../../lyx-devel/src/support/sstream.h: At global scope:
../../lyx-devel/src/support/sstream.h:106: field `__my_sb' has incomplete type
../../lyx-devel/src/support/sstream.h:104: confused by earlier errors, 

Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Edwin Leuven wrote:

 compile fails for me:
 
 g++ -DHAVE_CONFIG_H -I. -I../../lyx-devel/src -I. -I../../lyx-devel/boost
 -I/usr/include  -I/usr/X11R6/include  -g -O -fno-exceptions -W -Wall
 -Winline -c -o graph.o `test -f '../../lyx-devel/src/graph.C' || echo
 '../../lyx-devel/src/'`../../lyx-devel/src/graph.C
 cc1plus: warning: changing search order for system directory
 /usr/include
 cc1plus: warning:   as it has already been specified as a non-system
 directory In file included from
 /usr/include/c++/3.2/backward/streambuf.h:31,
  from ../../lyx-devel/src/support/sstream.h:40,
  from ../../lyx-devel/src/Lsstream.h:22,
  from ../../lyx-devel/src/support/lstrings.h:21,
  from ../../lyx-devel/src/format.h:22,
  from ../../lyx-devel/src/graph.C:12:

Sorry Edwin, just came back. I don't know how this can happend, as I've not
added any header that wasn't there before.
In converter.h we indeed had support/lstrings.h (it seems that this is the
one that is giving problems).
So you could compile perfectly before? Not even the warning above?
I'm lost. (but don't worry, it's just me that don't know enough)
A clue, anyone?
Alfredo




Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Try adding #include config.h to the top of format.h.

Alfredo




Re: converter.C

2003-02-28 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Freitag, 28. Februar 2003 14:35, Alfredo Braunstein wrote:
 Try adding #include config.h to the top of format.h.

Next error:

g++ -DHAVE_CONFIG_H -I. -I. -I. -I../boost -I/usr/include  -I/usr/X11R6/include  
-ftemplate-depth-50 -fno-exceptions -W -Wall -Winline -c -o format.o `test -f 
'format.C' || echo './'`format.C
cc1plus: warning: changing search order for system directory /usr/include
cc1plus: warning:   as it has already been specified as a non-system directory
format.C: In member function `void Formats::sort()':
format.C:132: `cout' undeclared (first use this function)
format.C:132: (Each undeclared identifier is reported only once for each
   function it appears in.)
format.C:132: `endl' undeclared (first use this function)
format.C: In member function `bool Formats::view(const Buffer*, const
   std::string, const std::string) const':
format.C:162: no class template named `io' in `boost'
format.C:162: `format' undeclared in namespace `boost'
...

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPl9q8rewfbDGmeqhAQFhlwP+JA6F5Tx3+o2V3d/ElSc6aKwK5Z+AFW8s
j/uN4vW28pHujpvfc9/2kOG+z87l6Zb0Y2wQBbhjGWvPZP2rrVU0WMM9zQHK+N+k
8GIm1GKB4Sy7xo/oE3f1LB2677u3wS8xbJOWp30QUuD1dRiBI+Yp77TRovWWBDZ1
ECLrx6Moy3U=
=Bsjn
-END PGP SIGNATURE-



Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Kornel Benko wrote:

 -BEGIN PGP SIGNED MESSAGE-
 
 On Freitag, 28. Februar 2003 14:35, Alfredo Braunstein wrote:
 Try adding #include config.h to the top of format.h.
 
 Next error:
 
 g++ -DHAVE_CONFIG_H -I. -I. -I. -I../boost -I/usr/include 
 -I/usr/X11R6/include  -ftemplate-depth-50 -fno-exceptions -W -Wall
 -Winline -c -o format.o `test -f 'format.C' || echo './'`format.C cc1plus:
 warning: changing search order for system directory /usr/include
 cc1plus: warning:   as it has already been specified as a non-system
 directory format.C: In member function `void Formats::sort()':
 format.C:132: `cout' undeclared (first use this function)
 format.C:132: (Each undeclared identifier is reported only once for each
function it appears in.)
 format.C:132: `endl' undeclared (first use this function)
 format.C: In member function `bool Formats::view(const Buffer*, const
std::string, const std::string) const':
 format.C:162: no class template named `io' in `boost'
 format.C:162: `format' undeclared in namespace `boost'
 ...
 

My fault, I'll prepare a patch to solve all these.

Sorry, Alfredo





Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Kornel Benko wrote:

 -BEGIN PGP SIGNED MESSAGE-
 
 On Freitag, 28. Februar 2003 14:35, Alfredo Braunstein wrote:
 Try adding #include config.h to the top of format.h.
 
 Next error:
 

How about this? I hope I'v catched them all...

Alfredo
? save
Index: converter.C
===
RCS file: /cvs/lyx/lyx-devel/src/converter.C,v
retrieving revision 1.65
diff -u -r1.65 converter.C
--- converter.C	2003/02/28 09:49:44	1.65
+++ converter.C	2003/02/28 14:29:29
@@ -29,10 +29,12 @@
 #include support/lyxfunctional.h
 #include support/path.h
 #include support/systemcall.h
+#include support/lstrings.h
 
 #include BoostFormat.h
 
 #include cctype
+#include LString.h
 
 #ifndef CXX_GLOBAL_CSTD
 using std::isdigit;
Index: converter.h
===
RCS file: /cvs/lyx/lyx-devel/src/converter.h,v
retrieving revision 1.25
diff -u -r1.25 converter.h
--- converter.h	2003/02/28 09:49:44	1.25
+++ converter.h	2003/02/28 14:29:29
@@ -13,9 +13,12 @@
  * Full author contact details are available in file CREDITS
  */
 
+#include config.h
+
 #include graph.h
 
 #include vector
+#include LString.h
 
 class Format;
 class Formats;
Index: format.C
===
RCS file: /cvs/lyx/lyx-devel/src/format.C,v
retrieving revision 1.1
diff -u -r1.1 format.C
--- format.C	2003/02/28 09:49:44	1.1
+++ format.C	2003/02/28 14:29:29
@@ -13,7 +13,6 @@
 #include debug.h
 #include lyx_cb.h // for ShowMessage() ... to be removed?
 #include gettext.h
-#include LString.h
 
 #include frontends/Alert.h //to be removed?
 
@@ -21,6 +20,16 @@
 #include support/path.h
 #include support/systemcall.h
 #include support/lyxfunctional.h
+
+#include BoostFormat.h
+
+#include algorithm
+
+using std::cout;
+using std::endl;
+using std::io;
+using std::find_if;
+
 
 
 namespace {
Index: format.h
===
RCS file: /cvs/lyx/lyx-devel/src/format.h,v
retrieving revision 1.1
diff -u -r1.1 format.h
--- format.h	2003/02/28 09:49:44	1.1
+++ format.h	2003/02/28 14:29:29
@@ -15,11 +15,10 @@
  * Full author contact details are available in file CREDITS
  */
 
+#include config.h
 
-
 #include buffer.h
 #include LString.h
-#include support/lstrings.h
 
 #include vector
 
Index: graph.C
===
RCS file: /cvs/lyx/lyx-devel/src/graph.C,v
retrieving revision 1.1
diff -u -r1.1 graph.C
--- graph.C	2003/02/28 09:49:44	1.1
+++ graph.C	2003/02/28 14:29:30
@@ -14,8 +14,12 @@
 #include queue
 #include vector
 
+#include algorithm
+
 using std::queue;
+using std::fill;
 using std::vector;
+using std::reverse;
 
 
 
Index: graph.h
===
RCS file: /cvs/lyx/lyx-devel/src/graph.h,v
retrieving revision 1.1
diff -u -r1.1 graph.h
--- graph.h	2003/02/28 09:49:44	1.1
+++ graph.h	2003/02/28 14:29:30
@@ -13,8 +13,9 @@
  * Full author contact details are available in file CREDITS
  */
 
-#include LString.h
+#include config.h
 
+#include LString.h
 #include queue
 #include vector
 
Index: lyxrc.C
===
RCS file: /cvs/lyx/lyx-devel/src/lyxrc.C,v
retrieving revision 1.143
diff -u -r1.143 lyxrc.C
--- lyxrc.C	2003/02/28 09:49:46	1.143
+++ lyxrc.C	2003/02/28 14:29:33
@@ -23,6 +23,7 @@
 #include support/filetools.h
 #include support/LAssert.h
 #include support/userinfo.h
+#include support/lstrings.h
 #include converter.h
 #include format.h
 #include gettext.h
Index: frontends/qt2/QLImage.C
===
RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/QLImage.C,v
retrieving revision 1.17
diff -u -r1.17 QLImage.C
--- frontends/qt2/QLImage.C	2003/02/28 09:49:46	1.17
+++ frontends/qt2/QLImage.C	2003/02/28 14:29:35
@@ -24,6 +24,9 @@
 #include qwmatrix.h
 #include qpainter.h
 
+#include LString.h
+#include support/lstrings.h
+
 #include boost/tuple/tuple.hpp
 
 using std::find_if;
Index: graphics/GraphicsConverter.C
===
RCS file: /cvs/lyx/lyx-devel/src/graphics/GraphicsConverter.C,v
retrieving revision 1.28
diff -u -r1.28 GraphicsConverter.C
--- graphics/GraphicsConverter.C	2003/02/28 09:49:48	1.28
+++ graphics/GraphicsConverter.C	2003/02/28 14:29:36
@@ -20,6 +20,7 @@
 #include support/forkedcall.h
 #include support/forkedcallqueue.h
 #include support/lyxlib.h
+#include support/lstrings.h
 
 #include boost/bind.hpp
 #include boost/signals/trackable.hpp
@@ -28,6 +29,8 @@
 #include support/LOstream.h
 #include fstream
 #include sys/types.h // needed for pid_t
+
+#include LString.h
 
 using std::endl;
 using std::ostream;
Index: insets/insetgraphics.C
===
RCS file: /cvs/lyx/lyx-devel/src/insets/insetgraphics.C,v
retrieving revision 1.153

Re: converter.C

2003-02-28 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Freitag, 28. Februar 2003 15:31, Alfredo Braunstein wrote:
 How about this? I hope I'v catched them all...

 Alfredo

 patch.diff

Still some there, but next directory ...

source='xformsImage.C' object='xformsImage.lo' libtool=yes \
depfile='.deps/xformsImage.Plo' tmpdepfile='.deps/xformsImage.TPlo' \
depmode=gcc3 /bin/sh ../../../config/depcomp \
/bin/sh ../../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../../src 
-I../../../images -I../../../src -I../../../src/frontends 
-I../../../src/frontends/controllers -I../../../boost  -I/usr/X11R6/include  
-ftemplate-depth-20 -fno-exceptions -W -Wall -Winline -c -o xformsImage.lo `test -f 
'xformsImage.C' || echo './'`xformsImage.C
g++ -DHAVE_CONFIG_H -I. -I. -I../../../src -I../../../images -I../../../src 
-I../../../src/frontends -I../../../src/frontends/controllers -I../../../boost 
-I/usr/X11R6/include -ftemplate-depth-20 -fno-exceptions -W -Wall -Winline -c 
xformsImage.C -MT xformsImage.lo -MD -MP -MF .deps/xformsImage.TPlo
xformsImage.C: In member function `virtual void grfx::xformsImage::clip(const
   grfx::Params)':
xformsImage.C:285: warning: comparison between signed and unsigned integer  expressions
xformsImage.C:287: warning: comparison between signed and unsigned integer  expressions
xformsImage.C: In member function `void grfx::xformsImage::statusCB(const  
std::string)':
xformsImage.C:342: `prefixIs' undeclared (first use this function)
xformsImage.C:342: (Each undeclared identifier is reported only once for each  
function it appears in.)
xformsImage.C: In function `int unnamed::status_report(FL_IMAGE*, const  char*)':
xformsImage.C:375: `rtrim' undeclared (first use this function)
...

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPl937LewfbDGmeqhAQFSTgP/SeHCQqyIRbcmAz4mXEx30tSH7w7EoK8a
oSKSBDshgX7Orpwbf8R4oN2nhdJOMTQOpgytVyn+8J7x37Yq5HMzOOpfeWqtbMvJ
0tCvFiKizICwu4/Sx/9kiybWruiN4ffUMU/F3F8MtRthkNEnuhoS/XTuBan6k5hx
D4BTg8OOoR0=
=3rIk
-END PGP SIGNATURE-



Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Kornel Benko wrote:

 Still some there, but next directory ...
 

Of course, forgot about xforms. (should work with qt, though). I'll need
another age to compile. Sigh.

Alfredo



Re: converter.C

2003-02-28 Thread Edwin Leuven
still get


cc1plus: warning: changing search order for system directory /usr/include
cc1plus: warning:   as it has already been specified as a non-system directory


and

../../lyx-devel/src/format.C:28: `cout' not declared
../../lyx-devel/src/format.C:30: `io' not declared
../../lyx-devel/src/format.C: In member function `void Formats::sort()':
../../lyx-devel/src/format.C:141: `cout' undeclared (first use this function)
../../lyx-devel/src/format.C:141: (Each undeclared identifier is reported only
   once for each function it appears in.)


in format.C


Re: converter.C

2003-02-28 Thread Jean-Marc Lasgouttes
 Alfredo == Alfredo Braunstein [EMAIL PROTECTED] writes:

Alfredo Kornel Benko wrote:
 -BEGIN PGP SIGNED MESSAGE-
 
 On Freitag, 28. Februar 2003 14:35, Alfredo Braunstein wrote:
 Try adding #include config.h to the top of format.h.
  Next error:
 

Alfredo How about this? I hope I'v catched them all...

Index: format.h
===
RCS file: /cvs/lyx/lyx-devel/src/format.h,v
retrieving revision 1.1
diff -u -r1.1 format.h
--- format.h2003/02/28 09:49:44 1.1
+++ format.h2003/02/28 14:29:29
@@ -15,11 +15,10 @@
  * Full author contact details are available in file CREDITS
  */
 
+#include config.h


Alfredo, please don't do this. config.h should be included as the
first header in all .C file, but never in .h files. 

JMarc


Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

 Alfredo, please don't do this. config.h should be included as the
 first header in all .C file, but never in .h files.
 
 JMarc

Finally, some words of wisdom. I though that this was the solution because
of LString.h:

#if 0
#ifndef _CONFIG_H
#error The config.h header should always be included before LString.h
#endif
#endif

and we do need LString.h in format.h.

Ok, it's between #if 0 #endif but...

So how can I solve the original compile problem of Edwin on gcc 3.2? I'm
totally lost here. Moreover, is there a way to make g++ 2.95 to behave as
strict as g++ 3.x? 

Thanks, Alfredo

g++ -DHAVE_CONFIG_H -I. -I../../lyx-devel/src -I. -I../../lyx-devel/boost 
-I/usr/include  -I/usr/X11R6/include  -g -O -fno-exceptions -W -Wall
-Winline 
-c -o graph.o `test -f '../../lyx-devel/src/graph.C' || echo 
'../../lyx-devel/src/'`../../lyx-devel/src/graph.C
cc1plus: warning: changing search order for system directory /usr/include
cc1plus: warning:   as it has already been specified as a non-system
directory
In file included from /usr/include/c++/3.2/backward/streambuf.h:31,
 from ../../lyx-devel/src/support/sstream.h:40,
 from ../../lyx-devel/src/Lsstream.h:22,
 from ../../lyx-devel/src/support/lstrings.h:21,
 from ../../lyx-devel/src/format.h:22,
 from ../../lyx-devel/src/graph.C:12:
/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning
This 
file includes at least one deprecated or antiquated header. Please consider 
using one of the 32 headers found in section 17.4.1.2 of the C++ standard. 
Examples include substituting the X header for the X.h header for C++ 
includes, or sstream instead of the deprecated header strstream.h. To 
disable this warning use -Wno-deprecated.
In file included from ../../lyx-devel/src/Lsstream.h:22,
 from ../../lyx-devel/src/support/lstrings.h:21,
 from ../../lyx-devel/src/format.h:22,
 from ../../lyx-devel/src/graph.C:12:




Re: converter.C

2003-02-28 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Freitag, 28. Februar 2003 16:26, Edwin Leuven wrote:
 ../../lyx-devel/src/format.C:28: `cout' not declared

missing #include iostream

 ../../lyx-devel/src/format.C:30: `io' not declared

Remove this line

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPl+FHLewfbDGmeqhAQFw8gQA3LWgVWvI7NdLCUlQ4fHMd9a8sm3bfgVf
O826PWYyUoBfoGXk9N/E3At+5HdhzCg2m0y4Rhx2Hnm3+vRbGOQ8nB6XXd9vzBPm
HyUhUfT5Ppwng1APfk0OfQq8dGX81Vq14xAW5SA+8XWEtCWbxOvi8NoJv1Em6+H3
ZSMfQIIiV5w=
=4kv2
-END PGP SIGNATURE-



Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Alfredo Braunstein wrote:

 and we do need LString.h in format.h.
 
 Ok, it's between #if 0 #endif but...
 
 So how can I solve the original compile problem of Edwin on gcc 3.2? I'm
 totally lost here. Moreover, is there a way to make g++ 2.95 to behave as
 strict as g++ 3.x?

Of course, I've missed the #include config.h in graph.C. Never mind.

Alfredo




Re: converter.C

2003-02-28 Thread Jean-Marc Lasgouttes
 Alfredo == Alfredo Braunstein [EMAIL PROTECTED] writes:

Alfredo So how can I solve the original compile problem of Edwin on
Alfredo gcc 3.2? I'm totally lost here. Moreover, is there a way to
Alfredo make g++ 2.95 to behave as strict as g++ 3.x?

Try to add ``#include config.h'' as first thing in graph.C (and your
other .C files).

JMarc



Re: converter.C

2003-02-28 Thread Alfredo Braunstein
 support/filetools.h \
Index: MenuBackend.C
===
RCS file: /cvs/lyx/lyx-devel/src/MenuBackend.C,v
retrieving revision 1.66
diff -u -r1.66 MenuBackend.C
--- MenuBackend.C	2003/02/15 21:03:40	1.66
+++ MenuBackend.C	2003/02/28 08:44:11
@@ -23,7 +23,7 @@
 #include "lyx_main.h" // for lastfiles
 #include "bufferlist.h"
 #include "buffer.h"
-#include "converter.h"
+#include "format.h"
 #include "exporter.h"
 #include "importer.h"
 #include "FloatList.h"
Index: buffer.C
===
RCS file: /cvs/lyx/lyx-devel/src/buffer.C,v
retrieving revision 1.414
diff -u -r1.414 buffer.C
--- buffer.C	2003/02/21 09:20:13	1.414
+++ buffer.C	2003/02/28 08:44:15
@@ -33,7 +33,7 @@
 #include "language.h"
 #include "exporter.h"
 #include "Lsstream.h"
-#include "converter.h"
+#include "format.h"
 #include "BufferView.h"
 #include "ParagraphParameters.h"
 #include "iterators.h"
Index: converter.C
===
RCS file: /cvs/lyx/lyx-devel/src/converter.C,v
retrieving revision 1.64
diff -u -r1.64 converter.C
--- converter.C	2003/02/14 14:49:48	1.64
+++ converter.C	2003/02/28 08:44:16
@@ -1,16 +1,18 @@
-/* This file is part of
- * ==
+/**
+ * \file converter.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *   LyX, The Document Processor
+ * \author Dekel Tsur
  *
- *   Copyright 1995 Matthias Ettrich
- *   Copyright 1995-2001 The LyX Team.
- *
- * == */
+ * Full author contact details are available in file CREDITS
+ */
 
 #include 
 
 #include "converter.h"
+#include "graph.h"
+#include "format.h"
 #include "lyxrc.h"
 #include "buffer.h"
 #include "bufferview_funcs.h"
@@ -37,12 +39,8 @@
 #endif
 
 using std::vector;
-using std::queue;
 using std::endl;
-using std::fill;
 using std::find_if;
-using std::reverse;
-using std::sort;
 
 namespace {
 
@@ -50,10 +48,9 @@
 string const token_base("$$b");
 string const token_to("$$o");
 string const token_path("$$p");
+
 
-//
 
-inline
 string const add_options(string const & command, string const & options)
 {
 	string head;
@@ -63,189 +60,13 @@
 
 } // namespace anon
 
-//
-
-bool Format::dummy() const
-{
-	return extension().empty();
-}
-
-
-bool Format::isChildFormat() const
-{
-	if (name_.empty())
-		return false;
-	return isdigit(name_[name_.length() - 1]);
-}
-
-
-string const Format::parentFormat() const
-{
-	return name_.substr(0, name_.length() - 1);
-}
-
-//
-
-// This method should return a reference, and throw an exception
-// if the format named name cannot be found (Lgb)
-Format const * Formats::getFormat(string const & name) const
-{
-	FormatList::const_iterator cit =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(::name, name));
-	if (cit != formatlist.end())
-		return &(*cit);
-	else
-		return 0;
-}
-
-
-int Formats::getNumber(string const & name) const
-{
-	FormatList::const_iterator cit =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(::name, name));
-	if (cit != formatlist.end())
-		return cit - formatlist.begin();
-	else
-		return -1;
-}
-
-
-void Formats::add(string const & name)
-{
-	if (!getFormat(name))
-		add(name, name, name, string());
-}
-
-
-// FIXME: horrednously mis-named, especially given the other ::add
-// function
-void Formats::add(string const & name, string const & extension,
-		  string const & prettyname, string const & shortcut)
-{
-	FormatList::iterator it =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(::name, name));
-	if (it == formatlist.end())
-		formatlist.push_back(Format(name, extension, prettyname,
-	shortcut, ""));
-	else {
-		string viewer = it->viewer();
-		*it = Format(name, extension, prettyname, shortcut, viewer);
-	}
-}
-
-
-void Formats::erase(string const & name)
-{
-	FormatList::iterator it =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(::name, name));
-	if (it != formatlist.end())
-		formatlist.erase(it);
-}
-
-
-void Formats::sort()
-{
-	std::sort(formatlist.begin(), formatlist.end());
-}
-
-
-void Formats::setViewer(string const & name, string const & command)
-{
-	add(name);
-	FormatList::iterator it =
-		find_if(

Re: converter.C

2003-02-28 Thread Andre Poenitz
On Fri, Feb 28, 2003 at 09:45:15AM +0100, Alfredo Braunstein wrote:
> Sorry for the delay, the patch didn't applied cleanly anymore and had to
> backup some new changes to recreate it.

Applied.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-28 Thread Edwin Leuven
compile fails for me:

g++ -DHAVE_CONFIG_H -I. -I../../lyx-devel/src -I. -I../../lyx-devel/boost 
-I/usr/include  -I/usr/X11R6/include  -g -O -fno-exceptions -W -Wall -Winline 
-c -o graph.o `test -f '../../lyx-devel/src/graph.C' || echo 
'../../lyx-devel/src/'`../../lyx-devel/src/graph.C
cc1plus: warning: changing search order for system directory "/usr/include"
cc1plus: warning:   as it has already been specified as a non-system directory
In file included from /usr/include/c++/3.2/backward/streambuf.h:31,
 from ../../lyx-devel/src/support/sstream.h:40,
 from ../../lyx-devel/src/Lsstream.h:22,
 from ../../lyx-devel/src/support/lstrings.h:21,
 from ../../lyx-devel/src/format.h:22,
 from ../../lyx-devel/src/graph.C:12:
/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning This 
file includes at least one deprecated or antiquated header. Please consider 
using one of the 32 headers found in section 17.4.1.2 of the C++ standard. 
Examples include substituting the  header for the  header for C++ 
includes, or  instead of the deprecated header . To 
disable this warning use -Wno-deprecated.
In file included from ../../lyx-devel/src/Lsstream.h:22,
 from ../../lyx-devel/src/support/lstrings.h:21,
 from ../../lyx-devel/src/format.h:22,
 from ../../lyx-devel/src/graph.C:12:
../../lyx-devel/src/support/sstream.h:44: conflicting types for `struct
   std::stringbuf'
/usr/include/c++/3.2/iosfwd:110: previous declaration as `typedef struct
   std::basic_stringbuf
   std::stringbuf'
../../lyx-devel/src/support/sstream.h:98: syntax error before `;' token
../../lyx-devel/src/support/sstream.h:45: destructor `stringbuf' must match
   class name `basic_ios'
../../lyx-devel/src/support/sstream.h:45: `virtual std::basic_ios::~basic_ios()' and `void std::basic_ios<_CharT,
   _Traits>::basic_ios() [with _CharT = char, _Traits = 
std::char_traits]
   ' cannot be overloaded
../../lyx-devel/src/support/sstream.h:45: `virtual std::basic_ios::~basic_ios()' and `void std::basic_ios<_CharT,
   _Traits>::basic_ios() [with _CharT = char, _Traits = 
std::char_traits]
   ' cannot be overloaded
../../lyx-devel/src/support/sstream.h:45: `std::basic_ios::~basic_ios()' and `void std::basic_ios<_CharT,
   _Traits>::basic_ios() [with _CharT = char, _Traits = 
std::char_traits]
   ' cannot be overloaded
../../lyx-devel/src/support/sstream.h: In constructor
   `std::stringbuf::stringbuf(int)':
../../lyx-devel/src/support/sstream.h:53: parse error before `;' token
../../lyx-devel/src/support/sstream.h:54: class `std::stringbuf' does not have
   any field named `rpos'
../../lyx-devel/src/support/sstream.h:54: class `std::stringbuf' does not have
   any field named `bufsize'
../../lyx-devel/src/support/sstream.h:55: no matching function for call to `
   std::basic_streambuf::basic_streambuf(int&)'
/usr/include/c++/3.2/streambuf:486: candidates are:
   std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const
   std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char, _Traits =
   std::char_traits]
/usr/include/c++/3.2/streambuf:350:
   std::basic_streambuf<_CharT, _Traits>::basic_streambuf() [with _CharT =
   char, _Traits = std::char_traits]
../../lyx-devel/src/support/sstream.h: In constructor
   `std::stringbuf::stringbuf(const std::string&, int)':
../../lyx-devel/src/support/sstream.h:58: parse error before `;' token
../../lyx-devel/src/support/sstream.h:59: class `std::stringbuf' does not have
   any field named `bufsize'
../../lyx-devel/src/support/sstream.h:60: no matching function for call to `
   std::basic_streambuf::basic_streambuf(int&)'
/usr/include/c++/3.2/streambuf:486: candidates are:
   std::basic_streambuf<_CharT, _Traits>::basic_streambuf(const
   std::basic_streambuf<_CharT, _Traits>&) [with _CharT = char, _Traits =
   std::char_traits]
/usr/include/c++/3.2/streambuf:350:
   std::basic_streambuf<_CharT, _Traits>::basic_streambuf() [with _CharT =
   char, _Traits = std::char_traits]
../../lyx-devel/src/support/sstream.h:61: `mode' undeclared (first use this
   function)
../../lyx-devel/src/support/sstream.h:61: (Each undeclared identifier is
   reported only once for each function it appears in.)
../../lyx-devel/src/support/sstream.h:63: `defbuf' undeclared (first use this
   function)
../../lyx-devel/src/support/sstream.h:63: `bufsize' undeclared (first use this
   function)
../../lyx-devel/src/support/sstream.h:69: `rpos' undeclared (first use this
   function)
../../lyx-devel/src/support/sstream.h: At global scope:
../../lyx-devel/src/support/sstream.h:106: field `__my_sb' has incomplete type
../../lyx-devel/src/support/sstream.h:104: confused by earlier errors, bailing 
out
make[3]: *** [graph.o] Error 1

Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Edwin Leuven wrote:

> compile fails for me:
> 
> g++ -DHAVE_CONFIG_H -I. -I../../lyx-devel/src -I. -I../../lyx-devel/boost
> -I/usr/include  -I/usr/X11R6/include  -g -O -fno-exceptions -W -Wall
> -Winline -c -o graph.o `test -f '../../lyx-devel/src/graph.C' || echo
> '../../lyx-devel/src/'`../../lyx-devel/src/graph.C
> cc1plus: warning: changing search order for system directory
> "/usr/include"
> cc1plus: warning:   as it has already been specified as a non-system
> directory In file included from
> /usr/include/c++/3.2/backward/streambuf.h:31,
>  from ../../lyx-devel/src/support/sstream.h:40,
>  from ../../lyx-devel/src/Lsstream.h:22,
>  from ../../lyx-devel/src/support/lstrings.h:21,
>  from ../../lyx-devel/src/format.h:22,
>  from ../../lyx-devel/src/graph.C:12:

Sorry Edwin, just came back. I don't know how this can happend, as I've not
added any header that wasn't there before.
In converter.h we indeed had support/lstrings.h (it seems that this is the
one that is giving problems).
So you could compile perfectly before? Not even the warning above?
I'm lost. (but don't worry, it's just me that don't know enough)
A clue, anyone?
Alfredo




Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Try adding #include  to the top of format.h.

Alfredo




Re: converter.C

2003-02-28 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Freitag, 28. Februar 2003 14:35, Alfredo Braunstein wrote:
> Try adding #include  to the top of format.h.

Next error:

g++ -DHAVE_CONFIG_H -I. -I. -I. -I../boost -I/usr/include  -I/usr/X11R6/include  
-ftemplate-depth-50 -fno-exceptions -W -Wall -Winline -c -o format.o `test -f 
'format.C' || echo './'`format.C
cc1plus: warning: changing search order for system directory "/usr/include"
cc1plus: warning:   as it has already been specified as a non-system directory
format.C: In member function `void Formats::sort()':
format.C:132: `cout' undeclared (first use this function)
format.C:132: (Each undeclared identifier is reported only once for each
   function it appears in.)
format.C:132: `endl' undeclared (first use this function)
format.C: In member function `bool Formats::view(const Buffer*, const
   std::string&, const std::string&) const':
format.C:162: no class template named `io' in `boost'
format.C:162: `format' undeclared in namespace `boost'
...

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPl9q8rewfbDGmeqhAQFhlwP+JA6F5Tx3+o2V3d/ElSc6aKwK5Z+AFW8s
j/uN4vW28pHujpvfc9/2kOG+z87l6Zb0Y2wQBbhjGWvPZP2rrVU0WMM9zQHK+N+k
8GIm1GKB4Sy7xo/oE3f1LB2677u3wS8xbJOWp30QUuD1dRiBI+Yp77TRovWWBDZ1
ECLrx6Moy3U=
=Bsjn
-END PGP SIGNATURE-



Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Kornel Benko wrote:

> -BEGIN PGP SIGNED MESSAGE-
> 
> On Freitag, 28. Februar 2003 14:35, Alfredo Braunstein wrote:
>> Try adding #include  to the top of format.h.
> 
> Next error:
> 
> g++ -DHAVE_CONFIG_H -I. -I. -I. -I../boost -I/usr/include 
> -I/usr/X11R6/include  -ftemplate-depth-50 -fno-exceptions -W -Wall
> -Winline -c -o format.o `test -f 'format.C' || echo './'`format.C cc1plus:
> warning: changing search order for system directory "/usr/include"
> cc1plus: warning:   as it has already been specified as a non-system
> directory format.C: In member function `void Formats::sort()':
> format.C:132: `cout' undeclared (first use this function)
> format.C:132: (Each undeclared identifier is reported only once for each
>function it appears in.)
> format.C:132: `endl' undeclared (first use this function)
> format.C: In member function `bool Formats::view(const Buffer*, const
>std::string&, const std::string&) const':
> format.C:162: no class template named `io' in `boost'
> format.C:162: `format' undeclared in namespace `boost'
> ...
> 

My fault, I'll prepare a patch to solve all these.

Sorry, Alfredo





Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Kornel Benko wrote:

> -BEGIN PGP SIGNED MESSAGE-
> 
> On Freitag, 28. Februar 2003 14:35, Alfredo Braunstein wrote:
>> Try adding #include  to the top of format.h.
> 
> Next error:
> 

How about this? I hope I'v catched them all...

Alfredo
? save
Index: converter.C
===
RCS file: /cvs/lyx/lyx-devel/src/converter.C,v
retrieving revision 1.65
diff -u -r1.65 converter.C
--- converter.C	2003/02/28 09:49:44	1.65
+++ converter.C	2003/02/28 14:29:29
@@ -29,10 +29,12 @@
 #include "support/lyxfunctional.h"
 #include "support/path.h"
 #include "support/systemcall.h"
+#include "support/lstrings.h"
 
 #include "BoostFormat.h"
 
 #include 
+#include "LString.h"
 
 #ifndef CXX_GLOBAL_CSTD
 using std::isdigit;
Index: converter.h
===
RCS file: /cvs/lyx/lyx-devel/src/converter.h,v
retrieving revision 1.25
diff -u -r1.25 converter.h
--- converter.h	2003/02/28 09:49:44	1.25
+++ converter.h	2003/02/28 14:29:29
@@ -13,9 +13,12 @@
  * Full author contact details are available in file CREDITS
  */
 
+#include 
+
 #include "graph.h"
 
 #include 
+#include "LString.h"
 
 class Format;
 class Formats;
Index: format.C
===
RCS file: /cvs/lyx/lyx-devel/src/format.C,v
retrieving revision 1.1
diff -u -r1.1 format.C
--- format.C	2003/02/28 09:49:44	1.1
+++ format.C	2003/02/28 14:29:29
@@ -13,7 +13,6 @@
 #include "debug.h"
 #include "lyx_cb.h" // for ShowMessage() ... to be removed?
 #include "gettext.h"
-#include "LString.h"
 
 #include "frontends/Alert.h" //to be removed?
 
@@ -21,6 +20,16 @@
 #include "support/path.h"
 #include "support/systemcall.h"
 #include "support/lyxfunctional.h"
+
+#include "BoostFormat.h"
+
+#include 
+
+using std::cout;
+using std::endl;
+using std::io;
+using std::find_if;
+
 
 
 namespace {
Index: format.h
===
RCS file: /cvs/lyx/lyx-devel/src/format.h,v
retrieving revision 1.1
diff -u -r1.1 format.h
--- format.h	2003/02/28 09:49:44	1.1
+++ format.h	2003/02/28 14:29:29
@@ -15,11 +15,10 @@
  * Full author contact details are available in file CREDITS
  */
 
+#include 
 
-
 #include "buffer.h"
 #include "LString.h"
-#include "support/lstrings.h"
 
 #include 
 
Index: graph.C
===
RCS file: /cvs/lyx/lyx-devel/src/graph.C,v
retrieving revision 1.1
diff -u -r1.1 graph.C
--- graph.C	2003/02/28 09:49:44	1.1
+++ graph.C	2003/02/28 14:29:30
@@ -14,8 +14,12 @@
 #include 
 #include 
 
+#include 
+
 using std::queue;
+using std::fill;
 using std::vector;
+using std::reverse;
 
 
 
Index: graph.h
===
RCS file: /cvs/lyx/lyx-devel/src/graph.h,v
retrieving revision 1.1
diff -u -r1.1 graph.h
--- graph.h	2003/02/28 09:49:44	1.1
+++ graph.h	2003/02/28 14:29:30
@@ -13,8 +13,9 @@
  * Full author contact details are available in file CREDITS
  */
 
-#include "LString.h"
+#include 
 
+#include "LString.h"
 #include 
 #include 
 
Index: lyxrc.C
===
RCS file: /cvs/lyx/lyx-devel/src/lyxrc.C,v
retrieving revision 1.143
diff -u -r1.143 lyxrc.C
--- lyxrc.C	2003/02/28 09:49:46	1.143
+++ lyxrc.C	2003/02/28 14:29:33
@@ -23,6 +23,7 @@
 #include "support/filetools.h"
 #include "support/LAssert.h"
 #include "support/userinfo.h"
+#include "support/lstrings.h"
 #include "converter.h"
 #include "format.h"
 #include "gettext.h"
Index: frontends/qt2/QLImage.C
===
RCS file: /cvs/lyx/lyx-devel/src/frontends/qt2/QLImage.C,v
retrieving revision 1.17
diff -u -r1.17 QLImage.C
--- frontends/qt2/QLImage.C	2003/02/28 09:49:46	1.17
+++ frontends/qt2/QLImage.C	2003/02/28 14:29:35
@@ -24,6 +24,9 @@
 #include 
 #include 
 
+#include "LString.h"
+#include "support/lstrings.h"
+
 #include 
 
 using std::find_if;
Index: graphics/GraphicsConverter.C
===
RCS file: /cvs/lyx/lyx-devel/src/graphics/GraphicsConverter.C,v
retrieving revision 1.28
diff -u -r1.28 GraphicsConverter.C
--- graphics/GraphicsConverter.C	2003/02/28 09:49:48	1.28
+++ graphics/GraphicsConverter.C	2003/02/28 14:29:36
@@ -20,6 +20,7 @@
 #include "support/forkedcall.h"
 #include "support/forkedcallqueue.h"
 #include "support/lyxlib.h"
+#include "support/lstrings.h"
 
 #include 
 #include 
@@ -28,6 +29,8 @@
 #include "support/LOstream.h"

Re: converter.C

2003-02-28 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Freitag, 28. Februar 2003 15:31, Alfredo Braunstein wrote:
> How about this? I hope I'v catched them all...
>
> Alfredo
>
> patch.diff

Still some there, but next directory ...

source='xformsImage.C' object='xformsImage.lo' libtool=yes \
depfile='.deps/xformsImage.Plo' tmpdepfile='.deps/xformsImage.TPlo' \
depmode=gcc3 /bin/sh ../../../config/depcomp \
/bin/sh ../../../libtool --mode=compile g++ -DHAVE_CONFIG_H -I. -I. -I../../../src 
-I../../../images -I../../../src -I../../../src/frontends 
-I../../../src/frontends/controllers -I../../../boost  -I/usr/X11R6/include  
-ftemplate-depth-20 -fno-exceptions -W -Wall -Winline -c -o xformsImage.lo `test -f 
'xformsImage.C' || echo './'`xformsImage.C
g++ -DHAVE_CONFIG_H -I. -I. -I../../../src -I../../../images -I../../../src 
-I../../../src/frontends -I../../../src/frontends/controllers -I../../../boost 
-I/usr/X11R6/include -ftemplate-depth-20 -fno-exceptions -W -Wall -Winline -c 
xformsImage.C -MT xformsImage.lo -MD -MP -MF .deps/xformsImage.TPlo
xformsImage.C: In member function `virtual void grfx::xformsImage::clip(const
   grfx::Params&)':
xformsImage.C:285: warning: comparison between signed and unsigned integer  expressions
xformsImage.C:287: warning: comparison between signed and unsigned integer  expressions
xformsImage.C: In member function `void grfx::xformsImage::statusCB(const  
std::string&)':
xformsImage.C:342: `prefixIs' undeclared (first use this function)
xformsImage.C:342: (Each undeclared identifier is reported only once for each  
function it appears in.)
xformsImage.C: In function `int ::status_report(FL_IMAGE*, const  char*)':
xformsImage.C:375: `rtrim' undeclared (first use this function)
...

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPl937LewfbDGmeqhAQFSTgP/SeHCQqyIRbcmAz4mXEx30tSH7w7EoK8a
oSKSBDshgX7Orpwbf8R4oN2nhdJOMTQOpgytVyn+8J7x37Yq5HMzOOpfeWqtbMvJ
0tCvFiKizICwu4/Sx/9kiybWruiN4ffUMU/F3F8MtRthkNEnuhoS/XTuBan6k5hx
D4BTg8OOoR0=
=3rIk
-END PGP SIGNATURE-



Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Kornel Benko wrote:

> Still some there, but next directory ...
> 

Of course, forgot about xforms. (should work with qt, though). I'll need
another age to compile. Sigh.

Alfredo



Re: converter.C

2003-02-28 Thread Edwin Leuven
still get


cc1plus: warning: changing search order for system directory "/usr/include"
cc1plus: warning:   as it has already been specified as a non-system directory


and

../../lyx-devel/src/format.C:28: `cout' not declared
../../lyx-devel/src/format.C:30: `io' not declared
../../lyx-devel/src/format.C: In member function `void Formats::sort()':
../../lyx-devel/src/format.C:141: `cout' undeclared (first use this function)
../../lyx-devel/src/format.C:141: (Each undeclared identifier is reported only
   once for each function it appears in.)


in format.C


Re: converter.C

2003-02-28 Thread Jean-Marc Lasgouttes
> "Alfredo" == Alfredo Braunstein <[EMAIL PROTECTED]> writes:

Alfredo> Kornel Benko wrote:
>> -BEGIN PGP SIGNED MESSAGE-
>> 
>> On Freitag, 28. Februar 2003 14:35, Alfredo Braunstein wrote:
>>> Try adding #include  to the top of format.h.
>>  Next error:
>> 

Alfredo> How about this? I hope I'v catched them all...

Index: format.h
===
RCS file: /cvs/lyx/lyx-devel/src/format.h,v
retrieving revision 1.1
diff -u -r1.1 format.h
--- format.h2003/02/28 09:49:44 1.1
+++ format.h2003/02/28 14:29:29
@@ -15,11 +15,10 @@
  * Full author contact details are available in file CREDITS
  */
 
+#include 


Alfredo, please don't do this.  should be included as the
first header in all .C file, but never in .h files. 

JMarc


Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

> Alfredo, please don't do this.  should be included as the
> first header in all .C file, but never in .h files.
> 
> JMarc

Finally, some words of wisdom. I though that this was the solution because
of LString.h:

#if 0
#ifndef _CONFIG_H
#error The  header should always be included before LString.h
#endif
#endif

and we do need LString.h in format.h.

Ok, it's between #if 0 #endif but...

So how can I solve the original compile problem of Edwin on gcc 3.2? I'm
totally lost here. Moreover, is there a way to make g++ 2.95 to behave as
strict as g++ 3.x? 

Thanks, Alfredo

g++ -DHAVE_CONFIG_H -I. -I../../lyx-devel/src -I. -I../../lyx-devel/boost 
-I/usr/include  -I/usr/X11R6/include  -g -O -fno-exceptions -W -Wall
-Winline 
-c -o graph.o `test -f '../../lyx-devel/src/graph.C' || echo 
'../../lyx-devel/src/'`../../lyx-devel/src/graph.C
cc1plus: warning: changing search order for system directory "/usr/include"
cc1plus: warning:   as it has already been specified as a non-system
directory
In file included from /usr/include/c++/3.2/backward/streambuf.h:31,
 from ../../lyx-devel/src/support/sstream.h:40,
 from ../../lyx-devel/src/Lsstream.h:22,
 from ../../lyx-devel/src/support/lstrings.h:21,
 from ../../lyx-devel/src/format.h:22,
 from ../../lyx-devel/src/graph.C:12:
/usr/include/c++/3.2/backward/backward_warning.h:32:2: warning: #warning
This 
file includes at least one deprecated or antiquated header. Please consider 
using one of the 32 headers found in section 17.4.1.2 of the C++ standard. 
Examples include substituting the  header for the  header for C++ 
includes, or  instead of the deprecated header . To 
disable this warning use -Wno-deprecated.
In file included from ../../lyx-devel/src/Lsstream.h:22,
 from ../../lyx-devel/src/support/lstrings.h:21,
 from ../../lyx-devel/src/format.h:22,
 from ../../lyx-devel/src/graph.C:12:




Re: converter.C

2003-02-28 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Freitag, 28. Februar 2003 16:26, Edwin Leuven wrote:
> ../../lyx-devel/src/format.C:28: `cout' not declared

missing #include 

> ../../lyx-devel/src/format.C:30: `io' not declared

Remove this line

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: PGP 6.5.8

iQCVAwUBPl+FHLewfbDGmeqhAQFw8gQA3LWgVWvI7NdLCUlQ4fHMd9a8sm3bfgVf
O826PWYyUoBfoGXk9N/E3At+5HdhzCg2m0y4Rhx2Hnm3+vRbGOQ8nB6XXd9vzBPm
HyUhUfT5Ppwng1APfk0OfQq8dGX81Vq14xAW5SA+8XWEtCWbxOvi8NoJv1Em6+H3
ZSMfQIIiV5w=
=4kv2
-END PGP SIGNATURE-



Re: converter.C

2003-02-28 Thread Alfredo Braunstein
Alfredo Braunstein wrote:

> and we do need LString.h in format.h.
> 
> Ok, it's between #if 0 #endif but...
> 
> So how can I solve the original compile problem of Edwin on gcc 3.2? I'm
> totally lost here. Moreover, is there a way to make g++ 2.95 to behave as
> strict as g++ 3.x?

Of course, I've missed the #include  in graph.C. Never mind.

Alfredo




Re: converter.C

2003-02-28 Thread Jean-Marc Lasgouttes
> "Alfredo" == Alfredo Braunstein <[EMAIL PROTECTED]> writes:

Alfredo> So how can I solve the original compile problem of Edwin on
Alfredo> gcc 3.2? I'm totally lost here. Moreover, is there a way to
Alfredo> make g++ 2.95 to behave as strict as g++ 3.x?

Try to add ``#include '' as first thing in graph.C (and your
other .C files).

JMarc



converter.C

2003-02-27 Thread Alfredo Braunstein
I finally managed to work on converter.C.

I've done the first split (converter.[Ch] - converter.[Ch] + format.[Ch]
+graph.[Ch]), with no change in interface nor in functionality.

The graph work is done in the class Graph, who knows _almost_ nothing about
converters nor formats (work with integers). The almost is because there's
still a harcoded 'target == lyx'. This will go away soon, once I rework
graph a little.

As expected, converter.C includes {format,graph}.h but format.C is
standalone. (and graph.h will become so soon). I expect also to find many
source files where converter.h was included but only formats is used. 

Before I post it, who is the author of converter.C? It's missing from the
headers.




Re: converter.C

2003-02-27 Thread Angus Leeming
Alfredo Braunstein wrote:

 I finally managed to work on converter.C.
 
 I've done the first split (converter.[Ch] - converter.[Ch] + format.[Ch]
 +graph.[Ch]), with no change in interface nor in functionality.
 
 The graph work is done in the class Graph, who knows _almost_ nothing
 about converters nor formats (work with integers). The almost is because
 there's still a harcoded 'target == lyx'. This will go away soon, once I
 rework graph a little.
 
 As expected, converter.C includes {format,graph}.h but format.C is
 standalone. (and graph.h will become so soon). I expect also to find many
 source files where converter.h was included but only formats is used.
 
 Before I post it, who is the author of converter.C? It's missing from the
 headers.

Dekel.

-- 
Angus



Re: converter.C

2003-02-27 Thread Alfredo Braunstein
 =
			vertices_[i].out_vertices.begin();
		vectorint::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit) {
			if (!visited_[*cit]) {
visited_[*cit] = true;
Q_.push(*cit);
			}
		}
	}

	return false;
}


Graph::EdgePath const
Graph::getPath(int from, int t)
{
	EdgePath path;
	if (from == t)
		return path;

	int const s = bfs_init(from);
	if (s  0 || t  0)
		return path;

	vectorint prev_edge(formats.size());
	vectorint prev_vertex(formats.size());

	bool found = false;
	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		if (i == t) {
			found = true;
			break;
		}

		vectorint::const_iterator beg =
			vertices_[i].out_vertices.begin();
		vectorint::const_iterator cit = beg;
		vectorint::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit)
			if (!visited_[*cit]) {
int const j = *cit;
visited_[j] = true;
Q_.push(j);
int const k = cit - beg;
prev_edge[j] = vertices_[i].out_edges[k];
prev_vertex[j] = i;
			}
	}
	if (!found)
		return path;

	while (t != s) {
		path.push_back(prev_edge[t]);
		t = prev_vertex[t];
	}
	reverse(path.begin(), path.end());
	return path;
}

void Graph::init(int size)
{
	vertices_ = vectorVertex(size);
	visited_.resize(size);
	numedges_ = 0;
}

void Graph::addEdge(int s, int t)
{
	vertices_[t].in_vertices.push_back(s);
	vertices_[s].out_vertices.push_back(t);
	vertices_[s].out_edges.push_back(numedges_++);
}

vectorGraph::Vertex Graph::vertices_;


// -*- C++ -*-
/**
 * \file graph.h
 * Copyright 1995 Matthias Ettrich
 * Copyright 2002 the LyX Team
 * Read the file COPYING
 *
 * \author Dekel Tsur
*/

#ifndef CONVERSIONGRAPH_H
#define CONVERSIONGRAPH_H

#include format.h

#include vector
#include queue
#include string

using std::queue;
using std::vector;
using std::string;


class Graph {
public: 
	Graph() : numedges_(0) {};
	///
	typedef std::vectorint EdgePath;
	///
	std::vectorint const
	getReachableTo(int, bool clear_visited);
	///
	std::vectorint const
	getReachable(int, bool only_viewable,
		 bool clear_visited);
	///
	bool isReachable(int, int);
	///
	EdgePath const getPath(int, int);
	///
	void addEdge(int s, int t);
	///
	void init(int size);

private:
	///
	int bfs_init(int, bool clear_visited = true);

	///
	struct Vertex {
		std::vectorint in_vertices;
		std::vectorint out_vertices;
		std::vectorint out_edges;
	};
	///
	static
	std::vectorVertex vertices_;
	///
	std::vectorbool visited_;
	///
	std::queueint Q_;

	int numedges_;

};


#endif //CONVERSIONGRAPH_H
Index: converter.C
===
RCS file: /cvs/lyx/lyx-devel/src/converter.C,v
retrieving revision 1.64
diff -u -r1.64 converter.C
--- converter.C	2003/02/14 14:49:48	1.64
+++ converter.C	2003/02/27 10:15:11
@@ -1,16 +1,17 @@
-/* This file is part of
- * ==
+/**
+ * \file converter.C
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
  *
- *   LyX, The Document Processor
- *
- *   Copyright 1995 Matthias Ettrich
- *   Copyright 1995-2001 The LyX Team.
- *
- * == */
+ * \author Dekel Tsur
+*/
 
 #include config.h
 
 #include converter.h
+#include graph.h
+#include format.h
 #include lyxrc.h
 #include buffer.h
 #include bufferview_funcs.h
@@ -50,8 +51,8 @@
 string const token_base($$b);
 string const token_to($$o);
 string const token_path($$p);
+
 
-//
 
 inline
 string const add_options(string const  command, string const  options)
@@ -63,189 +64,8 @@
 
 } // namespace anon
 
-//
-
-bool Format::dummy() const
-{
-	return extension().empty();
-}
-
-
-bool Format::isChildFormat() const
-{
-	if (name_.empty())
-		return false;
-	return isdigit(name_[name_.length() - 1]);
-}
-
-
-string const Format::parentFormat() const
-{
-	return name_.substr(0, name_.length() - 1);
-}
-
-//
-
-// This method should return a reference, and throw an exception
-// if the format named name cannot be found (Lgb)
-Format const * Formats::getFormat(string const  name) const
-{
-	FormatList::const_iterator cit =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(Format::name, name));
-	if (cit != formatlist.end())
-		return (*cit);
-	else
-		return 0;
-}
-
 
-int Formats::getNumber(string const  name) const
-{
-	FormatList::const_iterator cit =
-		find_if(formatlist.begin(), formatlist.end(),
-			lyx::compare_memfun(Format::name, name));
-	if (cit != formatlist.end())
-		return cit - formatlist.begin();
-	else
-		return -1;
-}
-
-
-void Formats::add(string const  name)
-{
-	if (!getFormat(name))
-		add(name, name, name, string());
-}
-
-
-// FIXME: horrednously mis-named

Re: converter.C

2003-02-27 Thread Angus Leeming
Alfredo Braunstein wrote:

 So here it is. Please comment.
Loks good. Here's some comments ;-)
Angus


 * Copyright 2002 the LyX Team

There is no such formal entity. Please use 

/**
 * \file format.C
 * This file is part of LyX, the document processor.
 * Licence details can be found in the file COPYING.
 *
 * \author Dekel Tsur
 *
 * Full author contact details are available in file CREDITS
 */


// FIXME: horrednously mis-named, especially given the other ::add
// function
void Formats::add(string const  name, string const  extension,
  string const  prettyname, string const  shortcut)

So fix it ;-)


//does this belong here??
string const Formats::papersize(Buffer const * buffer) const

It doesn't 'feel' right does it. Why not make it a stand-alone function?


#ifndef FORMAT_H
#include string
#include vector

using std::string;
using std::vector;
using std::endl;

Use LString.h rather than string. Do NOT pollute header files with using 
std::xyz. Why do you need endl anyway?



inline
bool operator(Format const  a, Format const  b)

Why is it inline? Have you profiled this code? Take it out of line.




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Angus Leeming wrote:

 Alfredo Braunstein wrote:
 
 So here it is. Please comment.
 Loks good. Here's some comments ;-)
 Angus
 
 
  * Copyright 2002 the LyX Team
 
 There is no such formal entity. Please use

Ok, I though I had to leave it because it was there on the original file.

 // FIXME: horrednously mis-named, especially given the other ::add
 // function
 void Formats::add(string const  name, string const  extension,
   string const  prettyname, string const  shortcut)
 
 So fix it ;-)

I'll try to. The comment was in the original file.

 //does this belong here??
 string const Formats::papersize(Buffer const * buffer) const
 
 It doesn't 'feel' right does it. Why not make it a stand-alone function?

This one is mine. Ok.

 Use LString.h rather than string. Do NOT pollute header files with
 using std::xyz. Why do you need endl anyway?

Some debugging code that's gone maybe. You are right.


 inline
 bool operator(Format const  a, Format const  b)
 
 Why is it inline? Have you profiled this code? Take it out of line.

Not my doing, but I will.

I will submit a corrected version.

Thanks Angus, 
Alfredo. 





Re: converter.C

2003-02-27 Thread Andre Poenitz
On Thu, Feb 27, 2003 at 11:35:16AM +0100, Alfredo Braunstein wrote:
  Why is it inline? Have you profiled this code? Take it out of line.
 
 Not my doing, but I will.

You do not have to profile this part.

Angus just meant Unless you have verified that there is a bottleneck
by profiling the code, take it out of line.

As there is no suspicion that there is a bottleneck, simple do not profile
the code, but move the code out of line...

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Andre Poenitz wrote:

 On Thu, Feb 27, 2003 at 11:35:16AM +0100, Alfredo Braunstein wrote:
  Why is it inline? Have you profiled this code? Take it out of line.
 
 Not my doing, but I will.
 
 You do not have to profile this part.
 
 Angus just meant Unless you have verified that there is a bottleneck
 by profiling the code, take it out of line.
 
 As there is no suspicion that there is a bottleneck, simple do not profile
 the code, but move the code out of line...
 
 Andre'
 

:)

I will refered to: take it out of line, not to have you profiled...
The code is not mine, I haven't added the inline keyword. I perfectly agree
with the principle of avoiding premature optimization...

Alfredo




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Angus Leeming wrote:

 //does this belong here??
 string const Formats::papersize(Buffer const * buffer) const
 
 It doesn't 'feel' right does it. Why not make it a stand-alone function?

It is accessed also from converter.C (it was before a member of Converters,
don't ask me why. I've passed it to Formats to be able to make the split).
Should we put it on some special namespace?
Note that we can also delay the decision, it's not worse than before.

Thanks, Alfredo




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
The corrected version.

I've added converter.[Ch] here so you can look at it without applying the
patch, but they are already contained on patch.diff.

Alfredo
/**
 * \file converter.C
 * This file is part of LyX, the document processor.
 * Licence details can be found in the file COPYING.
 *
 * \author Dekel Tsur
 *
 * Full author contact details are available in file CREDITS
 */

#include config.h

#include converter.h
#include graph.h
#include format.h
#include lyxrc.h
#include buffer.h
#include bufferview_funcs.h
#include LaTeX.h
#include lyx_cb.h // ShowMessage()
#include gettext.h
#include BufferView.h
#include debug.h

#include frontends/Alert.h
#include frontends/LyXView.h

#include support/filetools.h
#include support/lyxfunctional.h
#include support/path.h
#include support/systemcall.h

#include BoostFormat.h

#include cctype

#ifndef CXX_GLOBAL_CSTD
using std::isdigit;
#endif

using std::vector;
using std::endl;
using std::find_if;

namespace {

string const token_from($$i);
string const token_base($$b);
string const token_to($$o);
string const token_path($$p);



string const add_options(string const  command, string const  options)
{
	string head;
	string const tail = split(command, head, ' ');
	return head + ' ' + options + ' ' + tail;
}

} // namespace anon



void Converter::readFlags()
{
	string flag_list(flags);
	while (!flag_list.empty()) {
		string flag_name, flag_value;
		flag_list = split(flag_list, flag_value, ',');
		flag_value = split(flag_value, flag_name, '=');
		if (flag_name == latex)
			latex = true;
		else if (flag_name == originaldir)
			original_dir = true;
		else if (flag_name == needaux)
			need_aux = true;
		else if (flag_name == resultdir)
			result_dir = (flag_value.empty())
? token_base : flag_value;
		else if (flag_name == resultfile)
			result_file = flag_value;
		else if (flag_name == parselog)
			parselog = flag_value;
	}
	if (!result_dir.empty()  result_file.empty())
		result_file = index. + formats.extension(to);
	//if (!contains(command, token_from))
	//	latex = true;
}


bool operator(Converter const  a, Converter const  b)
{
	// use the compare_ascii_no_case instead of compare_no_case,
	// because in turkish, 'i' is not the lowercase version of 'I',
	// and thus turkish locale breaks parsing of tags.
	int const i = compare_ascii_no_case(a.From-prettyname(),
	b.From-prettyname());
	if (i == 0)
		return compare_ascii_no_case(a.To-prettyname(), b.To-prettyname())
			 0;
	else
		return i  0;
}



class compare_Converter {
public:
	compare_Converter(string const  f, string const  t)
		: from(f), to(t) {}
	bool operator()(Converter const  c) {
		return c.from == from  c.to == to;
	}
private:
	string const  from;
	string const  to;
};



Converter const * Converters::getConverter(string const  from,
	string const  to)
{
	ConverterList::const_iterator cit =
		find_if(converterlist_.begin(), converterlist_.end(),
			compare_Converter(from, to));
	if (cit != converterlist_.end())
		return (*cit);
	else
		return 0;
}


int Converters::getNumber(string const  from, string const  to)
{
	ConverterList::const_iterator cit =
		find_if(converterlist_.begin(), converterlist_.end(),
			compare_Converter(from, to));
	if (cit != converterlist_.end())
		return cit - converterlist_.begin();
	else
		return -1;
}


void Converters::add(string const  from, string const  to,
		 string const  command, string const  flags)
{
	formats.add(from);
	formats.add(to);
	ConverterList::iterator it = find_if(converterlist_.begin(),
	 converterlist_.end(),
	 compare_Converter(from, to));

	Converter converter(from, to, command, flags);
	if (it != converterlist_.end()  !flags.empty()  flags[0] == '*') {
		converter = *it;
		converter.command = command;
		converter.flags = flags;
	}
	converter.readFlags();

	if (converter.latex  (latex_command_.empty() || to == dvi))
		latex_command_ = subst(command, token_from, );
	// If we have both latex  pdflatex, we set latex_command to latex.
	// The latex_command is used to update the .aux file when running
	// a converter that uses it.

	if (it == converterlist_.end()) {
		converterlist_.push_back(converter);
	} else {
		converter.From = it-From;
		converter.To = it-To;
		*it = converter;
	}
}


void Converters::erase(string const  from, string const  to)
{
	ConverterList::iterator it = find_if(converterlist_.begin(),
	 converterlist_.end(),
	 compare_Converter(from, to));
	if (it != converterlist_.end())
		converterlist_.erase(it);
}


// This method updates the pointers From and To in all the converters.
// The code is not very efficient, but it doesn't matter as the number
// of formats and converters is small.
// Furthermore, this method is called only on startup, or after
// adding/deleting a format in FormPreferences (the latter calls can be
// eliminated if the formats in the Formats class are stored using a map or
// a list (instead of a vector), but this will cause other problems).
void

Re: converter.C

2003-02-27 Thread Angus Leeming
Alfredo Braunstein wrote:

Why is the Converter c-tor inline? Do you need to #include format.h in 
converter.h? Can you not forward declare class Format?

I would take papersize out of class Format, but still have its 
definition/declaration in format.[Ch].

Looks good. Would you like it applied as-is?
-- 
Angus



Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Angus Leeming wrote:

 Alfredo Braunstein wrote:
 
 Why is the Converter c-tor inline? Do you need to #include format.h in
 converter.h? Can you not forward declare class Format?
 
 I would take papersize out of class Format, but still have its
 definition/declaration in format.[Ch].
 
 Looks good. Would you like it applied as-is?

No, let me make these changes first. 

Thanks,
Alfredo 




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
 only_viewable,
		bool clear_visited)
{
	vectorint result;
	if (bfs_init(from, clear_visited)  0)
		return result;

	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		Format const  format = formats.get(i);
		if (format.name() == lyx)
			continue;
		if (!only_viewable || !format.viewer().empty() ||
		format.isChildFormat())
			result.push_back(i);

		vectorint::const_iterator cit =
			vertices_[i].out_vertices.begin();
		vectorint::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit)
			if (!visited_[*cit]) {
visited_[*cit] = true;
Q_.push(*cit);
			}
	}

	return result;
}


bool Graph::isReachable(int from, int to)
{
	if (from == to)
		return true;

	int const s = bfs_init(from);
	if (s  0 || to  0)
		return false;

	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		if (i == to)
			return true;

		vectorint::const_iterator cit =
			vertices_[i].out_vertices.begin();
		vectorint::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit) {
			if (!visited_[*cit]) {
visited_[*cit] = true;
Q_.push(*cit);
			}
		}
	}

	return false;
}


Graph::EdgePath const
Graph::getPath(int from, int t)
{
	EdgePath path;
	if (from == t)
		return path;

	int const s = bfs_init(from);
	if (s  0 || t  0)
		return path;

	vectorint prev_edge(formats.size());
	vectorint prev_vertex(formats.size());

	bool found = false;
	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		if (i == t) {
			found = true;
			break;
		}

		vectorint::const_iterator beg =
			vertices_[i].out_vertices.begin();
		vectorint::const_iterator cit = beg;
		vectorint::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit)
			if (!visited_[*cit]) {
int const j = *cit;
visited_[j] = true;
Q_.push(j);
int const k = cit - beg;
prev_edge[j] = vertices_[i].out_edges[k];
prev_vertex[j] = i;
			}
	}
	if (!found)
		return path;

	while (t != s) {
		path.push_back(prev_edge[t]);
		t = prev_vertex[t];
	}
	reverse(path.begin(), path.end());
	return path;
}

void Graph::init(int size)
{
	vertices_ = vectorVertex(size);
	visited_.resize(size);
	numedges_ = 0;
}

void Graph::addEdge(int s, int t)
{
	vertices_[t].in_vertices.push_back(s);
	vertices_[s].out_vertices.push_back(t);
	vertices_[s].out_edges.push_back(numedges_++);
}

vectorGraph::Vertex Graph::vertices_;


// -*- C++ -*-

#ifndef GRAPH_H
#define GRAPH_H

/**
 * \file graph.h
 * This file is part of LyX, the document processor.
 * Licence details can be found in the file COPYING.
 *
 * \author Dekel Tsur
 *
 * Full author contact details are available in file CREDITS
 */

#include format.h
#include LString.h

#include queue
#include vector

class Graph {
public: 
	Graph() : numedges_(0) {};
	///
	typedef std::vectorint EdgePath;
	///
	std::vectorint const
	getReachableTo(int, bool clear_visited);
	///
	std::vectorint const
	getReachable(int, bool only_viewable,
		 bool clear_visited);
	///
	bool isReachable(int, int);
	///
	EdgePath const getPath(int, int);
	///
	void addEdge(int s, int t);
	///
	void init(int size);

private:
	///
	int bfs_init(int, bool clear_visited = true);

	///
	struct Vertex {
		std::vectorint in_vertices;
		std::vectorint out_vertices;
		std::vectorint out_edges;
	};
	///
	static
	std::vectorVertex vertices_;
	///
	std::vectorbool visited_;
	///
	std::queueint Q_;

	int numedges_;

};


#endif //GRAPH_H
Index: converter.C
===
RCS file: /cvs/lyx/lyx-devel/src/converter.C,v
retrieving revision 1.64
diff -u -r1.64 converter.C
--- converter.C	2003/02/14 14:49:48	1.64
+++ converter.C	2003/02/27 12:57:39
@@ -1,16 +1,18 @@
-/* This file is part of
- * ==
+/**
+ * \file converter.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *   LyX, The Document Processor
+ * \author Dekel Tsur
  *
- *   Copyright 1995 Matthias Ettrich
- *   Copyright 1995-2001 The LyX Team.
- *
- * == */
+ * Full author contact details are available in file CREDITS
+ */
 
 #include config.h
 
 #include converter.h
+#include graph.h
+#include format.h
 #include lyxrc.h
 #include buffer.h
 #include bufferview_funcs.h
@@ -37,12 +39,8 @@
 #endif
 
 using std::vector;
-using std::queue;
 using std::endl;
-using std::fill;
 using std::find_if;
-using std::reverse;
-using std::sort;
 
 namespace {
 
@@ -50,10 +48,9 @@
 string const token_base($$b);
 string const token_to($$o);
 string const token_path($$p);
+
 
-//
 
-inline
 string const add_options(string const  command, string const  options)
 {
 	string head;
@@ -63,189 +60,13 @@
 
 } // namespace anon

Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Alfredo Braunstein wrote:

 Actually, this will force #including format.h in outside code which use
 the formats object, because the extern declaration of the global object
 formats is in it.
 I would leave this one as is for now, if it's ok with you. (I promess to
 do it soon)
 

I have already maked the change, touching ~25 files. Would you like me to
rediff and resend the whole thing or should I diff it once the first one is
applied? I would like better the second option, as it is more in 'baby
steps'.

Regards, Alfredo




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Alfredo Braunstein wrote:

 Attached is the result.
 
 Thanks,
 Alfredo

Do I have to wait until tuesday or there is another caritative soul that can
apply it?

Thanks, Alfredo




Re: converter.C

2003-02-27 Thread Andre Poenitz
On Fri, Feb 28, 2003 at 08:40:09AM +0100, Alfredo Braunstein wrote:
 Do I have to wait until tuesday or there is another caritative soul that can
 apply it?

Send me the patch again.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


converter.C

2003-02-27 Thread Alfredo Braunstein
I finally managed to work on converter.C.

I've done the first split (converter.[Ch] -> converter.[Ch] + format.[Ch]
+graph.[Ch]), with no change in interface nor in functionality.

The graph work is done in the class Graph, who knows _almost_ nothing about
converters nor formats (work with integers). The almost is because there's
still a harcoded 'target == lyx'. This will go away soon, once I rework
graph a little.

As expected, converter.C includes {format,graph}.h but format.C is
standalone. (and graph.h will become so soon). I expect also to find many
source files where converter.h was included but only formats is used. 

Before I post it, who is the author of converter.C? It's missing from the
headers.




Re: converter.C

2003-02-27 Thread Angus Leeming
Alfredo Braunstein wrote:

> I finally managed to work on converter.C.
> 
> I've done the first split (converter.[Ch] -> converter.[Ch] + format.[Ch]
> +graph.[Ch]), with no change in interface nor in functionality.
> 
> The graph work is done in the class Graph, who knows _almost_ nothing
> about converters nor formats (work with integers). The almost is because
> there's still a harcoded 'target == lyx'. This will go away soon, once I
> rework graph a little.
> 
> As expected, converter.C includes {format,graph}.h but format.C is
> standalone. (and graph.h will become so soon). I expect also to find many
> source files where converter.h was included but only formats is used.
> 
> Before I post it, who is the author of converter.C? It's missing from the
> headers.

Dekel.

-- 
Angus



Re: converter.C

2003-02-27 Thread Alfredo Braunstein
	Format const & format = formats.get(i);
		if (format.name() == "lyx")
			continue;
		if (!only_viewable || !format.viewer().empty() ||
		format.isChildFormat())
			result.push_back(i);

		vector::const_iterator cit =
			vertices_[i].out_vertices.begin();
		vector::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit)
			if (!visited_[*cit]) {
visited_[*cit] = true;
Q_.push(*cit);
			}
	}

	return result;
}


bool Graph::isReachable(int from, int to)
{
	if (from == to)
		return true;

	int const s = bfs_init(from);
	if (s < 0 || to < 0)
		return false;

	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		if (i == to)
			return true;

		vector::const_iterator cit =
			vertices_[i].out_vertices.begin();
		vector::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit) {
			if (!visited_[*cit]) {
visited_[*cit] = true;
Q_.push(*cit);
			}
		}
	}

	return false;
}


Graph::EdgePath const
Graph::getPath(int from, int t)
{
	EdgePath path;
	if (from == t)
		return path;

	int const s = bfs_init(from);
	if (s < 0 || t < 0)
		return path;

	vector prev_edge(formats.size());
	vector prev_vertex(formats.size());

	bool found = false;
	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		if (i == t) {
			found = true;
			break;
		}

		vector::const_iterator beg =
			vertices_[i].out_vertices.begin();
		vector::const_iterator cit = beg;
		vector::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit)
			if (!visited_[*cit]) {
int const j = *cit;
visited_[j] = true;
Q_.push(j);
int const k = cit - beg;
prev_edge[j] = vertices_[i].out_edges[k];
prev_vertex[j] = i;
			}
	}
	if (!found)
		return path;

	while (t != s) {
		path.push_back(prev_edge[t]);
		t = prev_vertex[t];
	}
	reverse(path.begin(), path.end());
	return path;
}

void Graph::init(int size)
{
	vertices_ = vector(size);
	visited_.resize(size);
	numedges_ = 0;
}

void Graph::addEdge(int s, int t)
{
	vertices_[t].in_vertices.push_back(s);
	vertices_[s].out_vertices.push_back(t);
	vertices_[s].out_edges.push_back(numedges_++);
}

vector Graph::vertices_;


// -*- C++ -*-
/**
 * \file graph.h
 * Copyright 1995 Matthias Ettrich
 * Copyright 2002 the LyX Team
 * Read the file COPYING
 *
 * \author Dekel Tsur
*/

#ifndef CONVERSIONGRAPH_H
#define CONVERSIONGRAPH_H

#include "format.h"

#include 
#include 
#include 

using std::queue;
using std::vector;
using std::string;


class Graph {
public: 
	Graph() : numedges_(0) {};
	///
	typedef std::vector EdgePath;
	///
	std::vector const
	getReachableTo(int, bool clear_visited);
	///
	std::vector const
	getReachable(int, bool only_viewable,
		 bool clear_visited);
	///
	bool isReachable(int, int);
	///
	EdgePath const getPath(int, int);
	///
	void addEdge(int s, int t);
	///
	void init(int size);

private:
	///
	int bfs_init(int, bool clear_visited = true);

	///
	struct Vertex {
		std::vector in_vertices;
		std::vector out_vertices;
		std::vector out_edges;
	};
	///
	static
	std::vector vertices_;
	///
	std::vector visited_;
	///
	std::queue Q_;

	int numedges_;

};


#endif //CONVERSIONGRAPH_H
Index: converter.C
===
RCS file: /cvs/lyx/lyx-devel/src/converter.C,v
retrieving revision 1.64
diff -u -r1.64 converter.C
--- converter.C	2003/02/14 14:49:48	1.64
+++ converter.C	2003/02/27 10:15:11
@@ -1,16 +1,17 @@
-/* This file is part of
- * ==
+/**
+ * \file converter.C
+ * Copyright 1995 Matthias Ettrich
+ * Copyright 2002 the LyX Team
+ * Read the file COPYING
  *
- *   LyX, The Document Processor
- *
- *   Copyright 1995 Matthias Ettrich
- *   Copyright 1995-2001 The LyX Team.
- *
- * == */
+ * \author Dekel Tsur
+*/
 
 #include 
 
 #include "converter.h"
+#include "graph.h"
+#include "format.h"
 #include "lyxrc.h"
 #include "buffer.h"
 #include "bufferview_funcs.h"
@@ -50,8 +51,8 @@
 string const token_base("$$b");
 string const token_to("$$o");
 string const token_path("$$p");
+
 
-//
 
 inline
 string const add_options(string const & command, string const & options)
@@ -63,189 +64,8 @@
 
 } // namespace anon
 
-//
-
-bool Format::dummy() const
-{
-	return extension().empty();
-}
-
-
-bool Format::isChildFormat() const
-{
-	if (name_.empty())
-		return false;
-	return isdigit(name_[name_.length() - 1]);
-}
-
-
-string const Format::parentFormat() const
-{
-	return name_.substr(0, name_.length() - 1);
-}
-
-//
-
-//

Re: converter.C

2003-02-27 Thread Angus Leeming
Alfredo Braunstein wrote:

> So here it is. Please comment.
Loks good. Here's some comments ;-)
Angus


 * Copyright 2002 the LyX Team

There is no such formal entity. Please use 

/**
 * \file format.C
 * This file is part of LyX, the document processor.
 * Licence details can be found in the file COPYING.
 *
 * \author Dekel Tsur
 *
 * Full author contact details are available in file CREDITS
 */


// FIXME: horrednously mis-named, especially given the other ::add
// function
void Formats::add(string const & name, string const & extension,
  string const & prettyname, string const & shortcut)

So fix it ;-)


//does this belong here??
string const Formats::papersize(Buffer const * buffer) const

It doesn't 'feel' right does it. Why not make it a stand-alone function?


#ifndef FORMAT_H
#include 
#include 

using std::string;
using std::vector;
using std::endl;

Use "LString.h" rather than . Do NOT pollute header files with using 
std::xyz. Why do you need endl anyway?



inline
bool operator<(Format const & a, Format const & b)

Why is it inline? Have you profiled this code? Take it out of line.




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Angus Leeming wrote:

> Alfredo Braunstein wrote:
> 
>> So here it is. Please comment.
> Loks good. Here's some comments ;-)
> Angus
> 
> 
>  * Copyright 2002 the LyX Team
> 
> There is no such formal entity. Please use

Ok, I though I had to leave it because it was there on the original file.

> // FIXME: horrednously mis-named, especially given the other ::add
> // function
> void Formats::add(string const & name, string const & extension,
>   string const & prettyname, string const & shortcut)
> 
> So fix it ;-)

I'll try to. The comment was in the original file.

> //does this belong here??
> string const Formats::papersize(Buffer const * buffer) const
> 
> It doesn't 'feel' right does it. Why not make it a stand-alone function?

This one is mine. Ok.

> Use "LString.h" rather than . Do NOT pollute header files with
> using std::xyz. Why do you need endl anyway?

Some debugging code that's gone maybe. You are right.


> inline
> bool operator<(Format const & a, Format const & b)
> 
> Why is it inline? Have you profiled this code? Take it out of line.

Not my doing, but I will.

I will submit a corrected version.

Thanks Angus, 
Alfredo. 





Re: converter.C

2003-02-27 Thread Andre Poenitz
On Thu, Feb 27, 2003 at 11:35:16AM +0100, Alfredo Braunstein wrote:
> > Why is it inline? Have you profiled this code? Take it out of line.
> 
> Not my doing, but I will.

You do not have to profile this part.

Angus just meant "Unless you have verified that there is a bottleneck
by profiling the code, take it out of line".

As there is no suspicion that there is a bottleneck, simple do not profile
the code, but move the code out of line...

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Andre Poenitz wrote:

> On Thu, Feb 27, 2003 at 11:35:16AM +0100, Alfredo Braunstein wrote:
>> > Why is it inline? Have you profiled this code? Take it out of line.
>> 
>> Not my doing, but I will.
> 
> You do not have to profile this part.
> 
> Angus just meant "Unless you have verified that there is a bottleneck
> by profiling the code, take it out of line".
> 
> As there is no suspicion that there is a bottleneck, simple do not profile
> the code, but move the code out of line...
> 
> Andre'
> 

:)

"I will" refered to: "take it out of line", not to "have you profiled..."
The code is not mine, I haven't added the inline keyword. I perfectly agree
with the principle of avoiding premature optimization...

Alfredo




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Angus Leeming wrote:

> //does this belong here??
> string const Formats::papersize(Buffer const * buffer) const
> 
> It doesn't 'feel' right does it. Why not make it a stand-alone function?

It is accessed also from converter.C (it was before a member of Converters,
don't ask me why. I've passed it to Formats to be able to make the split).
Should we put it on some special namespace?
Note that we can also delay the decision, it's not worse than before.

Thanks, Alfredo




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
The corrected version.

I've added converter.[Ch] here so you can look at it without applying the
patch, but they are already contained on patch.diff.

Alfredo
/**
 * \file converter.C
 * This file is part of LyX, the document processor.
 * Licence details can be found in the file COPYING.
 *
 * \author Dekel Tsur
 *
 * Full author contact details are available in file CREDITS
 */

#include 

#include "converter.h"
#include "graph.h"
#include "format.h"
#include "lyxrc.h"
#include "buffer.h"
#include "bufferview_funcs.h"
#include "LaTeX.h"
#include "lyx_cb.h" // ShowMessage()
#include "gettext.h"
#include "BufferView.h"
#include "debug.h"

#include "frontends/Alert.h"
#include "frontends/LyXView.h"

#include "support/filetools.h"
#include "support/lyxfunctional.h"
#include "support/path.h"
#include "support/systemcall.h"

#include "BoostFormat.h"

#include 

#ifndef CXX_GLOBAL_CSTD
using std::isdigit;
#endif

using std::vector;
using std::endl;
using std::find_if;

namespace {

string const token_from("$$i");
string const token_base("$$b");
string const token_to("$$o");
string const token_path("$$p");



string const add_options(string const & command, string const & options)
{
	string head;
	string const tail = split(command, head, ' ');
	return head + ' ' + options + ' ' + tail;
}

} // namespace anon



void Converter::readFlags()
{
	string flag_list(flags);
	while (!flag_list.empty()) {
		string flag_name, flag_value;
		flag_list = split(flag_list, flag_value, ',');
		flag_value = split(flag_value, flag_name, '=');
		if (flag_name == "latex")
			latex = true;
		else if (flag_name == "originaldir")
			original_dir = true;
		else if (flag_name == "needaux")
			need_aux = true;
		else if (flag_name == "resultdir")
			result_dir = (flag_value.empty())
? token_base : flag_value;
		else if (flag_name == "resultfile")
			result_file = flag_value;
		else if (flag_name == "parselog")
			parselog = flag_value;
	}
	if (!result_dir.empty() && result_file.empty())
		result_file = "index." + formats.extension(to);
	//if (!contains(command, token_from))
	//	latex = true;
}


bool operator<(Converter const & a, Converter const & b)
{
	// use the compare_ascii_no_case instead of compare_no_case,
	// because in turkish, 'i' is not the lowercase version of 'I',
	// and thus turkish locale breaks parsing of tags.
	int const i = compare_ascii_no_case(a.From->prettyname(),
	b.From->prettyname());
	if (i == 0)
		return compare_ascii_no_case(a.To->prettyname(), b.To->prettyname())
			< 0;
	else
		return i < 0;
}



class compare_Converter {
public:
	compare_Converter(string const & f, string const & t)
		: from(f), to(t) {}
	bool operator()(Converter const & c) {
		return c.from == from && c.to == to;
	}
private:
	string const & from;
	string const & to;
};



Converter const * Converters::getConverter(string const & from,
	string const & to)
{
	ConverterList::const_iterator cit =
		find_if(converterlist_.begin(), converterlist_.end(),
			compare_Converter(from, to));
	if (cit != converterlist_.end())
		return &(*cit);
	else
		return 0;
}


int Converters::getNumber(string const & from, string const & to)
{
	ConverterList::const_iterator cit =
		find_if(converterlist_.begin(), converterlist_.end(),
			compare_Converter(from, to));
	if (cit != converterlist_.end())
		return cit - converterlist_.begin();
	else
		return -1;
}


void Converters::add(string const & from, string const & to,
		 string const & command, string const & flags)
{
	formats.add(from);
	formats.add(to);
	ConverterList::iterator it = find_if(converterlist_.begin(),
	 converterlist_.end(),
	 compare_Converter(from, to));

	Converter converter(from, to, command, flags);
	if (it != converterlist_.end() && !flags.empty() && flags[0] == '*') {
		converter = *it;
		converter.command = command;
		converter.flags = flags;
	}
	converter.readFlags();

	if (converter.latex && (latex_command_.empty() || to == "dvi"))
		latex_command_ = subst(command, token_from, "");
	// If we have both latex & pdflatex, we set latex_command to latex.
	// The latex_command is used to update the .aux file when running
	// a converter that uses it.

	if (it == converterlist_.end()) {
		converterlist_.push_back(converter);
	} else {
		converter.From = it->From;
		converter.To = it->To;
		*it = converter;
	}
}


void Converters::erase(string const & from, string const & to)
{
	ConverterList::iterator it = find_if(converterlist_.begin(),
	 converterlist_.end(),
	 compare_Converter

Re: converter.C

2003-02-27 Thread Angus Leeming
Alfredo Braunstein wrote:

Why is the Converter c-tor inline? Do you need to #include "format.h" in 
converter.h? Can you not forward declare class Format?

I would take papersize out of class Format, but still have its 
definition/declaration in format.[Ch].

Looks good. Would you like it applied as-is?
-- 
Angus



Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Angus Leeming wrote:

> Alfredo Braunstein wrote:
> 
> Why is the Converter c-tor inline? Do you need to #include "format.h" in
> converter.h? Can you not forward declare class Format?
> 
> I would take papersize out of class Format, but still have its
> definition/declaration in format.[Ch].
> 
> Looks good. Would you like it applied as-is?

No, let me make these changes first. 

Thanks,
Alfredo 




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
 


int Graph::bfs_init(int s, bool clear_visited)
{
	if (s < 0)
		return s;

	Q_ = std::queue();

	if (clear_visited)
		fill(visited_.begin(), visited_.end(), false);
	if (visited_[s] == false) {
		Q_.push(s);
		visited_[s] = true;
	}
	return s;
}


vector const
Graph::getReachableTo(int target, bool clear_visited)
{
	vector result;
	int const s = bfs_init(target, clear_visited);
	if (s < 0)
		return result;

	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		if (i != s || formats.get(target).name() != "lyx") {
			result.push_back(i);
		}

		vector::iterator it = vertices_[i].in_vertices.begin();
		vector::iterator end = vertices_[i].in_vertices.end();
		for (; it != end; ++it) {
			if (!visited_[*it]) {
visited_[*it] = true;
Q_.push(*it);
			}
		}
	}

	return result;
}


vector const
Graph::getReachable(int from, bool only_viewable,
		bool clear_visited)
{
	vector result;
	if (bfs_init(from, clear_visited) < 0)
		return result;

	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		Format const & format = formats.get(i);
		if (format.name() == "lyx")
			continue;
		if (!only_viewable || !format.viewer().empty() ||
		format.isChildFormat())
			result.push_back(i);

		vector::const_iterator cit =
			vertices_[i].out_vertices.begin();
		vector::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit)
			if (!visited_[*cit]) {
visited_[*cit] = true;
Q_.push(*cit);
			}
	}

	return result;
}


bool Graph::isReachable(int from, int to)
{
	if (from == to)
		return true;

	int const s = bfs_init(from);
	if (s < 0 || to < 0)
		return false;

	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		if (i == to)
			return true;

		vector::const_iterator cit =
			vertices_[i].out_vertices.begin();
		vector::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit) {
			if (!visited_[*cit]) {
visited_[*cit] = true;
Q_.push(*cit);
			}
		}
	}

	return false;
}


Graph::EdgePath const
Graph::getPath(int from, int t)
{
	EdgePath path;
	if (from == t)
		return path;

	int const s = bfs_init(from);
	if (s < 0 || t < 0)
		return path;

	vector prev_edge(formats.size());
	vector prev_vertex(formats.size());

	bool found = false;
	while (!Q_.empty()) {
		int const i = Q_.front();
		Q_.pop();
		if (i == t) {
			found = true;
			break;
		}

		vector::const_iterator beg =
			vertices_[i].out_vertices.begin();
		vector::const_iterator cit = beg;
		vector::const_iterator end =
			vertices_[i].out_vertices.end();
		for (; cit != end; ++cit)
			if (!visited_[*cit]) {
int const j = *cit;
visited_[j] = true;
Q_.push(j);
int const k = cit - beg;
prev_edge[j] = vertices_[i].out_edges[k];
prev_vertex[j] = i;
			}
	}
	if (!found)
		return path;

	while (t != s) {
		path.push_back(prev_edge[t]);
		t = prev_vertex[t];
	}
	reverse(path.begin(), path.end());
	return path;
}

void Graph::init(int size)
{
	vertices_ = vector(size);
	visited_.resize(size);
	numedges_ = 0;
}

void Graph::addEdge(int s, int t)
{
	vertices_[t].in_vertices.push_back(s);
	vertices_[s].out_vertices.push_back(t);
	vertices_[s].out_edges.push_back(numedges_++);
}

vector Graph::vertices_;


// -*- C++ -*-

#ifndef GRAPH_H
#define GRAPH_H

/**
 * \file graph.h
 * This file is part of LyX, the document processor.
 * Licence details can be found in the file COPYING.
 *
 * \author Dekel Tsur
 *
 * Full author contact details are available in file CREDITS
 */

#include "format.h"
#include "LString.h"

#include 
#include 

class Graph {
public: 
	Graph() : numedges_(0) {};
	///
	typedef std::vector EdgePath;
	///
	std::vector const
	getReachableTo(int, bool clear_visited);
	///
	std::vector const
	getReachable(int, bool only_viewable,
		 bool clear_visited);
	///
	bool isReachable(int, int);
	///
	EdgePath const getPath(int, int);
	///
	void addEdge(int s, int t);
	///
	void init(int size);

private:
	///
	int bfs_init(int, bool clear_visited = true);

	///
	struct Vertex {
		std::vector in_vertices;
		std::vector out_vertices;
		std::vector out_edges;
	};
	///
	static
	std::vector vertices_;
	///
	std::vector visited_;
	///
	std::queue Q_;

	int numedges_;

};


#endif //GRAPH_H
Index: converter.C
===
RCS file: /cvs/lyx/lyx-devel/src/converter.C,v
retrieving revision 1.64
diff -u -r1.64 converter.C
--- converter.C	2003/02/14 14:49:48	1.64
+++ converter.C	2003/02/27 12:57:39
@@ -1,16 +1,18 @@
-/* This file is part of
- * ==
+/**
+ * \file converter.C
+ * This file is part of LyX, the document processor.
+ * Licence details can be found in the file COPYING.
  *
- *   LyX, The Document Processor
+ * \author Dekel Tsur
  *
- *   Copyright 1995 Matthias Ettrich
- *   Copyright 1995-2001 The LyX Team.
- *
-

Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Alfredo Braunstein wrote:

> Actually, this will force #including "format.h" in outside code which use
> the formats object, because the extern declaration of the global object
> formats is in it.
> I would leave this one as is for now, if it's ok with you. (I promess to
> do it soon)
> 

I have already maked the change, touching ~25 files. Would you like me to
rediff and resend the whole thing or should I diff it once the first one is
applied? I would like better the second option, as it is more in 'baby
steps'.

Regards, Alfredo




Re: converter.C

2003-02-27 Thread Alfredo Braunstein
Alfredo Braunstein wrote:

> Attached is the result.
> 
> Thanks,
> Alfredo

Do I have to wait until tuesday or there is another caritative soul that can
apply it?

Thanks, Alfredo




Re: converter.C

2003-02-27 Thread Andre Poenitz
On Fri, Feb 28, 2003 at 08:40:09AM +0100, Alfredo Braunstein wrote:
> Do I have to wait until tuesday or there is another caritative soul that can
> apply it?

Send me the patch again.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


converter.C

2003-02-26 Thread Alfredo Braunstein
If there are no a priori objections, I'd like to work a little on
converter.C to:

* clean a little the interface. Right there is ugly code like this in
importer.C:

vectorFormat const * result =
converters.getReachableTo(loaders[0], true);
for (vectorstring::const_iterator it = loaders.begin() + 1;
 it != loaders.end(); ++it) {
vectorFormat const * r =
converters.getReachableTo(*it, false);
result.insert(result.end(), r.begin(), r.end());
}

where getReachableTo is defined as 

  Converters::getReachableTo(string const  target, bool clear_visited).

This clear_visited is clearly part of the implementation.

So in principle we can have a getReachableTo(vectorstring const  loaders)
or something.

The same situation when one wants to get a conversion to any displayable
format, etc.

* clean a little the implementation, separating the 'graph' part from the
conversion part.

* add weights (slowness and accurateness) to converters and find the least
weighted path instead of the shortest, as suggested by JMarc. We can then
pass an optional flag (or even a real value between 0 and 1) to the
converter code asking for accurateness or for speed.

Is it ok? Advices?


Thanks, 
Alfredo




Re: converter.C

2003-02-26 Thread Andre Poenitz
On Wed, Feb 26, 2003 at 09:23:25AM +0100, Alfredo Braunstein wrote:
 * clean a little the implementation, separating the 'graph' part from the
 conversion part.
 
 * add weights (slowness and accurateness) to converters and find the least
 weighted path instead of the shortest, as suggested by JMarc. We can then
 pass an optional flag (or even a real value between 0 and 1) to the
 converter code asking for accurateness or for speed.
 
 Is it ok?

Definitely.

 Advices?

I think I have some code flying around that implement shortest path
searches. Interested?

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-26 Thread Alfredo Braunstein
Andre Poenitz wrote:

 I think I have some code flying around that implement shortest path
 searches. Interested?

Absolutely, but:

If you think it's ok, I would try to make the separation first without
changing the existing code. Once I have this working, we can think of
changing the graph code (we can even consider putting boost.graph if we
feel greedy).

Send it anyway if you have it at hand.

 
 Andre'
 

Thanks, Alfredo




Re: converter.C

2003-02-26 Thread Andre Poenitz
On Wed, Feb 26, 2003 at 09:45:06AM +0100, Alfredo Braunstein wrote:
 Andre Poenitz wrote:
 
  I think I have some code flying around that implement shortest path
  searches. Interested?
 
 Absolutely, but:
 
 If you think it's ok, I would try to make the separation first without
 changing the existing code.

Sure.

 Once I have this working, we can think of
 changing the graph code (we can even consider putting boost.graph if we
 feel greedy).

Nah. Overkill.

 Send it anyway if you have it at hand.

Just a snippet (ebert is my graph structure, the rest is hopefully
self-explanatory), array could be replaced by map, and node and edge
by int

typedef arraynode, edge pathset;

pathset shortest_paths(const ebert  G, node u, const weights  W)
{
const double infin = 1e30;
nodeset U; // seen nodes
U += u;

arraynode, edge   p(nbegin(G), nend(G), edge(0));  // previous edges
arraynode, double h(nbegin(G), nend(G), infin);// costs
h[u] = 0;

arraynode, double g;
foreach_incident_edge(e, u, G) {
node j = second_node(G, e);
h[j]   = W(e) + W(j);
p[j]   = e;
}

while (1) {
node v; // next unseen node with minimum weight
double minimum = infin;
foreach_node(w, G) {
if (U(w) || h(w)  minimum)
continue;
minimum = h(w);
v = w;
}

U   += v;
g[v] = h(v);

if (U.card() == node_count(G)) 
break;

// from now on plain Dijkstra
foreach_incident_edge(e, v, G) {
node j = second_node(G, e);
if (U(j))
continue;
double c = g(v) + W(e) + W(j);
if (c = h(j))
continue;
h[j] = c;
p[j] = e;
}   
}   
return p;
}

path shortest_path(const ebert  G, const dpair  q, const weights  cost)
{
return build_path(G, q, shortest_paths(G, q.first, cost));
}

path build_path(const ebert  G, const dpair  q, pathset prev)
{
path p;
if (!prev(q.second).id())
return p;
for (node w = q.second, t; w != q.first; w = t) {
t = opposite(G, prev(w), w);
p.push_back(prev(w), w, t);
}
p.reverse();
return p;
}


path shortest_path(const ebert  G, const dpair  p)
{
return shortest_path(G, p, default_weights(G));
}

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-26 Thread Andre Poenitz
On Wed, Feb 26, 2003 at 09:45:06AM +0100, Alfredo Braunstein wrote:
 If you think it's ok, I would try to make the separation first without
 changing the existing code.

That's fine of course.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-26 Thread Jean-Marc Lasgouttes
 Alfredo == Alfredo Braunstein [EMAIL PROTECTED] writes:

Alfredo If there are no a priori objections, I'd like to work a
Alfredo little on converter.C to:

Alfredo * clean a little the interface. Right there is ugly code like
Alfredo this in importer.C:

Good idea. Also, while you are at it, I think that the central part of
Converters::convert should be moved to a new Converter::convert
(without the 's'). Doing such things would help make the code more
understandable. 

JMarc



Re: converter.C

2003-02-26 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

 Good idea. Also, while you are at it, I think that the central part of
 Converters::convert should be moved to a new Converter::convert
 (without the 's'). Doing such things would help make the code more
 understandable.
 
 JMarc

Actually, what would be a good naming/file distribution?

In converter.C we have four classes:
class Format (a format item)
class Formats (the set of formats)
class Converter (a converter item)
class Converters (the set of converters)

I'm adding one more, the converter graph (if done properly, should not
contain references to conversion at all, but right now I'm in an
intermediate step)

Is it ok to split it into 3 files?/What would be a good namig for them? 

file 1: Format+Formats
file 2: Converter+Converters
file 3: graph for Converters

So, I need a proper naming for the four classes and 3 files.

* unrelated, but what's the use of the two global instances of
Converters/Formats? Can't we have only one of them (and make it a Singleton
class, my newest learning)?

Alfredo




Re: converter.C

2003-02-26 Thread Andre Poenitz
On Wed, Feb 26, 2003 at 11:28:17AM +0100, Alfredo Braunstein wrote:
 Is it ok to split it into 3 files?

I think so.

 What would be a good namig for them? 
 
 file 1: Format+Formats
 file 2: Converter+Converters
 file 3: graph for Converters

format.[Ch], converter.[Ch], graph.[Ch]

[_I_ am no fan of upper case characters in file names, so others might
prefer Format etc.]

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-26 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

 Good idea. Also, while you are at it, I think that the central part of
 Converters::convert should be moved to a new Converter::convert
 (without the 's'). Doing such things would help make the code more
 understandable.
 
 JMarc

Should I rename
Converter-ConverterItem
Converters-Converter
Format-FormatItem  
Formats-Format

?




Re: converter.C

2003-02-26 Thread Jean-Marc Lasgouttes
 Alfredo == Alfredo Braunstein [EMAIL PROTECTED] writes:

Alfredo Jean-Marc Lasgouttes wrote:
 Good idea. Also, while you are at it, I think that the central part
 of Converters::convert should be moved to a new Converter::convert
 (without the 's'). Doing such things would help make the code more
 understandable.
 
 JMarc

Alfredo Should I rename
Alfredo Converter- ConverterItem
Alfredo Converters- Converter
Alfredo Format- FormatItem
Alfredo Formats- Format

What would be the gain? It seems to be reasonable as it is now.

JMarc


Re: converter.C

2003-02-26 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

 Good idea. Also, while you are at it, I think that the central part
 of Converters::convert should be moved to a new Converter::convert
 (without the 's'). Doing such things would help make the code more
 understandable.
 
 JMarc
 
 Alfredo Should I rename
 Alfredo Converter- ConverterItem
 Alfredo Converters- Converter
 Alfredo Format- FormatItem
 Alfredo Formats- Format
 
 What would be the gain? It seems to be reasonable as it is now.
 
 JMarc

Also to me. I didn't understood what you were asking me, but now I think I
do.
Alfredo




Re: converter.C

2003-02-26 Thread Jean-Marc Lasgouttes
 Alfredo == Alfredo Braunstein [EMAIL PROTECTED] writes:

Alfredo Also to me. I didn't understood what you were asking me, but
Alfredo now I think I do. Alfredo

OK, to be clearer, I suspect that lines ~612-713 of converter.C should
be in the Converter class. But I may be wrong.

JMarc


converter.C

2003-02-26 Thread Alfredo Braunstein
If there are no a priori objections, I'd like to work a little on
converter.C to:

* clean a little the interface. Right there is ugly code like this in
importer.C:

vector result =
converters.getReachableTo(loaders[0], true);
for (vector::const_iterator it = loaders.begin() + 1;
 it != loaders.end(); ++it) {
vector r =
converters.getReachableTo(*it, false);
result.insert(result.end(), r.begin(), r.end());
}

where getReachableTo is defined as 

  Converters::getReachableTo(string const & target, bool clear_visited).

This clear_visited is clearly part of the implementation.

So in principle we can have a getReachableTo(vector const & loaders)
or something.

The same situation when one wants to get a conversion to any displayable
format, etc.

* clean a little the implementation, separating the 'graph' part from the
conversion part.

* add weights (slowness and accurateness) to converters and find the least
weighted path instead of the shortest, as suggested by JMarc. We can then
pass an optional flag (or even a real value between 0 and 1) to the
converter code asking for accurateness or for speed.

Is it ok? Advices?


Thanks, 
Alfredo




Re: converter.C

2003-02-26 Thread Andre Poenitz
On Wed, Feb 26, 2003 at 09:23:25AM +0100, Alfredo Braunstein wrote:
> * clean a little the implementation, separating the 'graph' part from the
> conversion part.
> 
> * add weights (slowness and accurateness) to converters and find the least
> weighted path instead of the shortest, as suggested by JMarc. We can then
> pass an optional flag (or even a real value between 0 and 1) to the
> converter code asking for accurateness or for speed.
> 
> Is it ok?

Definitely.

> Advices?

I think I have some code flying around that implement shortest path
searches. Interested?

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-26 Thread Alfredo Braunstein
Andre Poenitz wrote:

> I think I have some code flying around that implement shortest path
> searches. Interested?

Absolutely, but:

If you think it's ok, I would try to make the separation first without
changing the existing code. Once I have this working, we can think of
changing the graph code (we can even consider putting boost.graph if we
feel greedy).

Send it anyway if you have it at hand.

> 
> Andre'
> 

Thanks, Alfredo




Re: converter.C

2003-02-26 Thread Andre Poenitz
On Wed, Feb 26, 2003 at 09:45:06AM +0100, Alfredo Braunstein wrote:
> Andre Poenitz wrote:
> 
> > I think I have some code flying around that implement shortest path
> > searches. Interested?
> 
> Absolutely, but:
> 
> If you think it's ok, I would try to make the separation first without
> changing the existing code.

Sure.

> Once I have this working, we can think of
> changing the graph code (we can even consider putting boost.graph if we
> feel greedy).

Nah. Overkill.

> Send it anyway if you have it at hand.

Just a snippet ("ebert" is my graph structure, the rest is hopefully
self-explanatory), array<> could be replaced by map<>, and node and edge
by int

typedef array pathset;

pathset shortest_paths(const ebert & G, node u, const weights & W)
{
const double infin = 1e30;
nodeset U; // seen nodes
U += u;

array   p(nbegin(G), nend(G), edge(0));  // previous edges
array h(nbegin(G), nend(G), infin);// costs
h[u] = 0;

array g;
foreach_incident_edge(e, u, G) {
node j = second_node(G, e);
h[j]   = W(e) + W(j);
p[j]   = e;
}

while (1) {
node v; // next unseen node with minimum weight
double minimum = infin;
foreach_node(w, G) {
if (U(w) || h(w) > minimum)
continue;
minimum = h(w);
v = w;
}

U   += v;
g[v] = h(v);

if (U.card() == node_count(G)) 
break;

// from now on plain Dijkstra
foreach_incident_edge(e, v, G) {
node j = second_node(G, e);
if (U(j))
continue;
double c = g(v) + W(e) + W(j);
if (c >= h(j))
continue;
h[j] = c;
p[j] = e;
}   
}   
return p;
}

path shortest_path(const ebert & G, const dpair & q, const weights & cost)
{
return build_path(G, q, shortest_paths(G, q.first, cost));
}

path build_path(const ebert & G, const dpair & q, pathset prev)
{
path p;
if (!prev(q.second).id())
return p;
for (node w = q.second, t; w != q.first; w = t) {
t = opposite(G, prev(w), w);
p.push_back(prev(w), w, t);
}
p.reverse();
return p;
}


path shortest_path(const ebert & G, const dpair & p)
{
return shortest_path(G, p, default_weights(G));
}

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-26 Thread Andre Poenitz
On Wed, Feb 26, 2003 at 09:45:06AM +0100, Alfredo Braunstein wrote:
> If you think it's ok, I would try to make the separation first without
> changing the existing code.

That's fine of course.

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-26 Thread Jean-Marc Lasgouttes
>>>>> "Alfredo" == Alfredo Braunstein <[EMAIL PROTECTED]> writes:

Alfredo> If there are no a priori objections, I'd like to work a
Alfredo> little on converter.C to:

Alfredo> * clean a little the interface. Right there is ugly code like
Alfredo> this in importer.C:

Good idea. Also, while you are at it, I think that the central part of
Converters::convert should be moved to a new Converter::convert
(without the 's'). Doing such things would help make the code more
understandable. 

JMarc



Re: converter.C

2003-02-26 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

> Good idea. Also, while you are at it, I think that the central part of
> Converters::convert should be moved to a new Converter::convert
> (without the 's'). Doing such things would help make the code more
> understandable.
> 
> JMarc

Actually, what would be a good naming/file distribution?

In converter.C we have four classes:
class Format (a format item)
class Formats (the set of formats)
class Converter (a converter item)
class Converters (the set of converters)

I'm adding one more, the converter graph (if done properly, should not
contain references to conversion at all, but right now I'm in an
intermediate step)

Is it ok to split it into 3 files?/What would be a good namig for them? 

file 1: Format+Formats
file 2: Converter+Converters
file 3: graph for Converters

So, I need a proper naming for the four classes and 3 files.

* unrelated, but what's the use of the two global instances of
Converters/Formats? Can't we have only one of them (and make it a Singleton
class, my newest learning)?

Alfredo




Re: converter.C

2003-02-26 Thread Andre Poenitz
On Wed, Feb 26, 2003 at 11:28:17AM +0100, Alfredo Braunstein wrote:
> Is it ok to split it into 3 files?

I think so.

> What would be a good namig for them? 
> 
> file 1: Format+Formats
> file 2: Converter+Converters
> file 3: graph for Converters

format.[Ch], converter.[Ch], graph.[Ch]

[_I_ am no fan of upper case characters in file names, so others might
prefer Format etc.]

Andre'

-- 
Those who desire to give up Freedom in order to gain Security,
will not have, nor do they deserve, either one. (T. Jefferson)


Re: converter.C

2003-02-26 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

> Good idea. Also, while you are at it, I think that the central part of
> Converters::convert should be moved to a new Converter::convert
> (without the 's'). Doing such things would help make the code more
> understandable.
> 
> JMarc

Should I rename
Converter->ConverterItem
Converters->Converter
Format->FormatItem  
Formats->Format

?




Re: converter.C

2003-02-26 Thread Jean-Marc Lasgouttes
> "Alfredo" == Alfredo Braunstein <[EMAIL PROTECTED]> writes:

Alfredo> Jean-Marc Lasgouttes wrote:
>> Good idea. Also, while you are at it, I think that the central part
>> of Converters::convert should be moved to a new Converter::convert
>> (without the 's'). Doing such things would help make the code more
>> understandable.
>> 
>> JMarc

Alfredo> Should I rename
Alfredo> Converter-> ConverterItem
Alfredo> Converters-> Converter
Alfredo> Format-> FormatItem
Alfredo> Formats-> Format

What would be the gain? It seems to be reasonable as it is now.

JMarc


Re: converter.C

2003-02-26 Thread Alfredo Braunstein
Jean-Marc Lasgouttes wrote:

>>> Good idea. Also, while you are at it, I think that the central part
>>> of Converters::convert should be moved to a new Converter::convert
>>> (without the 's'). Doing such things would help make the code more
>>> understandable.
>>> 
>>> JMarc
> 
> Alfredo> Should I rename
> Alfredo> Converter-> ConverterItem
> Alfredo> Converters-> Converter
> Alfredo> Format-> FormatItem
> Alfredo> Formats-> Format
> 
> What would be the gain? It seems to be reasonable as it is now.
> 
> JMarc

Also to me. I didn't understood what you were asking me, but now I think I
do.
Alfredo




Re: converter.C

2003-02-26 Thread Jean-Marc Lasgouttes
>>>>> "Alfredo" == Alfredo Braunstein <[EMAIL PROTECTED]> writes:

Alfredo> Also to me. I didn't understood what you were asking me, but
Alfredo> now I think I do. Alfredo

OK, to be clearer, I suspect that lines ~612-713 of converter.C should
be in the Converter class. But I may be wrong.

JMarc


(Dekel) Quoting $$FName in converter.C

2000-09-11 Thread Jean-Marc Lasgouttes


Dekel,

Concerning the changes you did in Converter::setViewer() to quote
$$FName. I do not think these changes were needed. The best is
probably to use QuoteName() on the file name later, as in:

string command2 = subst(command, "$$FName", 
QuoteName(OnlyFilename(filename)));

The advantage of QuoteName is that it does nothing for OS/2 (where
'quoting' is not well understood by the shell) and could be adapted
later to provide a better quoting mechanism.

JMarc



(Dekel) Quoting $$FName in converter.C

2000-09-11 Thread Jean-Marc Lasgouttes


Dekel,

Concerning the changes you did in Converter::setViewer() to quote
$$FName. I do not think these changes were needed. The best is
probably to use QuoteName() on the file name later, as in:

string command2 = subst(command, "$$FName", 
QuoteName(OnlyFilename(filename)));

The advantage of QuoteName is that it does nothing for OS/2 (where
'quoting' is not well understood by the shell) and could be adapted
later to provide a better quoting mechanism.

JMarc