Re: tex2lyx and optional arguments

2003-11-15 Thread Georg Baum
Am Freitag, 14. November 2003 18:48 schrieb Andre Poenitz:
> > Solution 2:
> > Create a list of commands that take optional arguments and only serach
> > for  them when they are expected. The drawback is of course the
> > hardcoding of  commands.
> >
> >
> > I don't like either solution. Does anybody have a Solution 3 that is
> > better?  If not, which solution do you prefer?
>
> Solution 2 1/2. The #hardcoding' should be done by using an external
> plain text file which contains the 'known' commands.
>
> Does do reLyX something similar?

Yes. We can even steal the list of 'known' commands from 
lib/reLyX/syntax.default. Creating this list was the main thing that I did 
not like with this solution.

> PS: In case I did not mention that so far:
>  Thanks for cleaning up this tex2lyx mess behind me...

You are welcome, the reLyX mess is bigger. After trying for some hours to 
understand why reLyX did not like my document at all, I looked at tex2lyx 
and got results very quickly.


Georg




[patch] credits

2003-11-15 Thread Alfredo Braunstein
Ok to commit this?

Alfredo
Index: CREDITS
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/CREDITS,v
retrieving revision 1.40
diff -u -p -u -r1.40 CREDITS
--- CREDITS	5 Nov 2003 10:28:53 -	1.40
+++ CREDITS	15 Nov 2003 10:25:44 -
@@ -154,6 +154,9 @@
 @bTino Meinen
 @iE-mail: [EMAIL PROTECTED]
Dutch translation coordinator
[EMAIL PROTECTED] Luis Meloni Assirati
[EMAIL PROTECTED]: [EMAIL PROTECTED]
+   lyxsocket and DVI inverse search
 @bPablo De Napoli
 @iE-mail: [EMAIL PROTECTED]
Math panel dialogs
@@ -227,6 +230,8 @@
 @iE-mail: [EMAIL PROTECTED]
international support and kbmaps for slovak, czech,
german, ... wysiwyg figure
[EMAIL PROTECTED] Serradilla Rodríguez
+   contribution to the spanish internationalization
 @bMiyata Shigeru
 @iE-mail: [EMAIL PROTECTED]
OS/2 port
Index: ChangeLog
===
RCS file: /usr/local/lyx/cvsroot/lyx-devel/lib/ChangeLog,v
retrieving revision 1.537
diff -u -p -u -r1.537 ChangeLog
--- ChangeLog	13 Nov 2003 16:08:09 -	1.537
+++ ChangeLog	15 Nov 2003 10:25:48 -
@@ -1,3 +1,7 @@
+2003-11-15  Alfredo Braunstein  <[EMAIL PROTECTED]>
+
+	* CREDITS: Add Joao Luis and Eulogio Serradilla
+
 2003-11-12  Jean-Marc Lasgouttes  <[EMAIL PROTECTED]>
 
 	* configure.m4: when latex configuration detection is disabled,


Re: [patch] selection2.diff

2003-11-15 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Freitag, 14. November 2003 18:51, Alfredo Braunstein wrote:
> It would be very nice if someone else could give it a test. 

1.) SelectXX.lyx: Unable to select part of a minipage together with other text.
Intended?
2.) Unable to crash!!

3.) 
a.) Open big file
b.) Select at least 2 screen-pages
c.) delete (e.g. with backspace)
d.) Cursor seems to have undefined position. Sometimes near the end of file
4.) still cannot crash!

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iQCVAwUBP7YqALewfbDGmeqhAQGESAP+PiigpJ9b3PQD+F8MtNMHjMlydqLCOd/w
IsAw1LwJqGlzFhIxhFT0q4lbAIjUH1KWzmRb+yM7/XkMkR1DyR6hlMzfS3DZlm61
xGafPR7xXX5Auj+03QxBk4UWHL+YsTkAJHn8FdPzidXtq5U6xHoGgRwPrnmI55Cc
XBupnKe6T6Y=
=spXe
-END PGP SIGNATURE-



Re: [patch] selection2.diff

2003-11-15 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Samstag, 15. November 2003 14:28, Kornel Benko wrote:
> 1.) SelectXX.lyx: Unable to select part of a minipage together with other text.

