+2000-03-02 Lars Gullik Bjønnes <larsbj@lyx.org>
+
+ * src/mathed/math_utils.C (MathedLookupBOP): using only res->id ==
+ id in the check of the result from lower_bound is not enough since
+ lower_bound can return last too, and then res->id will not be a
+ valid construct.
+
+ * all insets and some code that use them: I have conditionalized
+ removed the Latex(string & out, ...) this means that only the
+ Latex(ostream &, ...) will be used. This is a work in progress to
+ move towards using streams for all output of files.
+
+ * src/text.C (GetColumnNearX): initialize LyXParagraph::size_type
+ c to 0.
+
2000-03-02 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/mathed/math_utils.C (MathedLookupBOP): fix the search
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
case $gxx_version in
- 2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
+ 2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti -fno-exceptions";;
2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
2.96*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
*2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
fi
if test x$with_warnings = xyes ; then
case $gxx_version in
- 2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
- 2.96*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
- *) CXXFLAGS="$CXXFLAGS -ansi -Wall -W -Wno-return-type";;
+ 2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
+ 2.96*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
+ *) CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";;
esac
if test $lyx_devel_version = yes ; then
case $gxx_version in
CXXFLAGS="$ac_save_CXXFLAGS"
elif test $ac_cv_prog_cxx_g = yes; then
case $gxx_version in
- 2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti";;
+ 2.95.1) CXXFLAGS="-g $lyx_opt -fpermissive -fno-rtti -fno-exceptions";;
2.95.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
2.96*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
*2.91.*) CXXFLAGS="-g $lyx_opt -fno-rtti -fno-exceptions";;
fi
if test x$with_warnings = xyes ; then
case $gxx_version in
- 2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
- 2.96*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
- *) CXXFLAGS="$CXXFLAGS -ansi -Wall -W -Wno-return-type";;
+ 2.95.*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
+ 2.96*) CXXFLAGS="$CXXFLAGS -W -Wall -Wconversion";;
+ *) CXXFLAGS="$CXXFLAGS -ansi -W -Wall -Wno-return-type";;
esac
if test $lyx_devel_version = yes ; then
case $gxx_version in
}
+#ifndef USE_OSTREAM_ONLY
int InsetFig::Latex(string & file, signed char /* fragile*/ ) const
{
Regenerate();
file += cmd + ' ';
return 0;
}
+#endif
int InsetFig::Linuxdoc(string &/*file*/) const
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
int InsetBibtex::Latex(ostream & os, signed char /*fragile*/) const
{
+#ifdef USE_OSTREAM_ONLY
+ // this looks like an horrible hack and it is :) The problem
+ // is that owner is not initialized correctly when the bib
+ // inset is cut and pasted. Such hacks will not be needed
+ // later (JMarc)
+ if (!owner) {
+ owner = current_view->buffer();
+ }
+ // If we generate in a temp dir, we might need to give an
+ // absolute path there. This is a bit complicated since we can
+ // have a comma-separated list of bibliographies
+ string adb, db_out;
+ string db_in = getContents();
+ db_in = split(db_in, adb, ',');
+ while(!adb.empty()) {
+ if (!owner->niceFile &&
+ IsFileReadable(MakeAbsPath(adb, owner->filepath)+".bib"))
+ adb = MakeAbsPath(adb, owner->filepath);
+ db_out += adb;
+ db_out += ',';
+ db_in= split(db_in, adb,',');
+ }
+ db_out = strip(db_out, ',');
+ // Idem, but simpler
+ string style;
+ if (!owner->niceFile
+ && IsFileReadable(MakeAbsPath(getOptions(), owner->filepath)
+ + ".bst"))
+ style = MakeAbsPath(getOptions(), owner->filepath);
+ else
+ style = getOptions();
+
+ os << "\\bibliographystyle{" << style << "}\n"
+ << "\\bibliography{" << db_out << "}\n";
+ return 2;
+#else
string bib;
signed char dummy = 0;
int result = Latex(bib, dummy);
os << bib;
return result;
+#endif
}
+#ifndef USE_OSTREAM_ONLY
int InsetBibtex::Latex(string & file, signed char /*fragile*/) const
{
// this looks like an horrible hack and it is :) The problem
file += "}\n";
return 2;
}
-
+#endif
// This method returns a comma separated list of Bibtex entries
string InsetBibtex::getKeys(char delim)
void Edit(BufferView *, int x, int y, unsigned int button);
///
int Latex(ostream &, signed char) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
string getKeys(char delim);
///
}
+#ifndef USE_OSTREAM_ONLY
int InsetCommand::Latex(string & file, signed char /*fragile*/) const
{
file += getCommand();
return 0;
}
+#endif
int InsetCommand::Linuxdoc(string &/*file*/) const
void Read(LyXLex & lex);
///
virtual int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
virtual int Latex(string & file, signed char fragile) const;
+#endif
///
virtual int Linuxdoc(string & file) const;
///
}
+#ifndef USE_OSTREAM_ONLY
int InsetError::Latex(string &, signed char /*fragile*/) const
{
return 0;
}
+#endif
int InsetError::Linuxdoc(string &) const
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
}
+#ifndef USE_OSTREAM_ONLY
int InsetGraphics::Latex(string & /*file*/, signed char /*fragile*/) const
{
return 0;
}
+#endif
int InsetGraphics::Linuxdoc(string & /*file*/) const
fragile commands by adding a \protect before.
*/
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & /*file*/) const;
///
int InsetInclude::Latex(ostream & os, signed char /*fragile*/) const
{
+#ifdef USE_OSTREAM_ONLY
+ // Do nothing if no file name has been specified
+ if (contents.empty())
+ return 0;
+
+ // Use += to force a copy of contents (JMarc)
+ // How does that force anything? (Lgb)
+ string incfile(contents);
+
+ if (loadIfNeeded()) {
+ Buffer * tmp = bufferlist.getBuffer(getFileName());
+
+ if (tmp->params.textclass != master->params.textclass) {
+ lyxerr << "ERROR: Cannot handle include file `"
+ << MakeDisplayPath(getFileName())
+ << "' which has textclass `"
+ << textclasslist.NameOfClass(tmp->params.textclass)
+ << "' instead of `"
+ << textclasslist.NameOfClass(master->params.textclass)
+ << "'." << endl;
+ return 0;
+ }
+
+ // write it to a file (so far the complete file)
+ string writefile = ChangeExtension(getFileName(), ".tex", false);
+ if (!master->tmppath.empty()
+ && !master->niceFile) {
+ incfile = subst(incfile, '/','@');
+#ifdef __EMX__
+ incfile = subst(incfile, ':', '$');
+#endif
+ writefile = AddName(master->tmppath, incfile);
+ } else
+ writefile = getFileName();
+ writefile = ChangeExtension(writefile, ".tex", false);
+ lyxerr[Debug::LATEX] << "incfile:" << incfile << endl;
+ lyxerr[Debug::LATEX] << "writefile:" << writefile << endl;
+
+ tmp->markDepClean(master->tmppath);
+
+ tmp->makeLaTeXFile(writefile,
+ OnlyPath(getMasterFilename()),
+ master->niceFile, true);
+ }
+
+ if (isVerb()) {
+ os << '\\' << command << '{' << incfile << '}';
+ }
+ else if (isInput()) {
+ // \input wants file with extension (default is .tex)
+ if (!IsLyXFilename(getFileName())) {
+ os << '\\' << command << '{' << incfile << '}';
+ } else {
+ os << '\\' << command << '{'
+ << ChangeExtension(incfile, ".tex", false)
+ << '}';
+ }
+ } else {
+ // \include don't want extension and demands that the
+ // file really have .tex
+ os << '\\' << command << '{'
+ << ChangeExtension(incfile, string(), false)
+ << '}';
+ }
+
+ return 0;
+#else
string include_file;
signed char dummy = 0;
Latex(include_file, dummy);
os << include_file;
return 0;
+#endif
}
+#ifndef USE_OSTREAM_ONLY
int InsetInclude::Latex(string & file, signed char /*fragile*/) const
{
- string writefile, incfile;
-
// Do nothing if no file name has been specified
if (contents.empty())
return 0;
// Use += to force a copy of contents (JMarc)
- incfile += contents;
+ string incfile += contents;
if (loadIfNeeded()) {
Buffer * tmp = bufferlist.getBuffer(getFileName());
}
// write it to a file (so far the complete file)
- writefile = ChangeExtension(getFileName(), ".tex", false);
+ string writefile =
+ ChangeExtension(getFileName(), ".tex", false);
if (!master->tmppath.empty()
&& !master->niceFile) {
incfile = subst(incfile, '/','@');
return 0;
}
+#endif
void InsetInclude::Validate(LaTeXFeatures & features) const
void Read(LyXLex &);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
-
+#endif
///
void Validate(LaTeXFeatures &) const;
}
+#ifndef USE_OSTREAM_ONLY
int InsetInfo::Latex(string &, signed char /*fragile*/) const
{
return 0;
}
+#endif
int InsetInfo::Linuxdoc(string &) const
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
}
+#ifndef USE_OSTREAM_ONLY
int InsetLabel::Latex(string & file, signed char /*fragile*/) const
{
file += escape(getCommand());
return 0;
}
+#endif
int InsetLabel::Linuxdoc(string & file) const
unsigned char Editable() const { return 0; }
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
}
+#ifndef USE_OSTREAM_ONLY
int InsetLatexAccent::Latex(string & file, signed char /*fragile*/) const
{
file += contents;
return 0;
}
+#endif
int InsetLatexAccent::Linuxdoc(string & file) const
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
}
+#ifndef USE_OSTREAM_ONLY
// LaTeX must just ignore this command
int InsetParent::Latex(string & file, signed char fragile) const
{
InsetCommand::Latex(file, fragile);
return 0;
}
+#endif
InsetParent(string const & fn, Buffer * owner = 0);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
Inset * Clone() const { return new InsetParent(getContents()); }
///
int InsetQuotes::Latex(ostream & os, signed char /*fragile*/) const
{
+#ifdef USE_OSTREAM_ONLY
+ string doclang =
+ current_view->buffer()->GetLanguage();
+ int quoteind = quote_index[side][language];
+ string qstr;
+
+ if (lyxrc->fontenc == "T1") {
+ qstr = latex_quote_t1[times][quoteind];
+ }
+ else if (doclang == "default") {
+ qstr = latex_quote_ot1[times][quoteind];
+ }
+ else if (language == InsetQuotes::FrenchQ
+ && times == InsetQuotes::DoubleQ
+ && doclang == "frenchb") {
+ if (side == InsetQuotes::LeftQ)
+ qstr = "\\og{}";
+ else
+ qstr = " \\fg{}";
+ }
+ else
+ qstr = latex_quote_babel[times][quoteind];
+
+ // protect against !` and ?` ligatures.
+ // Is it very bad of us to always protect against those ligatures?
+#if 0
+ if ((suffixIs(file, '?') || suffixIs(file, '!'))
+ && qstr[0] == '`')
+ qstr = "{}" + qstr;
+#else
+ // Always guard against unfortunate ligatures (!` ?`)
+ qstr.insert(0, "{}");
+#endif
+
+ os << qstr;
+ return 0;
+#else
string quote;
int res = Latex(quote, 0);
os << quote;
return res;
+#endif
}
+#ifndef USE_OSTREAM_ONLY
int InsetQuotes::Latex(string & file, signed char /*fragile*/) const
{
string doclang =
file += qstr;
return 0;
}
+#endif
int InsetQuotes::Linuxdoc(string & file) const
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
}
+#ifndef USE_OSTREAM_ONLY
int InsetRef::Latex(string & file, signed char /*fragile*/) const
{
if(getOptions().empty())
}
return 0;
}
+#endif
int InsetRef::Linuxdoc(string & file) const
void gotoLabel();
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
int InsetSpecialChar::Latex(ostream & os, signed char /*fragile*/) const
{
+#ifdef USE_OSTREAM_ONLY
+ switch (kind) {
+ case HYPHENATION: os << "\\-"; break;
+ case END_OF_SENTENCE: os << "\\@."; break;
+ case LDOTS: os << "\\ldots{}"; break;
+ case MENU_SEPARATOR: os << "\\lyxarrow{}"; break;
+ case PROTECTED_SEPARATOR: os << "~"; break;
+ }
+ return 0;
+#else
string command;
signed char dummy = 0;
Latex(command, dummy);
os << command;
return 0;
+#endif
}
+#ifndef USE_OSTREAM_ONLY
int InsetSpecialChar::Latex(string & file, signed char /*fragile*/) const
{
switch (kind) {
}
return 0;
}
+#endif
int InsetSpecialChar::Linuxdoc(string & file) const
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
WriteParagraphData(os);
}
+
void InsetText::WriteParagraphData(ostream & os) const
{
par->writeFile(os, buffer->params, 0, 0);
}
+
void InsetText::Read(LyXLex & lex)
{
string token, tmptok;
int pos = 0;
- LyXParagraph *return_par = 0;
+ LyXParagraph * return_par = 0;
char depth = 0; // signed or unsigned?
LyXParagraph::footnote_flag footnoteflag = LyXParagraph::NO_FOOTNOTE;
LyXParagraph::footnote_kind footnotekind = LyXParagraph::FOOTNOTE;
}
-UpdatableInset::RESULT InsetText::LocalDispatch(BufferView * bv,
- int action, string const & arg)
+UpdatableInset::RESULT
+InsetText::LocalDispatch(BufferView * bv,
+ int action, string const & arg)
{
no_selection = false;
if (UpdatableInset::LocalDispatch(bv, action, arg)) {
}
-int InsetText::Latex(ostream & os, signed char fragile) const
+int InsetText::Latex(ostream & os, signed char /*fragile*/) const
{
+#ifdef USE_OSTREAM_ONLY
+ string fstr;
+ TexRow texrow;
+ int ret = par->SimpleTeXOnePar(fstr, texrow);
+ os << fstr;
+ return ret;
+#else
string fstr;
int i = Latex(fstr, fragile);
os << fstr;
return i;
+#endif
}
+#ifndef USE_OSTREAM_ONLY
int InsetText::Latex(string & file, signed char /* fragile */) const
{
TexRow texrow;
return par->SimpleTeXOnePar(file, texrow);
}
+#endif
void InsetText::Validate(LaTeXFeatures & features) const
UpdatableInset::RESULT LocalDispatch(BufferView *, int, string const &);
///
int Latex(ostream &, signed char) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string &, signed char) const;
+#endif
///
int Linuxdoc(string &) const { return 0; }
///
int InsetUrl::Latex(ostream & os, signed char fragile) const
{
+#ifdef USE_OSTREAM_ONLY
+ if (!getOptions().empty())
+ os << getOptions() + ' ';
+ if (fragile)
+ os << "\\protect";
+ os << "\\url{" << getContents() << '}';
+ return 0;
+#else
string latex_output;
int res = Latex(latex_output, fragile);
os << latex_output;
return res;
+#endif
}
+#ifndef USE_OSTREAM_ONLY
int InsetUrl::Latex(string & file, signed char fragile) const
{
if (!getOptions().empty())
return 0;
}
+#endif
int InsetUrl::Linuxdoc(string & file) const
void gotoLabel();
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
struct LaTeXFeatures;
+#define USE_OSTREAM_ONLY 1
+
/// Insets
class Inset {
public:
fragile commands by adding a \protect before.
*/
virtual int Latex(ostream &, signed char fragile) const = 0;
+#ifndef USE_OSTREAM_ONLY
///
virtual int Latex(string & file, signed char fragile) const = 0;
+#endif
///
virtual int Linuxdoc(string & /*file*/) const = 0;
///
#ifdef HAVE_LOCALE_H
#include <locale.h>
#endif
+#include <clocale>
#include "debug.h"
int MathedInset::df_width;
-inline bool IsMacro(short token, int id)
+inline
+bool IsMacro(short token, int id)
{
return (token != LM_TK_FRAC && token != LM_TK_SQRT &&
!((token == LM_TK_SYM || token == LM_TC_BSYM) && id < 255));
Math_Fonts = new LyXFont[8]; //DEC cxx cannot initialize all fonts
//at once (JMarc) rc
- for (int i = 0 ; i < 8 ; ++i){
+ for (int i = 0 ; i < 8 ; ++i) {
Math_Fonts[i] = LyXFont(LyXFont::ALL_SANE);
}
Math_Fonts[0].setShape(LyXFont::ITALIC_SHAPE);
//#warning Alejandro, the number of lines is not returned in this case
// This problem will disapear at 0.13.
string output;
+#ifdef USE_OSTREAM_ONLY
+ if (fragile < 0)
+ par->Write(output);
+ else
+ mathed_write(par, output, &ret, fragile, label.c_str());
+
+#else
InsetFormula::Latex(output, fragile);
+#endif
os << output;
return ret;
}
+#ifndef USE_OSTREAM_ONLY
int InsetFormula::Latex(string & file, signed char fragile) const
{
int ret = 0;
mathed_write(par, file, &ret, fragile, label.c_str());
return ret;
}
+#endif
int InsetFormula::Linuxdoc(string &/*file*/) const
void Read(LyXLex & lex);
///
int Latex(ostream &, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
}
+#ifndef USE_OSTREAM_ONLY
int InsetFormulaMacro::Latex(string &file, signed char /*fragile*/) const
{
int ret = 1;
tmacro->WriteDef(file);
return ret;
}
+#endif
int InsetFormulaMacro::Linuxdoc(string &/*file*/) const
void Write(ostream & os) const;
///
int Latex(ostream & os, signed char fragile) const;
+#ifndef USE_OSTREAM_ONLY
///
int Latex(string & file, signed char fragile) const;
+#endif
///
int Linuxdoc(string & file) const;
///
struct compara {
// used by sort
+ inline
int operator()(binary_op_pair const & a,
binary_op_pair const & b) const {
return a.id < b.id;
}
// used by lower_bound
+ inline
int operator()(binary_op_pair const & a, short int id) const {
return a.id < id;
}
int MathedLookupBOP(short id)
{
- static int bopCount = sizeof(binary_op_table) / sizeof(binary_op_pair);
+ static int const bopCount =
+ sizeof(binary_op_table) / sizeof(binary_op_pair);
static bool issorted = false;
if (!issorted) {
binary_op_pair * res = lower_bound(binary_op_table,
binary_op_table + bopCount,
id, compara());
- if (res->id == id)
+ if (res != binary_op_table + bopCount && res->id == id)
return res->isrel;
else
return LMB_NONE;
file += style.latexparam();
break;
case LATEX_ITEM_ENVIRONMENT:
- if (bibkey)
+ if (bibkey) {
+#ifdef USE_OSTREAM_ONLY
+#ifdef HAVE_SSTREAM
+ ostringstream ost;
+ bibkey->Latex(ost, false);
+ file += ost.str().c_str();
+#else
+ ostrstream ost;
+ bibkey->Latex(ost, false);
+ ost << '\0';
+ char * tmp = ost.str();
+ file += tmp;
+ delete [] tmp;
+#endif
+#else
bibkey->Latex(file, false);
- else
+#endif
+ } else
file += "\\item ";
break;
case LATEX_LIST_ENVIRONMENT:
file += "\\L{";
close = true;
}
+#ifdef USE_OSTREAM_ONLY
+#ifdef HAVE_SSTREAM
+ ostringstream ost;
+ int tmp = inset->Latex(ost, style.isCommand());
+ file += ost.str().c_str();
+#else
+ ostrstream ost;
+ int tmp = inset->Latex(ost, style.isCommand());
+ ost << '\0';
+ char * chtmp = ost.str();
+ file += chtmp;
+ delete [] chtmp;
+#endif
+#else
int tmp = inset->Latex(file, style.isCommand());
+#endif
if (close)
file += "}";
return MakeAbsPath(fil);
// No we try to find it using kpsewhich.
+ // It seems from the kpsewhich manual page that it is safe to use
+ // kpsewhich without --format: "When the --format option is not
+ // given, the search path used when looking for a file is inferred
+ // from the name given, by looking for a known extension. If no
+ // known extension is found, the search path for TeX source files
+ // is used."
+ // However, we want to take advantage of the format sine almost all
+ // the different formats has environment variables that can be used
+ // to controll which paths to search. f.ex. bib looks in
+ // BIBINPUTS and TEXBIB. Small list follows:
+ // bib - BIBINPUTS, TEXBIB
+ // bst - BSTINPUTS
+ // graphic/figure - TEXPICTS, TEXINPUTS
+ // ist - TEXINDEXSTYLE, INDEXSTYLE
+ // pk - PROGRAMFONTS, PKFONTS, TEXPKS, GLYPHFONTS, TEXFONTS
+ // tex - TEXINPUTS
+ // tfm - TFMFONTS, TEXFONTS
+ // This means that to use kpsewhich in the best possible way we
+ // should help it by setting additional path in the approp. envir.var.
string kpsecmd = "kpsewhich " + fil;
cmdret c = do_popen(kpsecmd);
/* Start the selection from here */
sel_cursor = cursor;
+#ifdef USE_OSTREAM_ONLY
+#ifdef HAVE_SSTREAM
+ ostringstream latex;
+#else
+ ostrstream latex;
+#endif
+#else
string latex;
-
+#endif
/* and find the end of the word
(optional hyphens are part of a word) */
while (cursor.pos < cursor.par->Last()
&& (cursor.par->IsLetter(cursor.pos))
- || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET &&
- cursor.par->GetInset(cursor.pos) != 0 &&
- cursor.par->GetInset(cursor.pos)->Latex(latex, 0) == 0 &&
- latex == "\\-"))
+ || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
+ && cursor.par->GetInset(cursor.pos) != 0
+ && cursor.par->GetInset(cursor.pos)->Latex(latex, 0) == 0
+#ifdef USE_OSTREAM_ONLY
+#ifdef HAVE_SSTREAM
+ && latex.str() == "\\-"
+#else
+ && string(latex.str(), 3) == "\\-" // this is not nice at all
+#endif
+#else
+ && latex == "\\-"
+#endif
+ ))
cursor.pos++;
+#ifdef USE_OSTREAM_ONLY
+#ifndef HAVE_SSTREAM
+ delete [] latex.str();
+#endif
+#endif
// Finally, we copy the word to a string and return it
char * str = 0;
/* set the sel cursor */
sel_cursor = cursor;
+#ifdef USE_OSTREAM_ONLY
+#ifdef HAVE_SSTREAM
+ ostringstream latex;
+#else
+ ostrstream latex;
+#endif
+#else
string latex;
+#endif
/* now find the end of the word */
while (cursor.pos < cursor.par->Last()
&& (cursor.par->IsLetter(cursor.pos)
- || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET &&
- cursor.par->GetInset(cursor.pos) != 0 &&
- cursor.par->GetInset(cursor.pos)->Latex(latex, 0) == 0 &&
- latex == "\\-")))
+ || (cursor.par->GetChar(cursor.pos) == LyXParagraph::META_INSET
+ && cursor.par->GetInset(cursor.pos) != 0
+ && cursor.par->GetInset(cursor.pos)->Latex(latex, 0) == 0
+#ifdef USE_OSTREAM_ONLY
+#ifdef HAVE_SSTREAM
+ && latex.str() == "\\-"
+#else
+ && string(latex.str(), 3) == "\\-"
+#endif
+#else
+ && latex == "\\-"
+#endif
+ )))
cursor.pos++;
+#ifdef USE_OSTREAM_ONLY
+#ifndef HAVE_SSTREAM
+ delete [] latex.str();
+#endif
+#endif
SetCursor(cursor.par, cursor.pos);
/* finally set the selection */
LyXDirection direction = row->par->getParDirection();
LyXParagraph::size_type vc = row->pos;
LyXParagraph::size_type last = RowLast(row);
- LyXParagraph::size_type c;
+ LyXParagraph::size_type c = 0;
LyXLayout const & layout = textclasslist.Style(parameters->textclass,
row->par->GetLayout());