use anon namespace, somewhat better comp. handling of minipages, not quite there yet

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1795 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2001-03-20 01:22:46 +00:00
parent 14c60d0aae
commit fc8465aa1f
94 changed files with 83209 additions and 67971 deletions

View File

@ -74,67 +74,67 @@ src/frontends/qt2/paragraphdlgimpl.C
src/frontends/qt2/tabularcreatedlgimpl.C
src/frontends/xforms/combox.C
src/frontends/xforms/FileDialog.C
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/form_bibitem.C
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/FormBibitem.C
src/frontends/xforms/form_bibtex.C
src/frontends/xforms/FormBibtex.C
src/frontends/xforms/form_browser.C
src/frontends/xforms/FormCharacter.C
src/frontends/xforms/form_character.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/FormCharacter.C
src/frontends/xforms/form_citation.C
src/frontends/xforms/FormCopyright.C
src/frontends/xforms/FormCitation.C
src/frontends/xforms/form_copyright.C
src/frontends/xforms/FormCredits.C
src/frontends/xforms/FormCopyright.C
src/frontends/xforms/form_credits.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormCredits.C
src/frontends/xforms/form_document.C
src/frontends/xforms/FormError.C
src/frontends/xforms/FormDocument.C
src/frontends/xforms/form_error.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/FormError.C
src/frontends/xforms/form_external.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/FormExternal.C
src/frontends/xforms/form_filedialog.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/FormFiledialog.C
src/frontends/xforms/form_graphics.C
src/frontends/xforms/FormInclude.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/form_include.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormInclude.C
src/frontends/xforms/form_index.C
src/frontends/xforms/FormIndex.C
src/frontends/xforms/FormLog.C
src/frontends/xforms/FormMathsBitmap.C
src/frontends/xforms/FormMathsDeco.C
src/frontends/xforms/form_maths_deco.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/FormMathsDeco.C
src/frontends/xforms/form_maths_delim.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/FormMathsDelim.C
src/frontends/xforms/form_maths_matrix.C
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/FormMathsMatrix.C
src/frontends/xforms/form_maths_panel.C
src/frontends/xforms/FormMathsSpace.C
src/frontends/xforms/FormMathsPanel.C
src/frontends/xforms/form_maths_space.C
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/FormMathsSpace.C
src/frontends/xforms/form_minipage.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/FormMinipage.C
src/frontends/xforms/form_paragraph.C
src/frontends/xforms/FormPreamble.C
src/frontends/xforms/FormParagraph.C
src/frontends/xforms/form_preamble.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/FormPreamble.C
src/frontends/xforms/form_preferences.C
src/frontends/xforms/FormPrint.C
src/frontends/xforms/FormPreferences.C
src/frontends/xforms/form_print.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/FormPrint.C
src/frontends/xforms/form_ref.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/FormRef.C
src/frontends/xforms/form_search.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/FormSearch.C
src/frontends/xforms/form_tabular.C
src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/FormTabular.C
src/frontends/xforms/form_tabular_create.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/FormTabularCreate.C
src/frontends/xforms/form_toc.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormToc.C
src/frontends/xforms/form_url.C
src/frontends/xforms/FormUrl.C
src/frontends/xforms/FormVCLog.C
src/frontends/xforms/input_validators.C
src/frontends/xforms/Menubar_pimpl.C

7758
po/ca.po

File diff suppressed because it is too large Load Diff

7751
po/cs.po

File diff suppressed because it is too large Load Diff

6448
po/da.po

File diff suppressed because it is too large Load Diff

6131
po/de.po

File diff suppressed because it is too large Load Diff

6178
po/es.po

File diff suppressed because it is too large Load Diff

7753
po/eu.po

File diff suppressed because it is too large Load Diff

3193
po/fi.po

File diff suppressed because it is too large Load Diff

7614
po/fr.po

File diff suppressed because it is too large Load Diff

6831
po/he.po

File diff suppressed because it is too large Load Diff

7539
po/hu.po

File diff suppressed because it is too large Load Diff

7765
po/it.po

File diff suppressed because it is too large Load Diff

7768
po/nl.po

File diff suppressed because it is too large Load Diff

6820
po/no.po

File diff suppressed because it is too large Load Diff

6613
po/pl.po

File diff suppressed because it is too large Load Diff

7793
po/pt.po

File diff suppressed because it is too large Load Diff

7498
po/ro.po

File diff suppressed because it is too large Load Diff

7637
po/ru.po

File diff suppressed because it is too large Load Diff

7776
po/sl.po

File diff suppressed because it is too large Load Diff

7755
po/sv.po

File diff suppressed because it is too large Load Diff

7769
po/tr.po

File diff suppressed because it is too large Load Diff

7660
po/wa.po

File diff suppressed because it is too large Load Diff

View File