See attached.

Kornel
- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iQCVAwUBP7YxBbewfbDGmeqhAQE3cAP/a/5Mt8NMBC7fwwr/e3MRj7k+114gdZUU
/qhVAPtnLuCVQImqzxIe4ZnCLAT/qFllDgerGbo5TbUm8kPfY5JnzRJeFzphFTik
c+z5mrNlGXhVQ9FlC4B52pFlv9VPtkYZpkKafl7pbnUXCEsf7yfUnelCRUi0G2aI
CGcymb0b+cQ=
=Qp1e
-END PGP SIGNATURE-
#LyX 1.4.0cvs created this file. For more info see http://www.lyx.org/
\lyxformat 225
\textclass article
\begin_preamble
\input{preamble.tex}
\end_preamble
\language ngerman
\inputencoding auto
\fontscheme default
\graphics default
\paperfontsize default
\spacing single 
\papersize Default
\paperpackage a4
\use_geometry 0
\use_amsmath 0
\use_natbib 0
\use_numerical_citations 0
\paperorientation portrait
\secnumdepth 3
\tocdepth 3
\paragraph_separation skip
\defskip medskip
\quotes_language english
\quotes_times 2
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes 0
\end_header

\begin_layout Standard

\end_layout

\begin_layout Title

Try to select the x--text
\newline 
yy x
\end_layout

\begin_layout Standard
\align center 

\begin_inset Frameless
position "c"
hor_pos "c"
has_inner_box 1
inner_pos "c"
use_parbox 0
width "12cm"
special "none"
height "1pt"
height_special "totalheight"
collapsed false

\begin_layout Standard

x xx 
\end_layout

\begin_layout Standard

yy
\end_layout

\end_inset 


\end_layout

\end_document


Re: [patch] selection2.diff

2003-11-15 Thread Alfredo Braunstein
Kornel Benko wrote:

> On Freitag, 14. November 2003 18:51, Alfredo Braunstein wrote:
>> It would be very nice if someone else could give it a test.
> 
> 1.) SelectXX.lyx: Unable to select part of a minipage together with other
> text. Intended?

I think so. Is this different wrt. 1.3.x? Or else I don't understand the
problem.

> 2.) Unable to crash!!

;-)

> 3.)
> a.) Open big file
> b.) Select at least 2 screen-pages
> c.) delete (e.g. with backspace)
> d.) Cursor seems to have undefined position. Sometimes near the end of
> file 4.) still cannot crash!

I cannot reproduce this. Note that this seems to be unrelated with this
patch (which should only affect behaviour selecting with the mouse, not
what you do after with the selection). 

Thanks for looking at it, 

Alfredo




Re: [patch] selection2.diff

2003-11-15 Thread Kornel Benko
-BEGIN PGP SIGNED MESSAGE-

On Samstag, 15. November 2003 15:25, Alfredo Braunstein wrote:
> Kornel Benko wrote:
> 
> > On Freitag, 14. November 2003 18:51, Alfredo Braunstein wrote:
> >> It would be very nice if someone else could give it a test.
> > 
> > 1.) SelectXX.lyx: Unable to select part of a minipage together with other
> > text. Intended?
> 
> I think so. Is this different wrt. 1.3.x? Or else I don't understand the
> problem.

Sorry, same behaviour.

> > 2.) Unable to crash!!
> 
> ;-)
> 
> > 3.)
> > a.) Open big file
> > b.) Select at least 2 screen-pages
> > c.) delete (e.g. with backspace)
> > d.) Cursor seems to have undefined position. Sometimes near the end of
> > file 4.) still cannot crash!
> 
> I cannot reproduce this. Note that this seems to be unrelated with this
> patch (which should only affect behaviour selecting with the mouse, not
> what you do after with the selection). 

Yes, I think so too. Are you nonetheless inerrested in a testfile?

Kornel

- -- 
Kornel Benko
[EMAIL PROTECTED]
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.2.2-rc1-SuSE (GNU/Linux)

