Some cleanup; fix a bug where bibtex entries list would have extraneous spaces.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@392 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 1999-12-22 14:35:05 +00:00
parent 23297eadbd
commit 0490083ef1
11 changed files with 72 additions and 60 deletions

View File

@ -1,3 +1,37 @@
1999-12-22 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/buffer.C (getBibkeyList): pass the parameter delim to
InsetInclude::getKeys and InsetBibtex::getKeys.
* src/insets/insetinclude.[Ch] (getKeys): add parameter delim, which
is passed to Buffer::getBibkeyList
* src/insets/insetbib.[Ch] (getKeys): add parameter delim, and use it
instead of the hardcoded comma.
* src/insets/insetbib.C (getKeys): make sure that there are not
leading blanks in bibtex keys. Normal latex does not care, but
harvard.sty seems to dislike blanks at the beginning of citation
keys. In particular, the retturn value of the function is
* INSTALL: make it clear that libstdc++ is needed and that gcc
2.7.x probably does not work.
* src/support/filetools.C (findtexfile): make debug message go to
the LATEX channel
* src/insets/insetbib.C (getKeys): ditto
* src/debug.C (showTags): make sure that the output is correctly
aligned.
* configure.in: add a comment for TWO_COLOR_ICON define.
* acconfig.h: remove all the entries that already defined in
configure.in or acinclude.m4.
* src/buffer.C (makeLaTeXFile): headers of latex file also changed
to avoid user name, date and copyright.
1999-12-21 Juergen Vigna <jug@sad.it> 1999-12-21 Juergen Vigna <jug@sad.it>
* src/table.C (Read): Now read bogus row format informations * src/table.C (Read): Now read bogus row format informations

View File

@ -61,7 +61,13 @@ You will also need a recent C++ compiler, where recent means that the
compilers knows a bit about the C++ standard. Compilers that are known compilers knows a bit about the C++ standard. Compilers that are known
to compile LyX are gcc 2.8.1 and 2.95.x, the various versions of egcs to compile LyX are gcc 2.8.1 and 2.95.x, the various versions of egcs
and Digital C++ version 6.1. Please tell us your experience with other and Digital C++ version 6.1. Please tell us your experience with other
compilers. compilers. It is probably _not_ possible to compile LyX with gcc
2.7.x, but this may change in the future.
Note that, contrary to LyX 1.0.x, LyX 1.1.x makes great use of C++
Standard Template Library (STL); this means that gcc users will have
to install the relevant libstdc++ library to be able to compile this
version.
If you make modifications to files in src/ (for example by applying a If you make modifications to files in src/ (for example by applying a
patch), you will need to have the GNU gettext package installed, due to patch), you will need to have the GNU gettext package installed, due to

View File

@ -17,32 +17,13 @@
@TOP@ @TOP@
/* Define on SunOS 4 and SCO, were some functions are missing from the headers */
#undef BROKEN_HEADERS
/* Define if you want debugging turned on as default. */
#undef DEBUG_AS_DEFAULT
/* Define if you are building a development version of LyX */
#undef DEVEL_VERSION
/* Define to 1 if NLS is requested. */ /* Define to 1 if NLS is requested. */
#undef ENABLE_NLS #undef ENABLE_NLS
/* Define to nothing if your compiler does not understand the
`explicit' directive */
#undef explicit
/* define this to the location of forms.h to be used with #include, /* define this to the location of forms.h to be used with #include,
e.g. <forms.h> */ e.g. <forms.h> */
#undef FORMS_H_LOCATION #undef FORMS_H_LOCATION
/* define this to the location of stl_string_fwd.h to be used with #include,
NOTE: Do not set it to <stl_string_fwd.h> as that will find the LyX
supplied version of the header.
e.g. <../include/stl_string_fwd.h> or better yet use an absolute path */
#undef STL_STRING_FWD_H_LOCATION
/* Define if your locale.h file contains LC_MESSAGES. */ /* Define if your locale.h file contains LC_MESSAGES. */
#undef HAVE_LC_MESSAGES #undef HAVE_LC_MESSAGES
@ -55,25 +36,11 @@
/* Define as 1 if you have the stpcopy function */ /* Define as 1 if you have the stpcopy function */
#undef HAVE_STPCPY #undef HAVE_STPCPY
#if 0 /* define this to the location of stl_string_fwd.h to be used with #include,
/* Define if the bool type is known to your compiler */ NOTE: Do not set it to <stl_string_fwd.h> as that will find the LyX
#undef HAVE_bool supplied version of the header.
#endif e.g. <../include/stl_string_fwd.h> or better yet use an absolute path */
#undef STL_STRING_FWD_H_LOCATION
/* Define to the name of the distribution. */
#undef PACKAGE
/* You might want to define TWO_COLOR_ICONS if you want to spare
your colormap. This will use monochrome icons instead of colored
ones. */
#undef TWO_COLOR_ICONS
/* Define to the version of the distribution. */
#undef VERSION
/* Define this if you want to see the #warning directives put here and
there by the developpers to get attention */
#undef WITH_WARNINGS
/* define this to the location of xpm.h to be used with #include, /* define this to the location of xpm.h to be used with #include,
e.g. <xpm.h> */ e.g. <xpm.h> */

