Fix reading of symbols file

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2655 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Dekel Tsur 2001-09-02 13:35:31 +00:00
parent 55d1da0faa
commit f5de290c50
4 changed files with 32 additions and 17 deletions

View File

@ -1,3 +1,7 @@
2001-09-02 Dekel Tsur <dekelts@tau.ac.il>
* Makefile.am (pkgdata_DATA): Add symbols file.
2001-09-01 John Levon <moz@compsoc.man.ac.uk>
* configure:

View File

@ -33,7 +33,7 @@ LIBDISTFILES = $(BIND) $(CLIPART) $(DOCDIST) $(EXAMPLES) $(IMAGES) $(KBD) \
pkgdata_DATA = lyxrc.example CREDITS chkconfig.ltx lyxrc.defaults \
textclass.lst packages.lst external_templates \
encodings languages
encodings languages symbols
LYXLIBDIRS = bind clipart doc examples images kbd layouts scripts \
templates tex ui

View File

@ -1,3 +1,8 @@
2001-09-02 Dekel Tsur <dekelts@tau.ac.il>
* math_hash.C (in_word_set): Initialize symbol table even when
symbols file was not found.
2001-09-02 Angus Leeming <a.leeming@ic.ac.uk>
* math_hash.C: added a using std::endl directive.

View File

@ -154,16 +154,6 @@ bool initialized = false;
void ReadSymbols(string const & filename)
{
for (latexkeys_a * p = wordlist_array; !string(p->name).empty(); ++p) {
latexkeys tmp;
tmp.name = p->name;
tmp.token = p->token;
tmp.id = p->id;
tmp.type = LMB_NONE;
tmp.latex_font_id = 0;
wordlist.push_back(tmp);
}
LyXLex lex(0, 0);
lex.setFile(filename);
while (lex.isOK()) {
@ -209,6 +199,27 @@ void ReadSymbols(string const & filename)
wordlist.push_back(tmp);
}
}
void InitSymbols()
{
for (latexkeys_a * p = wordlist_array; !string(p->name).empty(); ++p) {
latexkeys tmp;
tmp.name = p->name;
tmp.token = p->token;
tmp.id = p->id;
tmp.type = LMB_NONE;
tmp.latex_font_id = 0;
wordlist.push_back(tmp);
}
lyxerr[Debug::MATHED] << "Reading symbols file\n";
string const file = LibFileSearch(string(), "symbols");
if (file.empty())
lyxerr << "Could not find symbols file" << endl;
else
ReadSymbols(file);
std::sort(wordlist.begin(), wordlist.end());
}
@ -217,12 +228,7 @@ void ReadSymbols(string const & filename)
latexkeys const * in_word_set(string const & str)
{
if (!initialized) {
lyxerr[Debug::MATHED] << "Reading symbols file\n";
string const file = LibFileSearch(string(), "symbols");
if (file.empty())
lyxerr << "Could not find symbols file" << endl;
else
ReadSymbols(file);
InitSymbols();
initialized = true;
}