iQCVAwUBP7Y55rewfbDGmeqhAQF25AP+LBpVZ9pjciOr9I00UgM2n4KJb6xpCfTK
hIidLm4bV7jGIbn+QLnUdeIS9tEGDR5S4sj5DwNHXalDkIqqw6LSDh7F2W+/uRdA
1Cc/4MlCuoswagBJttJdnUJreKoyKM1JenqDbfLbNxcXX9r04gD7Wwfws0nivPL5
p9QydlWPPgM=
=9ups
-END PGP SIGNATURE-



Re: [patch] selection2.diff

2003-11-15 Thread Alfredo Braunstein
Kornel Benko wrote:

>> I cannot reproduce this. Note that this seems to be unrelated with this
>> patch (which should only affect behaviour selecting with the mouse, not
>> what you do after with the selection).
> 
> Yes, I think so too. Are you nonetheless inerrested in a testfile?

Yes, please.

Thanks again, Alfredo




Re: tex2lyx and optional arguments

2003-11-15 Thread Georg Baum
Am Freitag, 14. November 2003 21:11 schrieb Georg Baum:
> Yes. We can even steal the list of 'known' commands from
> lib/reLyX/syntax.default. Creating this list was the main thing that I
> did not like with this solution.

It turned out to be rather easy. I have used the syntax.default file from 
reLyX directly.


Georg
Index: src/tex2lyx/ChangeLog
===
RCS file: /cvs/lyx/lyx-devel/src/tex2lyx/ChangeLog,v
retrieving revision 1.41
diff -u -p -r1.41 ChangeLog
--- src/tex2lyx/ChangeLog	2003/11/05 10:14:12	1.41
+++ src/tex2lyx/ChangeLog	2003/11/15 17:09:53
@@ -1,3 +1,10 @@
+2003-11-15  Georg Baum  <[EMAIL PROTECTED]>
+
+	* tex2lyx.C:
+	* tex2lyx.h:
+	* text.C: Read a list of commands and their arguments from a reLyX
+	compatible syntax file in order to parse optional arguments correctly.
+
 2003-11-03  Georg Baum  <[EMAIL PROTECTED]>
 
 	* math.C:
Index: src/tex2lyx/tex2lyx.C
===
RCS file: /cvs/lyx/lyx-devel/src/tex2lyx/tex2lyx.C,v
retrieving revision 1.53
diff -u -p -r1.53 tex2lyx.C
--- src/tex2lyx/tex2lyx.C	2003/11/05 10:14:13	1.53
+++ src/tex2lyx/tex2lyx.C	2003/11/15 17:09:57
@@ -43,6 +43,7 @@ using std::ostringstream;
 using std::stringstream;
 using std::string;
 using std::vector;
+using std::map;
 
 using lyx::support::system_lyxdir;
 using lyx::support::user_lyxdir;
@@ -114,7 +115,63 @@ string active_environment()
 }
 
 
