Author: lasgouttes
Date: Tue Jan 25 12:22:47 2011
New Revision: 37322
URL: http://www.lyx.org/trac/changeset/37322

Log:
better fix to #7239. Actually the whole switch and kaboodle (see r37229) is 
needed (otherwise sweave is broken)

Modified:
   lyx-devel/trunk/INSTALL
   lyx-devel/trunk/config/lyxinclude.m4
   lyx-devel/trunk/src/output_latex.cpp

Modified: lyx-devel/trunk/INSTALL
==============================================================================
--- lyx-devel/trunk/INSTALL     Tue Jan 25 11:26:29 2011        (r37321)
+++ lyx-devel/trunk/INSTALL     Tue Jan 25 12:22:47 2011        (r37322)
@@ -103,20 +103,21 @@
 
   ./configure
 
-For more complicated cases, LyX configure takes the following specific
+For more complicated cases, LyX configure honors the following specific
 flags:
 
   o --enable-build-type=[rel(ease), dev(elopment), pre(release)]
     allows to tweak the compiled code. The following table describes
     the settings in terms of various options that are described later
 
-                      release   prerelease  development
-    optimization        -O2         -O2         -O
+                      release   prerelease  development gprof
+    optimization        -O2         -O2         -O       -O2
     assertions                       X           X
     stdlib-debug                                 X
     concept-checks                   X           X
     warnings                         X           X
-    debug                            X           X
+    debug                            X           X         X
+    gprof                                                  X
 
     The default are as follows in terms of version number
     release: stable release (1.x.y)

Modified: lyx-devel/trunk/config/lyxinclude.m4
==============================================================================
--- lyx-devel/trunk/config/lyxinclude.m4        Tue Jan 25 11:26:29 2011        
(r37321)
+++ lyx-devel/trunk/config/lyxinclude.m4        Tue Jan 25 12:22:47 2011        
(r37322)
@@ -19,6 +19,8 @@
           build_type=development;;
     pre*) lyx_prerelease=yes
           build_type=prerelease;;
+    gp*)  lyx_profiling=yes
+          build_type=gprof;;
     rel*) ;;
     *) AC_ERROR([Bad build type specification \"$enableval\". Please use one 
of dev(elopment), rel(ease) or pre(release)]);;
    esac],
@@ -188,7 +190,7 @@
 ### We might want to disable debug
 AC_ARG_ENABLE(debug,
   AC_HELP_STRING([--enable-debug],[enable debug information]),,
-  [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes ; then
+  [ if test $lyx_devel_version = yes -o $lyx_prerelease = yes -o 
$lyx_profiling = yes ; then
        enable_debug=yes;
     else
        enable_debug=no;
@@ -212,7 +214,11 @@
 
 AC_ARG_ENABLE(gprof,
   AC_HELP_STRING([--enable-gprof],[enable profiling using gprof]),,
-  enable_gprof=no;)
+  [if test $build_type = gprof ; then
+      enable_gprof=yes;
+    else
+      enable_gprof=no;
+    fi;])
 
 ### set up optimization
 AC_ARG_ENABLE(optimization,

Modified: lyx-devel/trunk/src/output_latex.cpp
==============================================================================
--- lyx-devel/trunk/src/output_latex.cpp        Tue Jan 25 11:26:29 2011        
(r37321)
+++ lyx-devel/trunk/src/output_latex.cpp        Tue Jan 25 12:22:47 2011        
(r37322)
@@ -380,6 +380,40 @@
        return lines;
 }
 
+namespace {
+
+// output the proper paragraph start according to latextype.
+void parStartCommand(Paragraph const & par, odocstream & os, TexRow & texrow,
+                    OutputParams const & runparams,Layout const & style) 
+{
+       switch (style.latextype) {
+       case LATEX_COMMAND:
+               os << '\\' << from_ascii(style.latexname());
+
+               // Separate handling of optional argument inset.
+               if (style.optargs != 0 || style.reqargs != 0) {
+                       int ret = latexArgInsets(par, os, runparams, 
style.reqargs, style.optargs);
+                       while (ret > 0) {
+                               texrow.newline();
+                               --ret;
+                       }
+               }
+               else
+                       os << from_ascii(style.latexparam());
+               break;
+       case LATEX_ITEM_ENVIRONMENT:
+       case LATEX_LIST_ENVIRONMENT:
+               os << "\\item ";
+               break;
+       case LATEX_BIB_ENVIRONMENT:
+               // ignore this, the inset will write itself
+               break;
+       default:
+               break;
+       }
+}
+
+} // namespace anon
 
 // FIXME: this should be anonymous
 void TeXOnePar(Buffer const & buf,
@@ -444,23 +478,18 @@
 
        if (style.pass_thru) {
                Font const outerfont = text.outerFont(pit);
-               // can we have pass_thru for lists? if so, we need to do the 
whole
-               // switch and kaboodle here.
-               os << '\\' << from_ascii(style.latexname());
+               parStartCommand(par, os, texrow,runparams, style);
 
-               // Separate handling of optional argument inset.
-               if (style.optargs != 0 || style.reqargs != 0) {
-                       int ret = latexArgInsets(par, os, runparams, 
style.reqargs, style.optargs);
-                       while (ret > 0) {
-                               texrow.newline();
-                               --ret;
-                       }
-               }
-               else
-                       os << from_ascii(style.latexparam());
                par.latex(bparams, outerfont, os, texrow, runparams, start_pos,
                        end_pos);
-               os << from_ascii("}\n");
+
+               // I did not create a parEndCommand for this minuscule
+               // task because in the other user of parStartCommand
+               // the code is different (JMarc)
+               if (style.isCommand())
+                       os << from_ascii("}\n");
+               else
+                       os << from_ascii("\n");
                texrow.newline();
                if (!style.parbreak_is_newline) {
                        os << '\n';
@@ -687,31 +716,7 @@
                }
        }
 
-       switch (style.latextype) {
-       case LATEX_COMMAND:
-               os << '\\' << from_ascii(style.latexname());
-
-               // Separate handling of optional argument inset.
-               if (style.optargs != 0 || style.reqargs != 0) {
-                       int ret = latexArgInsets(par, os, runparams, 
style.reqargs, style.optargs);
-                       while (ret > 0) {
-                               texrow.newline();
-                               --ret;
-                       }
-               }
-               else
-                       os << from_ascii(style.latexparam());
-               break;
-       case LATEX_ITEM_ENVIRONMENT:
-       case LATEX_LIST_ENVIRONMENT:
-               os << "\\item ";
-               break;
-       case LATEX_BIB_ENVIRONMENT:
-               // ignore this, the inset will write itself
-               break;
-       default:
-               break;
-       }
+       parStartCommand(par, os, texrow,runparams, style);
 
        Font const outerfont = text.outerFont(pit);
 

Reply via email to