View File

@ -193,7 +193,9 @@ AC_REPLACE_FUNCS(strerror atexit)
### and now some special lyx flags. ### and now some special lyx flags.
AC_ARG_WITH(two-colors,[ --with-two-colors use two color pixmaps], AC_ARG_WITH(two-colors,[ --with-two-colors use two color pixmaps],
[AC_DEFINE(TWO_COLOR_ICONS) [AC_DEFINE(TWO_COLOR_ICONS,1,
[You might want to define TWO_COLOR_ICONS if you want to spare
your colormap. This will use monochrome icons instead of colored ones.])
lyx_flags="$lyx_flags two-colors"]) lyx_flags="$lyx_flags two-colors"])
AC_ARG_ENABLE(assertions, AC_ARG_ENABLE(assertions,
[ --enable-assertions add runtime sanity checks in the program],, [ --enable-assertions add runtime sanity checks in the program],,

View File

@ -1599,12 +1599,9 @@ void Buffer::makeLaTeXFile(string const & fname,
string LFile; string LFile;
if (!only_body && nice) { if (!only_body && nice) {
LFile += "%% This LaTeX-file was created by <"; LFile += "%% " LYX_DOCVERSION " created this file. "
LFile += userName + "> " + date(); "For more info, see http://www.lyx.org/.\n";
LFile += "%% LyX 1.0 (C) 1995-1999 by Matthias Ettrich and the LyX Team\n"; LFile += "%% Do not edit unless you really know what you are doing.\n";
LFile += "\n%% Do not edit this file unless you know what you are doing.\n";
texrow.newline();
texrow.newline();
texrow.newline(); texrow.newline();
texrow.newline(); texrow.newline();
} }
@ -3917,9 +3914,9 @@ string Buffer::getBibkeyList(char delim)
if (inset-> LyxCode() == Inset::BIBTEX_CODE) { if (inset-> LyxCode() == Inset::BIBTEX_CODE) {
if (!bibkeys.empty()) if (!bibkeys.empty())
bibkeys += delim; bibkeys += delim;
bibkeys += static_cast<InsetBibtex*>(inset)->getKeys(); bibkeys += static_cast<InsetBibtex*>(inset)->getKeys(delim);
} else if (inset-> LyxCode() == Inset::INCLUDE_CODE) { } else if (inset-> LyxCode() == Inset::INCLUDE_CODE) {
string bk = static_cast<InsetInclude*>(inset)->getKeys(); string bk = static_cast<InsetInclude*>(inset)->getKeys(delim);
if (!bk.empty()) { if (!bk.empty()) {
if (!bibkeys.empty()) if (!bibkeys.empty())
bibkeys += delim; bibkeys += delim;

View File

@ -14,6 +14,9 @@
#include <config.h> #include <config.h>
#include "debug.h" #include "debug.h"
#include <iomanip>
using std::setw;
struct error_item { struct error_item {
Debug::type level; Debug::type level;
char const * name; char const * name;
@ -85,8 +88,8 @@ void Debug::showLevel(ostream & o, Debug::type level)
void Debug::showTags(ostream & os) void Debug::showTags(ostream & os)
{ {
for (int i = 0 ; i < numErrorTags ; ++i) for (int i = 0 ; i < numErrorTags ; ++i)
os << " " << errorTags[i].level os << setw(5) << errorTags[i].level
<< " " << errorTags[i].name << setw(10) << errorTags[i].name
<< " " << errorTags[i].desc << '\n'; << " " << errorTags[i].desc << '\n';
os.flush(); os.flush();
} }

View File

@ -350,7 +350,7 @@ int InsetBibtex::Latex(string & file, signed char /*fragile*/)
// This method returns a comma separated list of Bibtex entries // This method returns a comma separated list of Bibtex entries
string InsetBibtex::getKeys() string InsetBibtex::getKeys(char delim)
{ {
// This hack is copied from InsetBibtex::Latex. // This hack is copied from InsetBibtex::Latex.
// Is it still needed? Probably yes. // Is it still needed? Probably yes.
@ -364,7 +364,7 @@ string InsetBibtex::getKeys()
while(!tmp.empty()) { while(!tmp.empty()) {
string fil = findtexfile(ChangeExtension(tmp, "bib", false), string fil = findtexfile(ChangeExtension(tmp, "bib", false),
"bib"); "bib");
lyxerr << "Bibfile: " << fil << endl; lyxerr[Debug::LATEX] << "Bibfile: " << fil << endl;
// If we didn't find a matching file name just fail silently // If we didn't find a matching file name just fail silently
if (!fil.empty()) { if (!fil.empty()) {
// This is a _very_ simple parser for Bibtex database // This is a _very_ simple parser for Bibtex database
@ -374,6 +374,7 @@ string InsetBibtex::getKeys()
ifstream ifs(fil.c_str()); ifstream ifs(fil.c_str());
string linebuf; string linebuf;
while (getline(ifs, linebuf)) { while (getline(ifs, linebuf)) {
linebuf = frontStrip(linebuf);
if (prefixIs(linebuf, "@")) { if (prefixIs(linebuf, "@")) {
linebuf = subst(linebuf, '{', '('); linebuf = subst(linebuf, '{', '(');
linebuf = split(linebuf, tmp, '('); linebuf = split(linebuf, tmp, '(');
@ -382,9 +383,10 @@ string InsetBibtex::getKeys()
&& !prefixIs(tmp, "@preamble")) { && !prefixIs(tmp, "@preamble")) {
linebuf = split(linebuf, linebuf = split(linebuf,
tmp, ','); tmp, ',');
tmp = frontStrip(strip(tmp));
if (!tmp.empty()) { if (!tmp.empty()) {
keys += strip(tmp); keys += tmp;
keys += ", "; keys += delim;
} }
} }
} }

View File

@ -115,7 +115,7 @@ public:
/// ///
int Latex(string & file, signed char fragile); int Latex(string & file, signed char fragile);
/// ///
string getKeys(); string getKeys(char delim);
/// ///
unsigned char Editable() const { unsigned char Editable() const {
return 1; return 1;

View File

@ -452,14 +452,14 @@ int InsetInclude::GetNumberOfLabels() const
} }
string InsetInclude::getKeys() const string InsetInclude::getKeys(char delim) const
{ {
string lst; string lst;
if (loadIfNeeded()) { if (loadIfNeeded()) {
Buffer *tmp = bufferlist.getBuffer(getFileName()); Buffer *tmp = bufferlist.getBuffer(getFileName());
tmp->setParentName(""); tmp->setParentName("");
lst = tmp->getBibkeyList(','); lst = tmp->getBibkeyList(delim);
tmp->setParentName(getMasterFilename()); tmp->setParentName(getMasterFilename());
} }

View File

@ -45,7 +45,7 @@ public:
/// This returns the list of labels on the child buffer /// This returns the list of labels on the child buffer
string getLabel(int) const; string getLabel(int) const;
/// This returns the list of bibkeys on the child buffer /// This returns the list of bibkeys on the child buffer
string getKeys() const; string getKeys(char delim) const;
/// ///
void Edit(int, int); void Edit(int, int);
/// ///

View File

@ -1013,7 +1013,8 @@ string findtexfile(string const & fil, string const & format)
string kpsecmd = "kpsewhich --format= " + format + " " + OnlyFilename(fil); string kpsecmd = "kpsewhich --format= " + format + " " + OnlyFilename(fil);
cmdret c = do_popen(kpsecmd); cmdret c = do_popen(kpsecmd);
lyxerr << "kpse status = " << c.first << "\n" lyxerr[Debug::LATEX] << "kpse status = " << c.first << "\n"
<< "kpse result = `" << strip(c.second, '\n') << "'" << endl; << "kpse result = `" << strip(c.second, '\n')
<< "'" << endl;
return c.first != -1 ? strip(c.second, '\n') : string(); return c.first != -1 ? strip(c.second, '\n') : string();
} }