@ -82,7 +82,6 @@ const unsigned int saved_positions_num = 20;
namespace {
//static
inline
void waitForX()
{
@ -90,7 +89,6 @@ void waitForX()
}
//static
void SetXtermCursor(Window win)
{
static Cursor cursor;

View File

@ -1,5 +1,22 @@
2001-03-20 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* buffer.C (parseSingleLyXformat2Token): Try to give a bit better
response on compability reading of minipages. One probliem is that
the old usage of minipages was «flertydig»
* several files here and in subdirs: don't use static at file
scope use anon namespaces instead.
2001-03-19 Kayvan A. Sylvan <kayvan@sylvan.com>
* paragraph.C (TeXEnvironment): Added \n to \end{environment}
LaTeX output. This is necessary for Literate document
processing.
2001-03-17 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* buffer.C: insert hfill when needed.
* tabular.C (l_getline): use string::erase, small whitespace change.
* BufferView_pimpl.C: try the anon namespace.

View File

@ -44,14 +44,15 @@ extern BufferView * current_view;
// then do a middle mouse button click in the application you want and have
// the whole formula there in LaTeX-Code. (Jug)
static LyXParagraph * buf = 0;
static LyXTextClassList::size_type textclass = 0;
namespace {
LyXParagraph * buf = 0;
LyXTextClassList::size_type textclass = 0;
// for now here this should be in another Cut&Paste Class!
// Jürgen, I moved this out of CutAndPaste since it does not operate on any
// member of the CutAndPaste class and in addition it was private.
// Perhaps it even should take a parameter? (Lgb)
static
void DeleteBuffer()
{
if (!buf)
@ -71,6 +72,7 @@ void DeleteBuffer()
buf = 0;
}
} // namespace anon
bool CutAndPaste::cutSelection(LyXParagraph * startpar, LyXParagraph ** endpar,
int start, int & end, char tc, bool doclear)

View File

@ -205,8 +205,12 @@ void FontLoader::getFontinfo(LyXFont::FONT_FAMILY family,
// A dummy fontstruct used when there is no gui.
static XFontStruct dummyXFontStruct;
static bool dummyXFontStructisGood = false;
namespace {
XFontStruct dummyXFontStruct;
bool dummyXFontStructisGood = false;
} // namespace anon
/// Do load font
XFontStruct * FontLoader::doLoad(LyXFont::FONT_FAMILY family,

View File

@ -12,7 +12,7 @@
/// Share objects between several users.
/**
This class can be used to reduce memory consuption when you have a lot
of equal objects used all over you code.
of equal objects used all over your code.
\author Lars Gullik Bjønnes
*/
@ -60,7 +60,7 @@ private:
private:
Share const & p_;
};
/// A functor returning true if the element is unque.
/// A functor returning true if the element is unique.
struct isUnique {
bool operator()(value_type const & p) const {
return p.unique();

View File

@ -22,8 +22,11 @@ using std::ios;
using std::ostream;
/// how can I put this inside of Spacing (class)
static
char const * spacing_string[] = {"single", "onehalf", "double", "other"};
namespace {
char const * const spacing_string[] = {"single", "onehalf", "double", "other"};
} // namespace anon
float Spacing::getValue() const

View File

@ -35,7 +35,6 @@ FL_OBJECT * figinset_canvas;
namespace {
//static
inline
void waitForX()
{
@ -482,11 +481,12 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
}
static string clipboard_selection;
static bool clipboard_read = false;
namespace {
extern "C" {
static
string clipboard_selection;
bool clipboard_read = false;
extern "C"
int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
void const * data, long size)
{
@ -499,8 +499,8 @@ int request_clipboard_cb(FL_OBJECT * /*ob*/, long /*type*/,
clipboard_read = true;
return 0;
}
} // extern "C"
} // namespace anon
string const WorkArea::getClipboard() const
{

View File

@ -117,8 +117,11 @@ extern BufferList bufferlist;
extern LyXAction lyxaction;
namespace {
static const int LYX_FORMAT = 218;
const int LYX_FORMAT = 218;
} // namespace anon
extern int tex_code_break_column;
@ -352,7 +355,11 @@ bool Buffer::readLyXformat2(LyXLex & lex, LyXParagraph * par)
// We'll remove this later. (Lgb)
static string last_inset_read;
namespace {
string last_inset_read;
} // anon
bool
@ -515,6 +522,10 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
string pextraWidth = minipar->params.pextraWidth();
string pextraWidthp = minipar->params.pextraWidthp();
bool pextraHfill = minipar->params.pextraHfill();
#if 1
bool startNew = minipar->params.pextraStartMinipage();
#endif
LyXParagraph * tmp = minipar;
while (tmp) {
tmp->params.pextraType(0);
@ -531,10 +542,34 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
mini->width(pextraWidth);
mini->widthp(pextraWidthp);
mini->inset->par = minipar;
#if 1
if (!startNew || !pextraHfill) {
// To minimize problems for
// the users we will insert
// the first minipage in
// a sequence of minipages
// in its own paragraph.
LyXParagraph * p = new LyXParagraph;
p->layout = 0;
// Insert this after par->prev, but
// before par.
p->previous(par->previous());
p->next(par);
par->previous()->next(p);
par->previous(p);
}
#endif
// Insert the minipage last in the
// previous paragraph.
par->previous()->InsertInset(par->previous()->size(), mini);
#warning insert a hfill-character here if pextraHfill == true
LyXParagraph * prev = par->previous();
if (pextraHfill) {
prev->InsertChar(prev->size(),
LyXParagraph::META_HFILL);
}
prev->InsertInset(prev->size(), mini);
minipar = par;
} else {
lyxerr << "new minipage par" << endl;
@ -577,6 +612,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
string pextraWidth = minipar->params.pextraWidth();
string pextraWidthp = minipar->params.pextraWidthp();
bool pextraHfill = minipar->params.pextraHfill();
#if 1
bool startNew = minipar->params.pextraStartMinipage();
#endif
LyXParagraph * tmp = minipar;
while (tmp) {
tmp->params.pextraType(0);
@ -593,8 +631,31 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, LyXParagraph *& par,
mini->width(pextraWidth);
mini->widthp(pextraWidthp);
mini->inset->par = minipar;
par->previous()->InsertInset(par->previous()->size(), mini);
#warning insert a hfill-character here if pextraHfill == true
#if 1
if (!startNew || !pextraHfill) {
// To minimize problems for the users
// we will insert the first minipage
// in a sequence of minipages in its
// own paragraph.
LyXParagraph * p = new LyXParagraph;
p->layout = 0;
// Insert this after par->prev, but
// before par.
p->previous(par->previous());
p->next(par);
par->previous()->next(p);
par->previous(p);
}
#endif
LyXParagraph * prev = par->previous();
if (pextraHfill) {
prev->InsertChar(prev->size(),
LyXParagraph::META_HFILL);
}
prev->InsertInset(prev->size(), mini);
minipar = 0;
} else if (par->params.pextraType() == LyXParagraph::PEXTRA_MINIPAGE) {
@ -2833,7 +2894,8 @@ void Buffer::pop_tag(ostream & os, string const & tag,
// checks, if newcol chars should be put into this line
// writes newline, if necessary.
static
namespace {
void linux_doc_line_break(ostream & os, string::size_type & colcount,
string::size_type newcol)
{
@ -2844,6 +2906,8 @@ void linux_doc_line_break(ostream & os, string::size_type & colcount,
}
}
} // namespace anon
void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
int desc_on, int /*depth*/)

View File

@ -38,13 +38,15 @@ using std::find_if;
using std::reverse;
using std::sort;
static string const token_from("$$i");
static string const token_base("$$b");
static string const token_to("$$o");
namespace {
string const token_from("$$i");
string const token_base("$$b");
string const token_to("$$o");
//////////////////////////////////////////////////////////////////////////////
static inline
inline
string const add_options(string const & command, string const & options)
{
string head;
@ -52,6 +54,8 @@ string const add_options(string const & command, string const & options)
return head + ' ' + options + ' ' + tail;
}
} // namespace anon
//////////////////////////////////////////////////////////////////////////////
bool Format::dummy() const

View File

@ -22,13 +22,16 @@ using std::ostream;
using std::setw;
using std::endl;
namespace {
struct error_item {
Debug::type level;
char const * name;
char const * desc;
};
static error_item errorTags[] = {
error_item errorTags[] = {
{ Debug::NONE, "none", N_("No debugging message")},
{ Debug::INFO, "info", N_("General information")},
{ Debug::INIT, "init", N_("Program initialisation")},
@ -53,7 +56,9 @@ static error_item errorTags[] = {
};
static const int numErrorTags = sizeof(errorTags)/sizeof(error_item);
int const numErrorTags = sizeof(errorTags)/sizeof(error_item);
} // namespace anon
Debug::type const Debug::ANY = Debug::type(

View File

@ -21,7 +21,8 @@ using std::endl;
Encodings encodings;
static
namespace {
Uchar tab_iso8859_1[256] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
@ -42,7 +43,6 @@ Uchar tab_iso8859_1[256] = {
};
#ifdef USE_UNICODE_FOR_SYMBOLS
static
Uchar tab_symbol[256] = {
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f,
0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f,
@ -96,7 +96,6 @@ Uchar tab_symbol[256] = {
#endif
static
unsigned char arabic_table2[63][4] = {
{0x41, 0x41, 0x41, 0x41}, // 0xc1 = hamza
{0x42, 0xa1, 0x42, 0x42}, // 0xc2 = ligature madda on alef
@ -167,7 +166,6 @@ unsigned char arabic_table2[63][4] = {
};
static
unsigned char arabic_table[63][2] = {
{0xc1, 0xc1}, // 0xc1 = hamza
{0xc2, 0xc2}, // 0xc2 = ligature madda on alef
@ -238,6 +236,11 @@ unsigned char arabic_table[63][2] = {
};
unsigned char const arabic_start = 0xc1;
} // namespace anon
bool Encodings::IsComposeChar_hebrew(unsigned char c)
{
return c <= 0xd2 && c >= 0xc0 &&
@ -251,10 +254,6 @@ bool Encodings::IsComposeChar_arabic(unsigned char c)
}
static
unsigned char const arabic_start = 0xc1;
bool Encodings::is_arabic(unsigned char c)
{
return c >= arabic_start && arabic_table[c-arabic_start][0];

View File

@ -21,8 +21,9 @@
#include "lyxrc.h"
#include "encoding.h"
// namespace {
static inline
namespace {
inline
XFontStruct * getXFontstruct(LyXFont const & f)
{
return fontloader.load(f.family(), f.series(),
@ -30,12 +31,13 @@ XFontStruct * getXFontstruct(LyXFont const & f)
}
static inline
inline
XID getFontID(LyXFont const & f)
{
return getXFontstruct(f)->fid;
}
// } // end of anon namespace
} // namespace anon
int lyxfont::maxAscent(LyXFont const & f)
{

View File

@ -24,7 +24,9 @@
using std::endl;
/// Helper function
static inline
namespace {
inline
void nextState(ButtonPolicy::State & state,
ButtonPolicy::SMInput in,
ButtonPolicy::StateMachine const & s_m,
@ -43,6 +45,8 @@ void nextState(ButtonPolicy::State & state,
}
}
} // namespace anon
/*-----------------------------PreferencesPolicy-----------------------------*/

View File

@ -23,8 +23,10 @@
using std::endl;
namespace {
/// Helper function
static inline
inline
void nextState(ButtonPolicy::State & state,
ButtonPolicy::SMInput in,
ButtonPolicy::StateMachine const & s_m,
@ -45,6 +47,8 @@ void nextState(ButtonPolicy::State & state,
}
}
} // namespace anon
/*-----------------------------PreferencesPolicy-----------------------------*/

View File

@ -49,20 +49,25 @@ using std::max;
using std::min;
using std::find;
namespace {
// configuration keys
static string const LOCAL_CONFIGURE_PREFIX("FormCitation");
string const LOCAL_CONFIGURE_PREFIX("FormCitation");
static string const CONF_PANE_INFO("paneinfo");
static string const CONF_PANE_INFO_DEFAULT("=300");
string const CONF_PANE_INFO("paneinfo");
string const CONF_PANE_INFO_DEFAULT("=300");
static string const CONF_COLUMN("column");
static string const CONF_COLUMN_DEFAULT("=50");
string const CONF_COLUMN("column");
string const CONF_COLUMN_DEFAULT("=50");
static string const CONF_REGEXP("regexp");
static string const CONF_REGEXP_DEFAULT("=0");
string const CONF_REGEXP("regexp");
string const CONF_REGEXP_DEFAULT("=0");
string const CONF_SEARCH("FormCitation_search");
string const CONF_TEXTAFTER("FormCitation_textafter");
} // namespace anon
static string const CONF_SEARCH("FormCitation_search");
static string const CONF_TEXTAFTER("FormCitation_textafter");
FormCitation::FormCitation(LyXView * lv, Dialogs * d)
: lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0)
@ -110,7 +115,8 @@ void FormCitation::createInset( string const & arg )
}
static
namespace {
void parseBibTeX(string const & dat,
string const & findkey,
string & keyvalue)
@ -203,6 +209,8 @@ void parseBibTeX(string const & dat,
}
}
} // namespace anon
void FormCitation::cleanupWidgets()
{

View File

@ -42,8 +42,13 @@
#include "mainapp.h"
extern GLyxAppWin * mainAppWin;
namespace {
// configuration keys
static string const CONF_ENTRY("FormIndex_entry");
string const CONF_ENTRY("FormIndex_entry");
} // namespace anon
FormIndex::FormIndex(LyXView * lv, Dialogs * d)
: lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(0)

View File

@ -39,12 +39,17 @@
#include "mainapp.h"
extern GLyxAppWin * mainAppWin;
namespace anon {
// configuration keys
static string const CONF_ENTRY_NAME("FormRef_name");
string const CONF_ENTRY_NAME("FormRef_name");
// goto button labels
static string const GOTO_REF_LABEL(N_("Goto reference"));
static string const GOTO_BACK_LABEL(N_("Go back"));
string const GOTO_REF_LABEL(N_("Goto reference"));
string const GOTO_BACK_LABEL(N_("Go back"));
} // namespace anon
FormRef::FormRef(LyXView * lv, Dialogs * d)
: lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(0)

View File

@ -34,9 +34,14 @@
#include "mainapp.h"
extern GLyxAppWin * mainAppWin;
namespace {
// configuration keys
static string const CONF_ENTRY_URL("FormUrl_url");
static string const CONF_ENTRY_NAME("FormUrl_name");
string const CONF_ENTRY_URL("FormUrl_url");
string const CONF_ENTRY_NAME("FormUrl_name");
} // namespace anon
FormUrl::FormUrl(LyXView * lv, Dialogs * d)
: lv_(lv), d_(d), inset_(0), u_(0), h_(0), ih_(0), dialog_(0)

View File

@ -33,7 +33,12 @@ using std::endl;
extern bool finished;
static int const xforms_include_version = FL_INCLUDE_VERSION;
namespace {
int const xforms_include_version = FL_INCLUDE_VERSION;
} // namespace anon
GLyxAppWin * mainAppWin;
int GUIRunTime::initApplication(int, char * argv[])

View File

@ -31,7 +31,12 @@ using std::endl;
extern bool finished;
static int const xforms_include_version = FL_INCLUDE_VERSION;
namespace {
int const xforms_include_version = FL_INCLUDE_VERSION;
} // namespace anon
int GUIRunTime::initApplication(int argc, char * argv[])
{

View File

@ -34,7 +34,12 @@ using std::endl;
extern bool finished;
static int const xforms_include_version = FL_INCLUDE_VERSION;
namespace {
int const xforms_include_version = FL_INCLUDE_VERSION;
} // namespace anon
int GUIRunTime::initApplication(int argc, char * argv[])
{

View File

@ -25,7 +25,11 @@
using std::max;
using std::min;
static int const nohue = -1;
namespace {
int const nohue = -1;
} // namespace anon
RGBColor::RGBColor(HSVColor const & hsv)
{

View File

@ -87,13 +87,17 @@ void FormBase::InputCB(FL_OBJECT * ob, long data)
}
static FormBase * GetForm(FL_OBJECT * ob)
namespace {
FormBase * GetForm(FL_OBJECT * ob)
{
Assert(ob && ob->form && ob->form->u_vdata);
FormBase * pre = static_cast<FormBase *>(ob->form->u_vdata);
return pre;
}
} // namespace anon
extern "C" int C_FormBaseWMHideCB(FL_FORM * form, void *)
{

View File

@ -71,9 +71,15 @@ extern "C" int gettimeofday(struct timeval *, struct timezone *);
#include "support/filetools.h"
#include "FormFiledialog.h"
namespace {
// six months, in seconds
static const long SIX_MONTH_SEC = 6L * 30L * 24L * 60L * 60L;
static const long ONE_HOUR_SEC = 60L * 60L;
long const SIX_MONTH_SEC = 6L * 30L * 24L * 60L * 60L;
//static
long const ONE_HOUR_SEC = 60L * 60L;
} // namespace anon
// *** User cache class implementation
/// User cache class definition
@ -156,9 +162,13 @@ void GroupCache::add(gid_t ID) const
}
// static instances
static UserCache lyxUserCache;
static GroupCache lyxGroupCache;
namespace {
// local instances
UserCache lyxUserCache;
GroupCache lyxGroupCache;
} // namespace anon
// compares two LyXDirEntry objects content (used for sort)

View File

@ -25,9 +25,13 @@
#include "FormMathsBitmap.h"
#include "FormMathsDeco.h"
#include "form_maths_deco.h"
#include "FormMathsDelim.h"
#include "form_maths_delim.h"
#include "FormMathsMatrix.h"
#include "form_maths_matrix.h"
#include "FormMathsSpace.h"
#include "form_maths_space.h"
#include "deco.xpm"
#include "delim.xpm"
@ -57,38 +61,40 @@ FormMathsPanel::FormMathsPanel(LyXView * lv, Dialogs * d)
matrix_.reset(new FormMathsMatrix(lv, d, *this));
space_.reset( new FormMathsSpace( lv, d, *this));
vector<string> latex(nr_latex_arrow);
for (int i = 0; i<latex.size(); ++i) {
typedef vector<string> StringVec;
StringVec latex(nr_latex_arrow);
for (StringVec::size_type i = 0; i < latex.size(); ++i) {
latex[i] = latex_arrow[i];
}
arrow_.reset(new FormMathsBitmap(lv, d, *this, latex));
latex.resize(nr_latex_bop);
for (int i = 0; i<latex.size(); ++i) {
for (StringVec::size_type i = 0; i < latex.size(); ++i) {
latex[i] = latex_bop[i];
}
boperator_.reset(new FormMathsBitmap(lv, d, *this, latex));
latex.resize(nr_latex_brel);
for (int i = 0; i<latex.size(); ++i) {
for (StringVec::size_type i = 0; i<latex.size(); ++i) {
latex[i] = latex_brel[i];
}
brelats_.reset(new FormMathsBitmap(lv, d, *this, latex));
latex.resize(nr_latex_greek);
for (int i = 0; i<latex.size(); ++i) {
for (StringVec::size_type i = 0; i < latex.size(); ++i) {
latex[i] = latex_greek[i];
}
greek_.reset(new FormMathsBitmap(lv, d, *this, latex));
latex.resize(nr_latex_misc);
for (int i = 0; i<latex.size(); ++i) {
for (StringVec::size_type i = 0; i<latex.size(); ++i) {
latex[i] = latex_misc[i];
}
misc_.reset(new FormMathsBitmap(lv, d, *this, latex));
latex.resize(nr_latex_varsz);
for (int i = 0; i<latex.size(); ++i) {
for (StringVec::size_type i = 0; i<latex.size(); ++i) {
latex[i] = latex_varsz[i];
}
varsize_.reset(new FormMathsBitmap(lv, d, *this, latex));
@ -256,7 +262,7 @@ void FormMathsPanel::mathDisplay() const
FormMathsSub::FormMathsSub(LyXView * lv, Dialogs * d, FormMathsPanel const & p,
string const & t)
: parent_(p), FormBaseBD(lv, d, t)
: FormBaseBD(lv, d, t), parent_(p)
{}

View File

@ -58,9 +58,14 @@ extern string system_lyxdir;
extern string user_lyxdir;
extern Languages languages;
namespace {
// These should probably go inside the class definition...
static Formats local_formats;
static Converters local_converters;
Formats local_formats;
Converters local_converters;
} // namespace anon
FormPreferences::FormPreferences(LyXView * lv, Dialogs * d)
: FormBaseBI(lv, d, _("Preferences")),

View File

@ -30,7 +30,12 @@ using std::endl;
extern bool finished;
static int const xforms_include_version = FL_INCLUDE_VERSION;
namespace {
int const xforms_include_version = FL_INCLUDE_VERSION;
} // namespace anon
int GUIRunTime::initApplication(int , char **)
{

View File

@ -37,30 +37,27 @@ typedef vector<int>::size_type size_type;
extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
extern LyXAction lyxaction;
namespace {
// Some constants
static const int MENU_LABEL_SIZE = FL_NORMAL_SIZE;
static const int mheight = 30;
static const int mbheight= 22;
const int MENU_LABEL_SIZE = FL_NORMAL_SIZE;
const int mheight = 30;
const int mbheight= 22;
// where to place the menubar?
static const int yloc = (mheight - mbheight)/2; //air + bw;
static const int mbadd = 20; // menu button add (to width)
const int yloc = (mheight - mbheight)/2; //air + bw;
const int mbadd = 20; // menu button add (to width)
// Some space between buttons on the menubar
static const int air = 2;
static char const * menu_tabstop = "aa";
static char const * default_tabstop = "aaaaaaaa";
const int air = 2;
char const * menu_tabstop = "aa";
char const * default_tabstop = "aaaaaaaa";
// We do not want to mix position values in a menu (like the index of
// a submenu) with the action numbers which convey actual information.
// Therefore we offset all the action values by an arbitrary large
// constant.
static const int action_offset = 1000;
//Defined later, used in makeMenubar().
extern "C"
void C_Menubar_Pimpl_MenuCallback(FL_OBJECT * ob, long button);
const int action_offset = 1000;
// This is used a few times below.
static inline
inline
int string_width(string const & str)
{
return fl_get_string_widthTAB(FL_NORMAL_STYLE, MENU_LABEL_SIZE,
@ -68,6 +65,13 @@ int string_width(string const & str)
static_cast<int>(str.length()));
}
} // namespace anon
//Defined later, used in makeMenubar().
extern "C"
void C_Menubar_Pimpl_MenuCallback(FL_OBJECT * ob, long button);
Menubar::Pimpl::Pimpl(LyXView * view, MenuBackend const & mb)
: owner_(view), menubackend_(&mb), current_group_(0)
@ -185,7 +189,9 @@ void Menubar::Pimpl::openByName(string const & name)
}
static inline
namespace {
inline
string const limit_string_length(string const & str)
{
string::size_type const max_item_length = 45;
@ -197,7 +203,6 @@ string const limit_string_length(string const & str)
}
static
int get_new_submenu(vector<int> & smn, Window win)
{
static size_type max_number_of_menus = 32;
@ -212,7 +217,7 @@ int get_new_submenu(vector<int> & smn, Window win)
size_type const max_number_of_items = 25;
static inline
inline
string const fixlabel(string const & str)
{
#if FL_REVISION < 89
@ -222,6 +227,8 @@ string const fixlabel(string const & str)
#endif
}
} // namespace anon
void add_toc2(int menu, string const & extra_label,
vector<int> & smn, Window win,

View File

@ -20,15 +20,17 @@
using std::endl;
extern "C" {
static
void C_intern_timeout_cb(int, void * data)
{
Timeout * to = static_cast<Timeout *>(data);
to->emit();
}
namespace {
extern "C"
void C_intern_timeout_cb(int, void * data)
{
Timeout * to = static_cast<Timeout *>(data);
to->emit();
}
} // namespace anon
Timeout::Pimpl::Pimpl(Timeout * owner)
: owner_(owner), timeout_id(-1)

View File

@ -89,9 +89,10 @@ Toolbar::Pimpl::Pimpl(LyXView * o, int x, int y)
}
namespace {
#if FL_REVISION < 89
// timer-cb for bubble-help (Matthias)
static
void BubbleTimerCB(FL_OBJECT *, long data)
{
FL_OBJECT * ob = reinterpret_cast<FL_OBJECT*>(data);
@ -111,7 +112,6 @@ extern "C" void C_Toolbar_BubbleTimerCB(FL_OBJECT * ob, long data)
// post_handler for bubble-help (Matthias)
static
int BubblePost(FL_OBJECT *ob, int event,
FL_Coord /*mx*/, FL_Coord /*my*/,
int /*key*/, void * /*xev*/)
@ -141,6 +141,9 @@ extern "C" int C_Toolbar_BubblePost(FL_OBJECT * ob, int event,
}
#endif
} // namespace anon
// this one is not "C" because combox callbacks are really C++ %-|
void Toolbar::Pimpl::layoutSelectedCB(int sel, void * arg, Combox *)
{
@ -260,7 +263,8 @@ void Toolbar::Pimpl::openLayoutList()
}
static
namespace {
void ToolbarCB(FL_OBJECT * ob, long ac)
{
LyXView * owner = static_cast<LyXView *>(ob->u_vdata);
@ -271,6 +275,8 @@ void ToolbarCB(FL_OBJECT * ob, long ac)
<< res << endl;
}
} // namespace anon
extern "C" void C_Toolbar_ToolbarCB(FL_OBJECT * ob, long data)
{
@ -295,7 +301,8 @@ int Toolbar::get_toolbar_func(string const & func)
#endif
static
namespace {
void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height) {
string name, arg, xpm_name;
kb_action act;
@ -341,6 +348,9 @@ void setPixmap(FL_OBJECT * obj, int action, int buttonwidth, int height) {
}
}
} // namespace anon
void Toolbar::Pimpl::set(bool doingmain)
{
// we shouldn't set if we have not cleaned

View File

@ -72,8 +72,7 @@ FL_OBJECT *fl_add_bmtable(int type, FL_Coord x, FL_Coord y,
}
static
void draw_bitmaptable(FL_OBJECT *ob)
static void draw_bitmaptable(FL_OBJECT *ob)
{
int i, j, lx;
FL_Coord mx, my;

View File

@ -237,7 +237,11 @@ void Combox::add(int x, int y, int w, int hmin, int hmax,
}
static Window save_window;
namespace {
Window save_window;
} // namespace anon
void Combox::Redraw()

View File

@ -116,8 +116,9 @@ string const browseFile(LyXView * lv, string const & filename,
}
namespace {
// sorted by hand to prevent LyXLex from complaining on read().
static
keyword_item xformTags[] = {
{ "\\gui_background", FL_COL1 },
{ "\\gui_buttonbottom", FL_BOTTOM_BCOL },
@ -131,7 +132,9 @@ keyword_item xformTags[] = {
};
static const int xformCount = sizeof(xformTags) / sizeof(keyword_item);
const int xformCount = sizeof(xformTags) / sizeof(keyword_item);
} // namespace anon
bool XformsColor::read(string const & filename)

View File

@ -1,3 +1,7 @@
2001-03-20 Lars Gullik Bjønnes <larsbj@trylle.birdstep.com>
* insetminipage.C (Read): prepare for reading of minipage arguments.
2001-03-18 Baruch Even <baruch@lyx.org>
* insetgraphics.C: Minor cleanups of the comments and code.

View File

@ -85,7 +85,9 @@ extern FL_OBJECT * figinset_canvas;
extern char ** environ; // is this only redundtant on linux systems? Lgb.
static float const DEG2PI = 57.295779513;
namespace {
float const DEG2PI = 57.295779513;
struct queue_element {
float rx, ry; // resolution x and y
@ -93,28 +95,27 @@ struct queue_element {
figdata * data; // we are doing it for this data
};
static int const MAXGS = 3; /* maximum 3 gs's at a time */
int const MAXGS = 3; /* maximum 3 gs's at a time */
typedef vector<Figref *> figures_type;
typedef vector<figdata *> bitmaps_type;
static figures_type figures; // all figures
static bitmaps_type bitmaps; // all bitmaps
figures_type figures; // all figures
bitmaps_type bitmaps; // all bitmaps
static queue<queue_element> gsqueue; // queue for ghostscripting
queue<queue_element> gsqueue; // queue for ghostscripting
static int gsrunning = 0; /* currently so many gs's are running */
static bool bitmap_waiting = false; /* bitmaps are waiting finished */
int gsrunning = 0; /* currently so many gs's are running */
bool bitmap_waiting = false; /* bitmaps are waiting finished */
static bool gs_color; // do we allocate colors for gs?
static bool color_visual; // is the visual color?
static bool gs_xcolor = false; // allocated extended colors
static unsigned long gs_pixels[128]; // allocated pixels
static int gs_spc; // shades per color
static int gs_allcolors; // number of all colors
bool gs_color; // do we allocate colors for gs?
bool color_visual; // is the visual color?
bool gs_xcolor = false; // allocated extended colors
unsigned long gs_pixels[128]; // allocated pixels
int gs_spc; // shades per color
int gs_allcolors; // number of all colors
static list<int> pidwaitlist; // pid wait list
list<int> pidwaitlist; // pid wait list
static
GC createGC()
{
XGCValues val;
@ -130,11 +131,9 @@ GC createGC()
| GCLineWidth | GCLineStyle , &val);
}
static
GC local_gc_copy;
static
void addpidwait(int pid)
{
// adds pid to pid wait list
@ -149,14 +148,12 @@ void addpidwait(int pid)
}
static
string make_tmp(int pid)
{
return system_tempdir + "/~lyxgs" + tostr(pid) + ".ps";
}
static
void kill_gs(int pid, int sig)
{
if (lyxerr.debugging())
@ -166,8 +163,7 @@ void kill_gs(int pid, int sig)
}
extern "C" {
static
extern "C"
int GhostscriptMsg(XEvent * ev, void *)
{
// bin all events not of interest
@ -302,10 +298,8 @@ int GhostscriptMsg(XEvent * ev, void *)
}
return FL_PREEMPT;
}
}
static
void AllocColors(int num)
// allocate color cube numxnumxnum, if possible
{
@ -346,7 +340,6 @@ void AllocColors(int num)
// allocate grayscale ramp
static
void AllocGrays(int num)
{
if (lyxerr.debugging()) {
@ -383,9 +376,10 @@ void AllocGrays(int num)
// xforms doesn't define this
extern "C" FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
extern "C"
FL_APPEVENT_CB fl_set_preemptive_callback(Window, FL_APPEVENT_CB, void *);
static
void InitFigures()
{
// if bitmaps and figures are not empty we will leak mem
@ -430,7 +424,6 @@ void InitFigures()
}
static
void DoneFigures()
{
// if bitmaps and figures are not empty we will leak mem
@ -441,7 +434,6 @@ void DoneFigures()
}
static
void freefigdata(figdata * tmpdata)
{
tmpdata->ref--;
@ -460,7 +452,6 @@ void freefigdata(figdata * tmpdata)
}
static
void runqueue()
{
// This _have_ to be set before the fork!
@ -693,7 +684,6 @@ void runqueue()
}
static
void addwait(int psx, int psy, int pswid, int pshgh, figdata * data)
{
// recompute the stuff and put in the queue
@ -712,7 +702,6 @@ void addwait(int psx, int psy, int pswid, int pshgh, figdata * data)
}
static
figdata * getfigdata(int wid, int hgh, string const & fname,
int psx, int psy, int pswid, int pshgh,
int raw_wid, int raw_hgh, float angle, char flags)
@ -772,14 +761,12 @@ figdata * getfigdata(int wid, int hgh, string const & fname,
}
static
void getbitmap(figdata * p)
{
p->gspid = -1;
}
static
void makeupdatelist(figdata * p)
{
for (figures_type::iterator it = figures.begin();
@ -795,6 +782,8 @@ void makeupdatelist(figdata * p)
}
}
} // namespace anon
// this func is only "called" in spellchecker.C
void sigchldchecker(pid_t pid, int * status)
@ -876,7 +865,8 @@ void sigchldchecker(pid_t pid, int * status)
}
static
namespace {
void getbitmaps()
{
bitmap_waiting = false;
@ -887,7 +877,6 @@ void getbitmaps()
}
static
void RegisterFigure(InsetFig * fi)
{
if (figures.empty()) InitFigures();
@ -905,7 +894,6 @@ void RegisterFigure(InsetFig * fi)
}
static
void UnregisterFigure(InsetFig * fi)
{
if (!lyxrc.use_gui)
@ -934,6 +922,8 @@ void UnregisterFigure(InsetFig * fi)
if (figures.empty()) DoneFigures();
}
} // namespace anon
InsetFig::InsetFig(int tmpx, int tmpy, Buffer const & o)
: owner(&o)
@ -1290,8 +1280,9 @@ Inset::Code InsetFig::LyxCode() const
}
static
string stringify(InsetFig::HWTYPE hw, float f, string suffix)
namespace {
string const stringify(InsetFig::HWTYPE hw, float f, string suffix)
{
string res;
switch (hw) {
@ -1314,6 +1305,8 @@ string stringify(InsetFig::HWTYPE hw, float f, string suffix)
return res;
}
} // namespace anon
void InsetFig::Regenerate() const
{

View File

@ -132,7 +132,7 @@ void InsetFloat::Read(Buffer const * buf, LyXLex & lex)
{
if (lex.IsOK()) {
lex.next();
string token = lex.GetString();
string const token = lex.GetString();
if (token == "placement") {
lex.next();
floatPlacement_ = lex.GetString();

View File

@ -346,7 +346,9 @@ void InsetGraphics::Read(Buffer const * buf, LyXLex & lex)
updateInset();
}
static
namespace {
void formatResize(ostream & os, string const & key,
InsetGraphicsParams::Resize resizeType, double size)
{
@ -373,6 +375,9 @@ void formatResize(ostream & os, string const & key,
}
}
} // namespace anon
string const
InsetGraphics::createLatexOptions() const
{

View File

@ -22,25 +22,28 @@
#include "support/LAssert.h"
namespace {
/// This variable keeps a tab on whether the translator was set with the
/// translations.
static bool translatorsSet = false;
bool translatorsSet = false;
/// This is the translator between the Resize enum and corresponding lyx
/// file strings.
static Translator < InsetGraphicsParams::Resize, string >
Translator< InsetGraphicsParams::Resize, string >
resizeTranslator(InsetGraphicsParams::DEFAULT_SIZE, "default");
/// This is the translator between the Origin enum and corresponding lyx
/// file strings.
static Translator < InsetGraphicsParams::Origin, string >
Translator< InsetGraphicsParams::Origin, string >
originTranslator(InsetGraphicsParams::DEFAULT, "default");
/// This is the translator between the Display enum and corresponding lyx
/// file strings.
static Translator < InsetGraphicsParams::DisplayType, string >
Translator< InsetGraphicsParams::DisplayType, string >
displayTranslator(InsetGraphicsParams::MONOCHROME, "monochrome");
} // namespace anon
InsetGraphicsParams::InsetGraphicsParams()
@ -196,7 +199,8 @@ bool operator==(InsetGraphicsParams const & left,
}
static
namespace {
void writeResize(ostream & os, string const & key,
InsetGraphicsParams::Resize resize, double size)
{
@ -206,13 +210,16 @@ void writeResize(ostream & os, string const & key,
os << ' ' << key << ' ' << size << '\n';
}
static void writeOrigin(ostream & os,
void writeOrigin(ostream & os,
InsetGraphicsParams::Origin origin)
{
os << " rotateOrigin " << originTranslator.find(origin);
os << '\n';
}
} // namespace anon
void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
{
// If there is no filename, write nothing for it.
@ -245,7 +252,8 @@ void InsetGraphicsParams::Write(Buffer const * buf, ostream & os) const
}
static
namespace {
void readResize(InsetGraphicsParams * igp, bool height,
string const & token)
{
@ -260,12 +268,15 @@ void readResize(InsetGraphicsParams * igp, bool height,
}
static
void readOrigin(InsetGraphicsParams * igp, string const & token)
{ // TODO: complete this function.
{
// TODO: complete this function.
igp->rotateOrigin = originTranslator.find(token);
}
} // namespace anon
bool InsetGraphicsParams::Read(Buffer const * buf, LyXLex & lex,
string const& token)
{

View File

@ -29,9 +29,10 @@ using std::pair;
extern BufferList bufferlist;
namespace {
static inline
string unique_id() {
inline
string const unique_id() {
static unsigned int seed = 1000;
std::ostringstream ost;
@ -41,6 +42,8 @@ string unique_id() {
return ost.str().c_str();
}
} // namespace anon
InsetInclude::InsetInclude(InsetIncludeParams const & p)
{

View File

@ -81,11 +81,32 @@ InsetMinipage::~InsetMinipage()
void InsetMinipage::Write(Buffer const * buf, ostream & os) const
{
os << getInsetName() << "\n";
os << getInsetName() << "\n"
<< "position " << pos_ << "\n"
<< "inner_position " << inner_pos_ << "\n"
// << "height " << height_ << "\n"
<< "width " << widthp_ << "\n";
InsetCollapsable::Write(buf, os);
}
void InsetMinipage::Read(Buffer const * buf, LyXLex & lex)
{
#warning Read and set args correctly. (Lgb)
lex.next();
string token = lex.GetString();
lyxerr << "minipage token: " << token << endl;
lex.next(); lex.next();
lex.next();
lex.next();
lex.next();
token = lex.GetString();
lyxerr << "minipage token: " << token << endl;
InsetCollapsable::Read(buf, lex);
}
Inset * InsetMinipage::Clone(Buffer const &) const
{
InsetMinipage * result = new InsetMinipage;
@ -105,7 +126,21 @@ string const InsetMinipage::EditMessage() const
int InsetMinipage::Latex(Buffer const * buf,
ostream & os, bool fragile, bool fp) const
{
os << "\\begin{minipage}{\\columnwidth}%\n";
string s_pos;
switch (pos_) {
case top:
s_pos += "t";
break;
case center:
s_pos += "c";
break;
case bottom:
s_pos += "b";
break;
}
os << "\\begin{minipage}[" << s_pos << "]{."
<< widthp_ << "\\columnwidth}%\n";
int i = inset->Latex(buf, os, fragile, fp);
os << "\\end{minipage}%\n";

View File

@ -45,6 +45,8 @@ public:
///
void Write(Buffer const * buf, std::ostream & os) const;
///
void Read(Buffer const * buf, LyXLex & lex);
///
Inset * Clone(Buffer const &) const;
///
Inset::Code LyxCode() const { return Inset::MINIPAGE_CODE; }

View File

@ -31,13 +31,15 @@ using std::endl;
// Quotes. Used for the various quotes. German, English, French,
// Danish, Polish, all either double or single.
namespace {
// codes used to read/write quotes to LyX files
static char const * const language_char = "esgpfa";
static char const * const side_char = "lr" ;
static char const * const times_char = "sd";
char const * const language_char = "esgpfa";
char const * const side_char = "lr" ;
char const * const times_char = "sd";
// List of known quote chars
static char const * const quote_char = ",'`<>";
char const * const quote_char = ",'`<>";
// Index of chars used for the quote. Index is [side, language]
int quote_index[2][6] = {
@ -45,21 +47,23 @@ int quote_index[2][6] = {
{ 1, 1, 2, 1, 4, 3 } }; // "`'`'><"
// Corresponding LaTeX code, for double and single quotes.
static char const * const latex_quote_t1[2][5] =
char const * const latex_quote_t1[2][5] =
{ { "\\quotesinglbase{}", "'", "`",
"\\guilsinglleft{}", "\\guilsinglright{}" },
{ ",,", "''", "``", "<<", ">>" } };
static char const * const latex_quote_ot1[2][5] =
char const * const latex_quote_ot1[2][5] =
{ { "\\quotesinglbase{}", "'", "`",
"\\guilsinglleft{}", "\\guilsinglright{}" },
{ "\\quotedblbase{}", "''", "``",
"\\guillemotleft{}", "\\guillemotright{}" } };
static char const * const latex_quote_babel[2][5] =
char const * const latex_quote_babel[2][5] =
{ { "\\glq{}", "'", "`", "\\flq{}", "\\frq{}" },
{ "\\glqq{}", "''", "``", "\\flqq{}", "\\frqq{}" } };
} // namespace anon
InsetQuotes::InsetQuotes(string const & str)
{

View File

@ -37,15 +37,6 @@
#include "lyxfunc.h"
#include "WorkArea.h"
const int ADD_TO_HEIGHT = 2;
const int ADD_TO_TABULAR_WIDTH = 2;
///
static LyXTabular * paste_tabular = 0;
bool InsetTabular::hasPasteBuffer() const
{
return (paste_tabular != 0);
}
using std::ostream;
using std::ifstream;
using std::max;
@ -54,14 +45,22 @@ using std::swap;
using std::max;
namespace {
const int ADD_TO_HEIGHT = 2;
const int ADD_TO_TABULAR_WIDTH = 2;
///
LyXTabular * paste_tabular = 0;
struct tabular_features {
LyXTabular::Feature action;
string feature;
};
//static tabular_features * tabularFeatures = 0;
//tabular_features * tabularFeatures = 0;
static tabular_features tabularFeatures[] =
tabular_features tabularFeatures[] =
{
{ LyXTabular::APPEND_ROW, "append-row" },
{ LyXTabular::APPEND_COLUMN, "append-column" },
@ -109,6 +108,15 @@ static tabular_features tabularFeatures[] =
{ LyXTabular::LAST_ACTION, "" }
};
} // namespace anon
bool InsetTabular::hasPasteBuffer() const
{
return (paste_tabular != 0);
}
InsetTabular::InsetTabular(Buffer const & buf, int rows, int columns)
: buffer(&buf)
{

View File

@ -598,13 +598,19 @@ void LyXLayout::readLabelType(LyXLex & lexrc)
}
}
static keyword_item endlabelTypeTags[] = {
namespace {
keyword_item endlabelTypeTags[] = {
{ "box", END_LABEL_BOX },
{ "filled_box", END_LABEL_FILLED_BOX },
{ "no_label", END_LABEL_NO_LABEL },
{ "static", END_LABEL_STATIC }
};
} // namespace anon
void LyXLayout::readEndLabelType(LyXLex & lexrc)
{
pushpophelper pph(lexrc, endlabelTypeTags,

View File

@ -57,11 +57,15 @@ FL_CMD_OPT cmdopt[] =
{"-geometry", "*.geometry", XrmoptionSepArg, "690x510"}
};
static int width = 690;
static int height = 510;
static int xpos = -1;
static int ypos = -1;
static char geometry[40];
namespace {
int width = 690;
int height = 510;
int xpos = -1;
int ypos = -1;
char geometry[40];
} // namespace anon
FL_resource res[] =

View File

@ -690,8 +690,9 @@ void LyX::ReadEncodingsFile(string const & name)
}
namespace {
// Set debugging level and report result to user
static
void setDebuggingLevel(string const & dbgLevel)
{
lyxerr << _("Setting debug level to ") << dbgLevel << endl;
@ -701,7 +702,6 @@ void setDebuggingLevel(string const & dbgLevel)
// Give command line help
static
void commandLineHelp()
{
lyxerr << "LyX " LYX_VERSION << " of " LYX_RELEASE << endl;
@ -725,6 +725,8 @@ void commandLineHelp()
"Check the LyX man page for more details.") << endl;
}
} // namespace anon
bool LyX::easyParse(int * argc, char * argv[])
{

View File

@ -33,27 +33,24 @@ using std::endl;
// Names for the GUI
//
static
namespace {
char const * GUIFamilyNames[6] =
{ N_("Roman"), N_("Sans serif"), N_("Typewriter"), N_("Symbol"), N_("Inherit"),
N_("Ignore") };
static
char const * GUISeriesNames[4] =
{ N_("Medium"), N_("Bold"), N_("Inherit"), N_("Ignore") };
static
char const * GUIShapeNames[6] =
{ N_("Upright"), N_("Italic"), N_("Slanted"), N_("Smallcaps"), N_("Inherit"),
N_("Ignore") };
static
char const * GUISizeNames[14] =
{ N_("Tiny"), N_("Smallest"), N_("Smaller"), N_("Small"), N_("Normal"), N_("Large"),
N_("Larger"), N_("Largest"), N_("Huge"), N_("Huger"), N_("Increase"), N_("Decrease"),
N_("Inherit"), N_("Ignore") };
static
char const * GUIMiscNames[5] =
{ N_("Off"), N_("On"), N_("Toggle"), N_("Inherit"), N_("Ignore") };
@ -61,48 +58,40 @@ char const * GUIMiscNames[5] =
//
// Strings used to read and write .lyx format files
//
static
char const * LyXFamilyNames[6] =
{ "roman", "sans", "typewriter", "symbol", "default", "error" };
static
char const * LyXSeriesNames[4] =
{ "medium", "bold", "default", "error" };
static
char const * LyXShapeNames[6] =
{ "up", "italic", "slanted", "smallcaps", "default", "error" };
static
char const * LyXSizeNames[14] =
{ "tiny", "scriptsize", "footnotesize", "small", "normal", "large",
"larger", "largest", "huge", "giant",
"increase-error", "decrease-error", "default", "error" };
static
char const * LyXMiscNames[5] =
{ "off", "on", "toggle", "default", "error" };
//
// Strings used to write LaTeX files
//
static
char const * LaTeXFamilyNames[6] =
{ "textrm", "textsf", "texttt", "error1", "error2", "error3" };
static
char const * LaTeXSeriesNames[4] =
{ "textmd", "textbf", "error4", "error5" };
static
char const * LaTeXShapeNames[6] =
{ "textup", "textit", "textsl", "textsc", "error6", "error7" };
static
char const * LaTeXSizeNames[14] =
{ "tiny", "scriptsize", "footnotesize", "small", "normalsize", "large",
"Large", "LARGE", "huge", "Huge", "error8", "error9", "error10", "error11" };
} // namespace anon
// Initialize static member

View File

@ -31,10 +31,15 @@
using std::endl;
static XIM xim;
static XIC xic;
namespace {
XIM xim;
XIC xic;
XComposeStatus compose_status= {0, 0};
} // namespace anon
// This is called after the main LyX window has been created
void InitLyXLookup(Display * display, Window window)
{
@ -89,7 +94,8 @@ void InitLyXLookup(Display * display, Window window)
}
static
namespace {
bool isDeadEvent(KeySym keysym)
{
// Can this be done safely in any other way?
@ -152,6 +158,8 @@ bool isDeadEvent(KeySym keysym)
}
}
} // namespace anon
// This is called instead of XLookupString()
int LyXLookupString(XEvent * event,

View File

@ -42,8 +42,8 @@ using std::vector;
extern LyXAction lyxaction;
extern boost::scoped_ptr<kb_keymap> toplevel_keymap;
namespace {
static
keyword_item lyxrcTags[] = {
{ "\\accept_compound", LyXRC::RC_ACCEPT_COMPOUND },
{ "\\alternate_language", LyXRC::RC_ALT_LANG },
@ -139,7 +139,9 @@ keyword_item lyxrcTags[] = {
};
/* Let the range depend of the size of lyxrcTags. Alejandro 240596 */
static const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
const int lyxrcCount = sizeof(lyxrcTags) / sizeof(keyword_item);
} // namespace anon
LyXRC::LyXRC()

View File

@ -14,7 +14,9 @@
using std::ostream;
using std::endl;
static inline
namespace {
inline
void * my_memcpy(void * ps_in, void const * pt_in, size_t n)
{
char * ps = static_cast<char *>(ps_in);
@ -23,6 +25,8 @@ void * my_memcpy(void * ps_in, void const * pt_in, size_t n)
return ps_in;
}
} // namespace anon
MathedArray::MathedArray()
: bf_(1, '\0'), last_(0)

View File

@ -64,25 +64,24 @@ extern char const * latex_mathenv[];
// this is only used by Whichfont and mathed_init_fonts (Lgb)
LyXFont * Math_Fonts = 0;
static LyXFont::FONT_SIZE lfont_size = LyXFont::SIZE_NORMAL;
namespace {
LyXFont::FONT_SIZE lfont_size = LyXFont::SIZE_NORMAL;
// local global
static int sel_x;
static int sel_y;
static bool sel_flag;
int sel_x;
int sel_y;
bool sel_flag;
// quite a hack i know. Should be done with return values...
int number_of_newlines = 0;
static
int mathed_write(MathParInset *, std::ostream &, bool fragile,
string const & label = string());
void mathed_init_fonts();
static
void mathedValidate(LaTeXFeatures & features, MathParInset * par);
} // namespaces
MathedCursor * InsetFormula::mathcursor = 0;
@ -169,6 +168,8 @@ LyXFont WhichFont(short type, int size)
}
namespace {
void mathed_init_fonts() //removed 'static' because DEC cxx does not
//like it (JMarc)
// Probably because this func is declared as a friend in math_defs.h
@ -205,6 +206,11 @@ void mathed_init_fonts() //removed 'static' because DEC cxx does not
MathedInset::defaultWidth(lyxfont::width('I', f));
}
} // namespace anon
// quite a hack i know. Should be done with return values...
int number_of_newlines = 0;
InsetFormula::InsetFormula(bool display)
@ -1225,8 +1231,8 @@ InsetFormula::LocalDispatch(BufferView * bv, kb_action action,
}
namespace {
static
void mathedValidate(LaTeXFeatures & features, MathParInset * par)
{
MathedIter it(&par->GetData());
@ -1256,7 +1262,6 @@ void mathedValidate(LaTeXFeatures & features, MathParInset * par)
}
static
int mathed_write(MathParInset * p, ostream & os,
bool fragile, string const & label)
{
@ -1309,6 +1314,8 @@ int mathed_write(MathParInset * p, ostream & os,
return number_of_newlines;
}
} // namespace anon
/* FIXME: math-greek-toggle seems to work OK, but math-greek doesn't turn
* on greek mode */

View File

@ -43,12 +43,14 @@
#include "math_macrotemplate.h"
#include "mathed/support.h"
static MathedArray selarray;
using std::endl;
namespace {
MathedArray selarray;
// This was very smaller, I'll change it later
static inline
inline
bool IsMacro(short tok, int id)
{
return tok != LM_TK_STACK &&
@ -63,7 +65,7 @@ bool IsMacro(short tok, int id)
!(tok == LM_TK_SYM && id < 255);
}
static int const MAX_STACK_ITEMS = 32;
int const MAX_STACK_ITEMS = 32;
struct MathStackXIter {
std::vector<MathedXIter> item;
@ -104,6 +106,7 @@ struct MathStackXIter {
} mathstk, selstk;
} // namespace anon
/***---------------- Mathed Cursor ---------------------------***/

View File

@ -39,10 +39,15 @@ enum math_align {
///
MATH_ALIGN_TOP = 8
};
namespace {
///
static int const MATH_COLSEP = 8;
int const MATH_COLSEP = 8;
///
static int const MATH_ROWSEP = 8;
int const MATH_ROWSEP = 8;
} // namespace anon
/// Standard Math Sizes (Math mode styles)

View File

@ -14,7 +14,8 @@ int const MAX_HASH_VALUE = 490;
/* maximum key range = 483, duplicates = 40 */
static
namespace {
unsigned int
math_hash (register char const * str, register int len)
{
@ -38,7 +39,6 @@ math_hash (register char const * str, register int len)
}
static
latexkeys const wordlist[] =
{
{"",0,0}, {"",0,0}, {"",0,0}, {"",0,0},
@ -315,7 +315,6 @@ latexkeys const wordlist[] =
};
static
short lookup[] =
{
-1, -1, -1, -1, -1, -1, -1, -1, 8, -1, -1, -1, -1, -1,
@ -356,6 +355,8 @@ short lookup[] =
276,
};
} // namespace anon
latexkeys const *
in_word_set (register char const * str, register int len)

View File

@ -52,6 +52,7 @@ using std::endl;
extern MathMatrixInset * create_multiline(short int type, int cols);
namespace {
enum {
FLAG_BRACE = 1, // A { needed
@ -79,14 +80,15 @@ union YYSTYPE {
};
static
YYSTYPE yylval;
static
MathedInsetTypes mathed_env = LM_OT_MIN;
} // namespace anon
string mathed_label;
@ -110,6 +112,8 @@ char const * latex_mathenv[latex_mathenv_num] = {
char const * latex_special_chars = "#$%&_{}";
namespace {
// These are lexical codes, not semantic
enum lexcode_enum {
LexNone,
@ -129,16 +133,16 @@ enum lexcode_enum {
};
static lexcode_enum lexcode[256];
lexcode_enum lexcode[256];
#warning Replace with string
//static char yytext[256];
static array<char, 256> yytext;
static int yylineno;
static istream * yyis;
static bool yy_mtextmode= false;
//char yytext[256];
array<char, 256> yytext;
int yylineno;
istream * yyis;
bool yy_mtextmode= false;
static inline
inline
void mathPrintError(string const & msg)
{
lyxerr << "Line ~" << yylineno << ": Math parse error: "
@ -146,7 +150,6 @@ void mathPrintError(string const & msg)
}
static
void LexInitCodes()
{
for (int i = 0; i <= 255; ++i) {
@ -184,7 +187,6 @@ void LexInitCodes()
}
static
char LexGetArg(char lf, bool accept_spaces = false)
{
// unsigned char c;
@ -230,7 +232,6 @@ char LexGetArg(char lf, bool accept_spaces = false)
}
static
int yylex(void)
{
static int init_done = 0;
@ -347,7 +348,7 @@ int yylex(void)
}
static inline
inline
int parse_align(char * hor, char *)
{
int nc = 0;
@ -357,12 +358,10 @@ int parse_align(char * hor, char *)
// Accent hacks only for 0.12. Stolen from Cursor.
static
int accent = 0;
static
int nestaccent[8];
static inline
inline
void setAccent(int ac)
{
if (ac > 0 && accent < 8) {
@ -372,7 +371,6 @@ void setAccent(int ac)
}
static
MathedInset * doAccent(byte c, MathedTextCodes t)
{
MathedInset * ac = 0;
@ -389,7 +387,6 @@ MathedInset * doAccent(byte c, MathedTextCodes t)
}
static
MathedInset * doAccent(MathedInset * p)
{
MathedInset * ac = 0;
@ -405,6 +402,8 @@ MathedInset * doAccent(MathedInset * p)
return ac;
}
} // namespace anon
/**
*/

View File

@ -19,6 +19,8 @@
using std::sort;
using std::lower_bound;
namespace {
// This table includes all binary operators and relations
struct binary_op_pair {
short id;
@ -26,7 +28,6 @@ struct binary_op_pair {
};
static
binary_op_pair binary_op_table[] = {
{ LM_leq, LMB_RELATION }, { LM_geq, LMB_RELATION },
{ LM_equiv, LMB_RELATION }, { LM_models, LMB_RELATION },
@ -74,6 +75,8 @@ struct compara {
}
};
} // namespace anon
int MathedLookupBOP(short id)
{

View File

@ -5,12 +5,16 @@
#include "matriz.h"
static inline
namespace {
inline
int odd(int x)
{
return (x & 1);
}
} // namespace anon
#define mateq(m1, m2) memcpy(m1, m2, sizeof(matriz_data))

View File

@ -34,13 +34,15 @@ char const * latex_mathspace[] = {
"!", ",", ":", ";", "quad", "qquad"
};
namespace {
/*
* Internal struct of a drawing: code n x1 y1 ... xn yn, where code is:
* 0 = end, 1 = line, 2 = polyline, 3 = square line, 4= square polyline
*/
static
float const parenthHigh[] = {
2.0, 13.0,
0.9840, 0.0014, 0.7143, 0.0323, 0.4603, 0.0772,
@ -52,7 +54,6 @@ float const parenthHigh[] = {
};
static
float const parenth[] = {
2.0, 13.0,
0.9930, 0.0071, 0.7324, 0.0578, 0.5141, 0.1126,
@ -64,7 +65,6 @@ float const parenth[] = {
};
static
float const brace[] = {
2.0, 21.0,
0.9492, 0.0020, 0.9379, 0.0020, 0.7458, 0.0243,
@ -79,7 +79,6 @@ float const brace[] = {
// Is this correct? (Lgb)
static
float const arrow[] = {
4, 7,
0.0150, 0.7500, 0.2000, 0.6000, 0.3500, 0.3500,
@ -91,7 +90,6 @@ float const arrow[] = {
// Is this correct? (Lgb)
static
float const Arrow[] = {
4, 7,
0.0150, 0.7500, 0.2000, 0.6000, 0.3500, 0.3500,
@ -103,7 +101,6 @@ float const Arrow[] = {
};
static
float const udarrow[] = {
2, 3,
0.015, 0.25, 0.5, 0.05, 0.95, 0.25,
@ -114,7 +111,6 @@ float const udarrow[] = {
};
static
float const Udarrow[] = {
2, 3,
0.015, 0.25, 0.5, 0.05, 0.95, 0.25,
@ -126,7 +122,6 @@ float const Udarrow[] = {
};
static
float const brack[] = {
2.0, 4,
0.95, 0.05, 0.05, 0.05, 0.05, 0.95, 0.95, 0.95,
@ -134,7 +129,6 @@ float const brack[] = {
};
static
float const corner[] = {
2.0, 3,
0.95, 0.05, 0.05, 0.05, 0.05, 0.95,
@ -142,7 +136,6 @@ float const corner[] = {
};
static
float const angle[] = {
2.0, 3,
1, 0, 0.05, 0.5, 1, 1,
@ -150,20 +143,18 @@ float const angle[] = {
};
static
float const slash[] = {
1, 0.95, 0.05, 0.05, 0.95,
0.0
};
static const float hline[] = {
float const hline[] = {
1, 0.05, 0.5, 0.95, 0.5,
0.0
};
static
float const hline2[] = {
1, 0.1, 0.5, 0.3, 0.5,
1, 0.7, 0.5, 0.9, 0.5,
@ -171,7 +162,6 @@ float const hline2[] = {
};
static
float const hline3[] = {
1, 0.1, 0, 0.15, 0,
1, 0.475, 0, 0.525, 0,
@ -180,7 +170,6 @@ float const hline3[] = {
};
static
float const dline3[] = {
1, 0.1, 0.1, 0.15, 0.15,
1, 0.475, 0.475, 0.525, 0.525,
@ -189,21 +178,18 @@ float const dline3[] = {
};
static
float const hlinesmall[] = {
1, 0.4, 0.5, 0.6, 0.5,
0.0
};
static
float const vert[] = {
1, 0.5, 0.05, 0.5, 0.95,
0.0
};
static
float const Vert[] = {
1, 0.3, 0.05, 0.3, 0.95,
1, 0.7, 0.05, 0.7, 0.95,
@ -211,7 +197,6 @@ float const Vert[] = {
};
static
float const tilde[] = {
2.0, 4,
0.05, 0.8, 0.25, 0.2, 0.75, 0.8, 0.95, 0.2,
@ -219,7 +204,6 @@ float const tilde[] = {
};
static
math_deco_struct math_deco_table[] = {
// Decorations
{ LM_widehat, &angle[0], 3 },
@ -286,7 +270,6 @@ struct math_deco_compare {
};
static
int const math_deco_table_size =
sizeof(math_deco_table) /sizeof(math_deco_struct);
@ -309,6 +292,8 @@ private:
bool init_deco_table::init = false;
static init_deco_table idt;
} // namespace anon
int mathed_char_height(short type, int size, byte c, int & asc, int & des)
{

View File

@ -17,7 +17,9 @@
#include <cerrno>
//#endif
static unsigned char const errno_tab[] =
namespace {
unsigned char const errno_tab[] =
{
EINVAL, EINVAL, ENOENT, ENOENT, EMFILE, /* 0..4 */
EACCES, EBADF, EIO, ENOMEM, EIO, /* 5..9 */
@ -88,6 +90,9 @@ static unsigned char const errno_tab[] =
EACCES, EACCES, EACCES, ENOENT, ENOMEM /* 330..334 */
};
} // namespace anon
inline
int TranslateOS2Error(unsigned long rc)
{

View File

@ -55,9 +55,14 @@ int tex_code_break_column = 72; // needs non-zero initialization. set later.
extern string bibitemWidest(Buffer const *);
// this is a minibuffer
static char minibuffer_char;
static LyXFont minibuffer_font;
static Inset * minibuffer_inset;
namespace {
char minibuffer_char;
LyXFont minibuffer_font;
Inset * minibuffer_inset;
} // namespace anon
extern BufferView * current_view;
@ -3424,7 +3429,8 @@ LyXParagraph * LyXParagraph::TeXEnvironment(Buffer const * buf,
);
if (style.isEnvironment()) {
os << "\\end{" << style.latexname() << '}';
os << "\\end{" << style.latexname() << "}\n";
#ifndef NEW_INSETS
// maybe this should go after the minipage closes?
if (foot_this_level) {

View File

@ -29,7 +29,8 @@
using std::max;
using std::min;
static
namespace {
GC createGC()
{
XGCValues val;
@ -45,6 +46,8 @@ GC createGC()
| GCLineWidth | GCLineStyle , &val);
}
} // namespace anon
// Constructor
LyXScreen::LyXScreen(WorkArea & o)

View File

@ -72,6 +72,8 @@
using std::reverse;
using std::endl;
namespace {
// Spellchecker status
enum {
ISP_OK = 1,
@ -82,19 +84,20 @@ enum {
ISP_IGNORE
};
static bool RunSpellChecker(BufferView * bv);
bool RunSpellChecker(BufferView * bv);
#ifndef USE_PSPELL
static FILE * in, * out; /* streams to communicate with ispell */
FILE * in;
FILE * out; /* streams to communicate with ispell */
pid_t isp_pid = -1; // pid for the `ispell' process. Also used (RO) in
// lyx_cb.C
// the true spell checker program being used
enum ActualSpellChecker {ASC_ISPELL, ASC_ASPELL};
static ActualSpellChecker actual_spell_checker;
ActualSpellChecker actual_spell_checker;
static int isp_fd;
int isp_fd;
#else
@ -102,6 +105,9 @@ PspellManager * sc;
#endif
} // namespace anon
// Non-static so that it can be redrawn if the xforms colors are re-mapped
FD_form_spell_options *fd_form_spell_options = 0;
FD_form_spell_check *fd_form_spell_check = 0;
@ -286,7 +292,8 @@ void SpellCheckerOptions()
// Could also use a clean up. (Asger Alstrup)
static
namespace {
void init_spell_checker(BufferParams const & params, string const & lang)
{
static char o_buf[BUFSIZ]; // jc: it could be smaller
@ -478,19 +485,19 @@ void init_spell_checker(BufferParams const & params, string const & lang)
}
}
static
bool sc_still_alive() {
return isp_pid != -1;
}
static
void sc_clean_up_after_error()
{
::fclose(out);
}
// Send word to ispell and get reply
static
isp_result * sc_check_word(string const & word)
{
//Please rewrite to use string.
@ -545,7 +552,7 @@ isp_result * sc_check_word(string const & word)
}
static inline
inline
void close_spell_checker()
{
// Note: If you decide to optimize this out when it is not
@ -560,7 +567,7 @@ void close_spell_checker()
}
static inline
inline
void sc_insert_word(string const & word)
{
::fputc('*', out); // Insert word in personal dictionary
@ -569,7 +576,7 @@ void sc_insert_word(string const & word)
}
static inline
inline
void sc_accept_word(string const & word)
{
::fputc('@', out); // Accept in this session
@ -577,7 +584,8 @@ void sc_accept_word(string const & word)
::fputc('\n', out);
}
static inline
inline
void sc_store_replacement(string const & mis, string const & cor) {
if (actual_spell_checker == ASC_ASPELL) {
::fputs("$$ra ", out);
@ -592,7 +600,6 @@ void sc_store_replacement(string const & mis, string const & cor) {
PspellCanHaveError * spell_error_object;
static
void init_spell_checker(BufferParams const &, string const & lang)
{
PspellConfig * config = new_pspell_config();
@ -609,12 +616,12 @@ void init_spell_checker(BufferParams const &, string const & lang)
}
}
static
bool sc_still_alive() {
return true;
}
static
void sc_clean_up_after_error()
{
delete_pspell_can_have_error(spell_error_object);
@ -623,7 +630,6 @@ void sc_clean_up_after_error()
// Send word to pspell and get reply
static
isp_result * sc_check_word(string const & word)
{
isp_result * result = new isp_result;
@ -647,28 +653,28 @@ isp_result * sc_check_word(string const & word)
}
static inline
inline
void close_spell_checker()
{
pspell_manager_save_all_word_lists(sc);
}
static inline
inline
void sc_insert_word(string const & word)
{
pspell_manager_add_to_personal(sc, word.c_str());
}
static inline
inline
void sc_accept_word(string const & word)
{
pspell_manager_add_to_session(sc, word.c_str());
}
static inline
inline
void sc_store_replacement(string const & mis, string const & cor)
{
pspell_manager_store_replacement(sc, mis.c_str(), cor.c_str());
@ -676,6 +682,9 @@ void sc_store_replacement(string const & mis, string const & cor)
#endif
} // namespace anon
void ShowSpellChecker(BufferView * bv)
{
FL_OBJECT * obj;
@ -792,7 +801,8 @@ void ShowSpellChecker(BufferView * bv)
// Perform a spell session
static
namespace {
bool RunSpellChecker(BufferView * bv)
{
isp_result * result;
@ -966,6 +976,8 @@ bool RunSpellChecker(BufferView * bv)
}
}
} // namespace anon
#ifdef WITH_WARNINGS
#warning should go somewhere more sensible
#endif
@ -982,3 +994,5 @@ void sigchldhandler(pid_t pid, int * status)
#endif
sigchldchecker(pid, status);
}

View File

@ -374,7 +374,8 @@ bool PutEnvPath(string const & envstr)
}
static
namespace {
int DeleteAllFilesInDir (string const & path)
{
// I have decided that we will be using parts from the boost
@ -427,7 +428,6 @@ int DeleteAllFilesInDir (string const & path)
}
static
string const CreateTmpDir(string const & tempdir, string const & mask)
{
lyxerr[Debug::FILES]
@ -450,7 +450,6 @@ string const CreateTmpDir(string const & tempdir, string const & mask)
}
static
int DestroyTmpDir(string const & tmpdir, bool Allfiles)
{
#ifdef __EMX__
@ -465,6 +464,8 @@ int DestroyTmpDir(string const & tmpdir, bool Allfiles)
return 0;
}
} // namespace anon
string const CreateBufferTmpDir(string const & pathfor)
{
@ -1029,8 +1030,10 @@ bool LyXReadLink(string const & File, string & Link)
}
namespace {
typedef pair<int, string> cmdret;
static
cmdret const do_popen(string const & cmd)
{
// One question is if we should use popen or
@ -1049,6 +1052,8 @@ cmdret const do_popen(string const & cmd)
return make_pair(pret, ret);
}
} // namespace anon
string const
findtexfile(string const & fil, string const & /*format*/)

View File

@ -5,7 +5,9 @@
#include "support/lyxlib.h"
static inline
namespace {
inline
char * l_getcwd(char * buffer, size_t size)
{
#ifndef __EMX__
@ -15,6 +17,8 @@ char * l_getcwd(char * buffer, size_t size)
#endif
}
} // namespace anon
// Returns current working directory
string const lyx::getcwd()

View File

@ -24,8 +24,9 @@
using std::ifstream;
using std::ios;
namespace {
// DO _NOT_ CHANGE _ANYTHING_ IN THIS TABLE
static
unsigned long const crctab[256] =
{
0x0,
@ -86,7 +87,7 @@ unsigned long const crctab[256] =
Return crc if successful, 0 if an error occurs. */
template<typename InputIterator>
static inline
inline
unsigned long do_crc(InputIterator first, InputIterator last)
{
unsigned long crc = 0;
@ -104,6 +105,8 @@ unsigned long do_crc(InputIterator first, InputIterator last)
return ~crc & 0xFFFFFFFF;
}
} // namespace
// And this would be the file interface.
unsigned long lyx::sum(string const & file)

View File

@ -12,7 +12,9 @@ using std::endl;
extern string system_tempdir;
static inline
namespace {
inline
int make_tempfile(char * templ)
{
#ifdef HAVE_MKSTEMP
@ -28,6 +30,9 @@ int make_tempfile(char * templ)
#endif
}
} // namespace anon
string const lyx::tempName(string const & dir, string const & mask)
{
string const tmpdir(dir.empty() ? system_tempdir : dir);

View File

@ -21,7 +21,8 @@ using std::getline;
using std::endl;
static
namespace {
bool getTokenValue(string const & str, const char * token, string & ret)
{
size_t token_length = strlen(token);
@ -44,7 +45,6 @@ bool getTokenValue(string const & str, const char * token, string & ret)
}
static
bool getTokenValue(string const & str, const char * token, int & num)
{
string::size_type pos = str.find(token);
@ -69,7 +69,6 @@ bool getTokenValue(string const & str, const char * token, int & num)
}
static
bool getTokenValue(string const & str, const char * token, LyXAlignment & num)
{
int tmp;
@ -79,7 +78,6 @@ bool getTokenValue(string const & str, const char * token, LyXAlignment & num)
}
static
bool getTokenValue(string const & str, const char * token,
LyXTabular::VAlignment & num)
{
@ -90,7 +88,6 @@ bool getTokenValue(string const & str, const char * token,
}
static
bool getTokenValue(string const & str, const char * token,
LyXTabular::BoxType & num)
{
@ -101,7 +98,6 @@ bool getTokenValue(string const & str, const char * token,
}
static
bool getTokenValue(string const & str, const char * token, bool & flag)
{
string::size_type pos = str.find(token);
@ -126,14 +122,17 @@ bool getTokenValue(string const & str, const char * token, bool & flag)
}
static inline
inline
void l_getline(istream & is, string & str)
{
#warning old l_getline
getline(is, str);
while(str.empty())
getline(is, str);
}
} // namespace anon
void LyXTabular::ReadOld(Buffer const * buf, istream & is,
LyXLex & lex, string const & l)

View File

@ -40,7 +40,11 @@ using std::max;
using std::endl;
using std::vector;
static int const WIDTH_OF_LINE = 5;
namespace {
int const WIDTH_OF_LINE = 5;
} // namespace
/// Define a few methods for the inner structs
@ -1082,9 +1086,11 @@ void LyXTabular::Write(Buffer const * buf, ostream & os) const
}
namespace {
// I would have liked a fromstr template a lot better. (Lgb)
static inline
inline
bool string2type(string const str, LyXAlignment & num)
{
if (str == "none")
@ -1103,7 +1109,7 @@ bool string2type(string const str, LyXAlignment & num)
}
static inline
inline
bool string2type(string const str, LyXTabular::VAlignment & num)
{
if (str == "top")
@ -1118,7 +1124,7 @@ bool string2type(string const str, LyXTabular::VAlignment & num)
}
static inline
inline
bool string2type(string const str, LyXTabular::BoxType & num)
{
if (str == "none")
@ -1133,7 +1139,7 @@ bool string2type(string const str, LyXTabular::BoxType & num)
}
static inline
inline
bool string2type(string const str, bool & num)
{
if (str == "true")
@ -1146,7 +1152,6 @@ bool string2type(string const str, bool & num)
}
static
bool getTokenValue(string const & str, const char * token, string & ret)
{
size_t token_length = strlen(token);
@ -1169,7 +1174,6 @@ bool getTokenValue(string const & str, const char * token, string & ret)
}
static
bool getTokenValue(string const & str, const char * token, int & num)
{
string tmp;
@ -1180,7 +1184,6 @@ bool getTokenValue(string const & str, const char * token, int & num)
}
static
bool getTokenValue(string const & str, const char * token, LyXAlignment & num)
{
string tmp;
@ -1190,7 +1193,6 @@ bool getTokenValue(string const & str, const char * token, LyXAlignment & num)
}
static
bool getTokenValue(string const & str, const char * token,
LyXTabular::VAlignment & num)
{
@ -1201,7 +1203,6 @@ bool getTokenValue(string const & str, const char * token,
}
static
bool getTokenValue(string const & str, const char * token,
LyXTabular::BoxType & num)
{
@ -1212,7 +1213,6 @@ bool getTokenValue(string const & str, const char * token,
}
static
bool getTokenValue(string const & str, const char * token, bool & flag)
{
string tmp;
@ -1222,7 +1222,7 @@ bool getTokenValue(string const & str, const char * token, bool & flag)
}
static inline
inline
void l_getline(istream & is, string & str)
{
str.erase();
@ -1233,6 +1233,8 @@ void l_getline(istream & is, string & str)
}
}
} // namespace anon
void LyXTabular::Read(Buffer const * buf, LyXLex & lex)
{
@ -2327,13 +2329,16 @@ int LyXTabular::DocBook(Buffer const * buf, ostream & os) const
}
static
namespace {
inline
void print_n_chars(ostream & os, unsigned char ch, int n)
{
os << string(n, ch);
}
} // namespace anon
int LyXTabular::AsciiTopHLine(ostream & os, int row,
vector<unsigned int> const & clen) const

View File

@ -50,7 +50,6 @@
*/
// I am not sure how some of the XWindows names coresponds to the TeX ones.
//static
tex_accent_struct lyx_accent_table[18] = {
{ static_cast<tex_accent>(0), "", "", "", static_cast<kb_action>(0)},
{TEX_ACUTE, "\\'", " AEIOUYaeiouySZszRLCNrlcn", "acute", LFUN_ACUTE},

View File

@ -40,7 +40,11 @@ using std::min;
using std::endl;
using std::pair;
static const int LYX_PAPER_MARGIN = 20;
namespace {
int const LYX_PAPER_MARGIN = 20;
} // namespace anon
extern int bibitemMaxWidth(BufferView *, LyXFont const &);

View File

@ -1655,7 +1655,9 @@ char loweralphaCounter(int n)
}
static inline
namespace {
inline
char alphaCounter(int n)
{
if (n < 1 || n > 26)
@ -1665,7 +1667,7 @@ char alphaCounter(int n)
}
static inline
inline
char hebrewCounter(int n)
{
static const char hebrew[22] = {
@ -1680,7 +1682,7 @@ char hebrewCounter(int n)
}
static inline
inline
string const romanCounter(int n)
{
static char const * roman[20] = {
@ -1695,6 +1697,8 @@ string const romanCounter(int n)
return roman[n-1];
}
} // namespace anon
// set the counter of a paragraph. This includes the labels
void LyXText::SetCounter(Buffer const * buf, LyXParagraph * par) const

View File

@ -24,50 +24,45 @@
#include "support/lstrings.h"
namespace {
/* length units
*/
static const int num_units = LyXLength::UNIT_NONE;
int const num_units = LyXLength::UNIT_NONE;
// I am not sure if "mu" should be possible to select (Lgb)
static char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
"mm", "pc", "cc", "cm",
"in", "ex", "em", "mu" };
char const * unit_name[num_units] = { "sp", "pt", "bp", "dd",
"mm", "pc", "cc", "cm",
"in", "ex", "em", "mu" };
LyXLength::UNIT unitFromString (string const & data)
{
int i = 0;
while ((i < num_units) && (data != unit_name[i])) ++i;
return static_cast<LyXLength::UNIT>(i);
}
/* The following static items form a simple scanner for
* length strings, used by isValid[Glue]Length. See comments there.
*/
static float number[4] = { 0, 0, 0, 0 };
static LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE };
static int number_index, unit_index;
float number[4] = { 0, 0, 0, 0 };
LyXLength::UNIT unit[4] = { LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE,
LyXLength::UNIT_NONE };
int number_index;
int unit_index;
static inline
inline
void lyx_advance(string & data, unsigned int n)
{
data.erase(0, n);
}
static inline
inline
bool isEndOfData(string const & data)
{
return frontStrip(data).empty();
}
static
char nextToken(string & data)
{
data = frontStrip(data);
@ -148,7 +143,6 @@ struct LaTeXLength {
};
static
LaTeXLength table[] = {
{ "nu", 0, 0, 0, 0 },
{ "nu+nu", 2, 0, 2, 0 },
@ -166,6 +160,16 @@ LaTeXLength table[] = {
{ "", 0, 0, 0, 0 } // sentinel, must be empty
};
} // namespace anon
LyXLength::UNIT unitFromString (string const & data)
{
int i = 0;
while ((i < num_units) && (data != unit_name[i])) ++i;
return static_cast<LyXLength::UNIT>(i);
}
bool isValidGlueLength (string const & data, LyXGlueLength * result)
{