Fix the lyxformat problem + other small things. Are we ready for 1.1.5fix2?

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/lyx-1_1_5@1081 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2000-10-04 14:19:07 +00:00
parent 62a50191cc
commit 40b1da348c
8 changed files with 82 additions and 31 deletions

View File

@ -1,5 +1,20 @@
2000-10-04 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr> 2000-10-04 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* src/lyxlex.C (GetFloat): rewrite to use strToDbl() and
understand ',' instead of '.'.
(GetInteger): rewrite to use strToInt().
* src/buffer.C (readFile): make sure that the whole version number
is read after \lyxformat (even when it contains a comma)
* lib/layouts/revtex4.layout: update from Amir Karger.
* lib/layouts/amsart.layout: include lyxmacros.inc, so that
LyX-Code is defined.
* lib/layouts/amsbook.layout: ditto.
* src/main.C (main): set locale LC_NUMERIC to "C".
* src/support/lstrings.[Ch]: add isStrDbl and StrToDbl that I * src/support/lstrings.[Ch]: add isStrDbl and StrToDbl that I
forgot earlier :( forgot earlier :(

View File

@ -82,7 +82,7 @@ LYX_CXX_CHEADERS
LYX_STD_COUNT LYX_STD_COUNT
dnl we disable rtti for now dnl we disable rtti for now
dnl LYX_CXX_RTTI dnl LYX_CXX_RTTI
AC_CHECK_HEADERS(ostream istream sstream) AC_CHECK_HEADERS(ostream istream sstream locale)
LYX_CXX_STL_MODERN_STREAMS LYX_CXX_STL_MODERN_STREAMS
### We need a regex implementation, so we provide our own if none is found. ### We need a regex implementation, so we provide our own if none is found.

View File

@ -99,7 +99,7 @@ NoStyle Verse # Although mathematicians tend to be poets at times,
Input stdlists.inc Input stdlists.inc
Input lyxmacros.inc
### Finally a few obsolete definitions for compatibility ### Finally a few obsolete definitions for compatibility
Input obsolete.inc Input obsolete.inc

View File

@ -128,6 +128,8 @@ Style Chapter_Exercises
End End
Input lyxmacros.inc
### Finally a few obsolete definitions for compatibility ### Finally a few obsolete definitions for compatibility
Input obsolete.inc Input obsolete.inc

View File

@ -6,14 +6,8 @@
# paper "testmath.tex" of January, 1995 # paper "testmath.tex" of January, 1995
# Author : David L. Johnson <dlj0@lehigh.edu> (AMS) # Author : David L. Johnson <dlj0@lehigh.edu> (AMS)
# Marc Mengel (RevTeX) # Marc Mengel (RevTeX)
# Amir Karger (LyX v11.34 style modifications - using changes # Amir Karger (LyX v11.34 style modifications)
# made by Jean-Marc Lasgouttes to amsart.layout) # Amir Karger (RevTeX 4 beta) 9/1999, 7/2000
# Amir Karger (RevTeX 4 beta) 9/1999
#TODO: need to make a thanks layout and write note in template not to
#put footnotes in the title matter!
#TODO: examine this issue that it seems you need to put the address last or you
#get errors (seems to happen even when not using lyx...)
# General textclass parameters # General textclass parameters
Columns 1 Columns 1
@ -152,40 +146,40 @@ Style Date
EndFont EndFont
End End
# Address style definition Style Affiliation
# (This style is same as Afilliation for Phys. Rev.)
Style Address
Margin Dynamic Margin Dynamic
LatexType Command LatexType Command
InTitle 1 InTitle 1
LatexName address LatexName affiliation
ParSkip 0.4 ParSkip 0.4
# BottomSep 1.5 # BottomSep 1.5
# ParSep 1.5 # ParSep 1.5
Align Center Align Center
AlignPossible Block, Left, Right, Center AlignPossible Block, Left, Right, Center
LabelType Static LabelType Static
LabelString "Address: " LabelString "Affiliation: "
LabelFont LabelFont
Shape Italic Shape Italic
EndFont EndFont
End End
Style Affiliation # Address is exactly the same as Affiliation. We just put this in so
CopyStyle Address # that reLyX will know what to do with it.
LatexName affiliation Style Address
LabelString "Affiliation: " CopyStyle Affiliation
LatexName address
LabelString "Address: "
End End
Style Thanks Style Thanks
CopyStyle Address CopyStyle Affiliation
LatexName thanks LatexName thanks
LabelString "Thanks: " LabelString "Thanks: "
End End
Style Author_Email Style Author_Email
CopyStyle Address CopyStyle Affiliation
LatexName email LatexName email
LabelString "Electronic Address: " LabelString "Electronic Address: "
@ -215,6 +209,25 @@ Style Abstract
EndFont EndFont
End End
Style Acknowledgments
LatexType Environment
LatexName acknowledgments
ParIndent MM
ParSkip 0.4
Align Block
AlignPossible Block, Left, Right, Center
# label definition
LabelType Centered_Top_Environment
LabelString acknowledgments
LabelBottomSep 0.5
LabelFont
Series Medium
Shape Smallcaps
Size Large
EndFont
End
Style PACS Style PACS
Margin Dynamic Margin Dynamic
LatexType Command LatexType Command

View File

@ -24,6 +24,10 @@
#include <algorithm> #include <algorithm>
#ifdef HAVE_LOCALE
#include <locale>
#endif
#ifdef __GNUG__ #ifdef __GNUG__
#pragma implementation "buffer.h" #pragma implementation "buffer.h"
#endif #endif
@ -1085,7 +1089,7 @@ bool Buffer::readFile(LyXLex & lex, LyXParagraph * par)
lex.next(); lex.next();
token = lex.GetString(); token = lex.GetString();
if (token == "\\lyxformat") { // the first token _must_ be... if (token == "\\lyxformat") { // the first token _must_ be...
lex.next(); lex.EatLine();
format = lex.GetFloat(); format = lex.GetFloat();
if (format > 1) { if (format > 1) {
if (LYX_FORMAT - format > 0.05) { if (LYX_FORMAT - format > 0.05) {
@ -1259,6 +1263,12 @@ bool Buffer::writeFile(string const & fname, bool flag) const
fname); fname);
return false; return false;
} }
#ifdef HAVE_LOCALE
// Use the standard "C" locale for file output.
ofs.imbue(locale::classic());
#endif
// The top of the file should not be written by params. // The top of the file should not be written by params.
// write out a comment in the top of the file // write out a comment in the top of the file
@ -1266,7 +1276,13 @@ bool Buffer::writeFile(string const & fname, bool flag) const
<< " created this file. For more info see http://www.lyx.org/\n"; << " created this file. For more info see http://www.lyx.org/\n";
ofs.setf(ios::showpoint|ios::fixed); ofs.setf(ios::showpoint|ios::fixed);
ofs.precision(2); ofs.precision(2);
#ifndef HAVE_LOCALE
char dummy_format[512];
sprintf(dummy_format, "%.2f", LYX_FORMAT);
ofs << "\\lyxformat " << dummy_format << "\n";
#else
ofs << "\\lyxformat " << setw(4) << LYX_FORMAT << "\n"; ofs << "\\lyxformat " << setw(4) << LYX_FORMAT << "\n";
#endif
// now write out the buffer paramters. // now write out the buffer paramters.
params.writeFile(ofs); params.writeFile(ofs);

View File

@ -103,8 +103,8 @@ int LyXLex::lex()
int LyXLex::GetInteger() const int LyXLex::GetInteger() const
{ {
if (pimpl_->buff[0] > ' ') if (isStrInt(pimpl_->GetString()))
return atoi(pimpl_->buff); return strToInt(pimpl_->GetString());
else { else {
pimpl_->printError("Bad integer `$$Token'"); pimpl_->printError("Bad integer `$$Token'");
return -1; return -1;
@ -114,12 +114,16 @@ int LyXLex::GetInteger() const
float LyXLex::GetFloat() const float LyXLex::GetFloat() const
{ {
if (pimpl_->buff[0] > ' ') // replace comma with dot in case the file was written with
return atof(pimpl_->buff); // the wrong locale (should be rare, but is easy enough to
else { // avoid).
pimpl_->printError("Bad float `$$Token'"); string str = subst(pimpl_->GetString(), ",", ".");
return -1; if (isStrDbl(str))
} return strToDbl(str);
else {
pimpl_->printError("Bad float `$$Token'");
return -1;
}
} }

View File

@ -66,6 +66,7 @@ int main(int argc, char * argv[])
// initialize for internationalized version *EK* // initialize for internationalized version *EK*
locale_init(); locale_init();
setlocale(LC_NUMERIC, "C");
gettext_init(); gettext_init();
#ifdef __EMX__ #ifdef __EMX__