+map > known_commands;
+
+
+namespace {
+
+
+/*!
+ * Read a list of TeX commands from a reLyX compatible syntax file.
+ * Since this list is used after all commands that have a LyX counterpart
+ * are handled, it does not matter that the "syntax.default" file from reLyX
+ * has almost all of them listed. For the same reason the reLyX-specific
+ * reLyXre environment is ignored.
+ */
+void read_syntaxfile(string const & file_name)
+{
+	if (!IsFileReadable(file_name)) {
+		cerr << "Could not open syntax file \"" << file_name
+		 << "\" for reading." << endl;
+		exit(2);
+	}
+	ifstream is(file_name.c_str());
+	// We can use our TeX parser, since the syntax of the layout file is
+	// modeled after TeX.
+	// Unknown tokens are just silently ignored, this helps us to skip some
+	// reLyX specific things.
+	Parser p(is);
+	while (p.good()) {
+		Token const & t = p.get_token();
+		if (t.cat() == catEscape) {
+			string command = t.asInput();
+			if (p.next_token().asInput() == "*") {
+p.get_token();
+command += '*';
+			}
+			p.skip_spaces();
+			vector arguments;
+			while (p.next_token().cat() == catBegin ||
+			   p.next_token().asInput() == "[") {
+if (p.next_token().cat() == catBegin) {
+	string const arg = p.getArg('{', '}');
+	if (arg == "translate")
+		arguments.push_back(required);
+	else
+		arguments.push_back(verbatim);
+} else {
+	p.getArg('[', ']');
+	arguments.push_back(optional);
+}
+			}
+			known_commands[command] = arguments;
+		}
+	}
+}
+
+
 string documentclass;
+string syntaxfile;
 bool overwrite_files = false;
 
 
@@ -130,7 +187,8 @@ int parse_help(string const &, string co
 	"\t-f Force creation of .lyx files even if they exist already\n"
 		"\t-userdir dir   try to set user directory to dir\n"
 		"\t-sysdir dirtry to set system directory to dir\n"
-	"\t-c textclass   declare the textclass" << endl;
+	"\t-c textclass   declare the textclass\n"
+	"\t-s syntaxfile  read additional syntax file" << endl;
 	exit(0);
 }
 
@@ -146,6 +204,17 @@ int parse_class(string const & arg, stri
 }
 
 
+int parse_syntaxfile(string const & arg, string const &)
+{
+	if (arg.empty()) {
+		cerr << "Missing syntaxfile string after -s switch" << endl;
+		exit(1);
+	}
+	syntaxfile = arg;
+	return 1;
+}
+
+
 int parse_sysdir(string const & arg, string const &)
 {
 	if (arg.empty()) {
@@ -177,10 +246,11 @@ int parse_force(string const &, string c
 
 void easyParse(int & argc, char * argv[])
 {
-	std::map cmdmap;
+	map cmdmap;
 
 	cmdmap["-c"] = parse_class;
 	cmdmap["-f"] = parse_force;
+	cmdmap["-s"] = parse_syntaxfile;
 	cmdmap["-help"] = parse_help;
 	cmdmap["--help"] = parse_help;
 	cmdmap["-sysdir"] = parse_sysdir;
@@ -208,6 +278,8 @@ void easyParse(int & argc, char * argv[]
 	}
 }
 
+} // anonymous namespace
+
 
 void tex2lyx(std::istream &is, std::ostream &os)
 {
@@ -266,6 +338,15 @@ int main(int argc, char * argv[])
 
 	lyx::support::os::init(&argc, &argv);
 	lyx::support::setLyxPaths();
+
+	string const system_syntaxfile = lyx::support::LibFileSearch("reLyX", "syntax.default");
+	if (system_syntaxfile.empty()) {
+		cerr << "Error: Could not find syntax file \"syntax.default\"." << endl;
+		exit(1);
+	}
+	read_syntaxfile(system_syntaxfile);
+	if(syntaxfile.size())
+		read_syntaxfile(syntaxfile);
 
 	if (!IsFileReadable(argv[1])) {
 		cerr << "Could not open input file \"" << argv[1]
Index: src/tex2lyx/tex2lyx.h

Re: Linking time

2003-11-15 Thread Christian Ridderström
On Thu, 13 Nov 2003, Andre Poenitz wrote:

> On Wed, Nov 12, 2003 at 11:39:01AM +0100, Michael Schmitt wrote:
> > Hello,
> > 
> > I would like to remind you of a very simple solution:
> > 
> > 
> > Index: config/lyxinclude.m4
> > ===
> > RCS file: /cvs/lyx/lyx-devel/config/lyxinclude.m4,v
> > retrieving revision 1.89
> > diff -u -r1.89 lyxinclude.m4
> > --- config/lyxinclude.m42003/09/16 15:23:54 1.89
> > +++ config/lyxinclude.m42003/11/12 10:37:34
> > @@ -216,7 +216,7 @@
> >*)   CXXFLAGS="$lyx_opt";;
> >  esac
> >  if test x$enable_debug = xyes ; then
> > -   CXXFLAGS="-g $CXXFLAGS"
> > +   CXXFLAGS="-gstabs $CXXFLAGS"
> >  fi
> >fi
> >if test x$enable_warnings = xyes ; then
> > 

The above compiled for me using gcc 3.2.3, gcc 3.3.1 and gcc 3.3.2. 
Compiling with gcc 2.96 and gcc 3.0.4 failed because of missing ostream etc.

If anyone is desperate for log outputs, see
http://www.md.kth.se/~chr/lyx/build-logs/

/Christian

-- 
Christian Ridderström   http://www.md.kth.se/~chr