mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 19:07:45 +00:00
a couple of new posix wrappers, use new instead of malloc in figinset delete the now unused code in kbmap, add ro.po some changes in bufferlist, use std::sort and std::lower_bound in math_utils. Read the ChangeLog
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@427 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d3fc8a3e29
commit
db54977b71
48
ChangeLog
48
ChangeLog
@ -1,3 +1,41 @@
|
||||
2000-01-20 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/support/Makefile.am (libsupport_la_SOURCES): added mkdir.C
|
||||
and putenv.C
|
||||
|
||||
* src/mathed/formulamacro.C: delete #include "bufferlist.h" never used
|
||||
|
||||
* src/mathed/formula.C: delete #include "bufferlist.h" never used
|
||||
|
||||
* src/insets/figinset.C (InitFigures): use new instead of malloc
|
||||
to allocate memory for figures and bitmaps.
|
||||
(DoneFigures): use delete[] instead of free to deallocate memory
|
||||
for figures and bitmaps.
|
||||
(runqueue): use new to allocate
|
||||
(getfigdata): use new/delete[] instead of malloc/free
|
||||
(RegisterFigure): ditto
|
||||
|
||||
* some files: moved some declarations closer to first use, small
|
||||
whitespace changes use preincrement instead of postincrement where
|
||||
it does not make a difference.
|
||||
|
||||
* src/kbmap.[Ch]: delete code according to define NO_HASH, it is a
|
||||
step on the way to use stl::containers for key maps.
|
||||
|
||||
* src/bufferlist.h: add a typedef for const_iterator and const
|
||||
versions of begin and end.
|
||||
|
||||
* src/bufferlist.[Ch]: change name of member variable _state to
|
||||
state_. (avoid reserved names)
|
||||
(makePup): removed
|
||||
(getFileNames): returns the filenames of the buffers in a vector.
|
||||
|
||||
* configure.in (ALL_LINGUAS): added ro
|
||||
|
||||
* src/support/putenv.C: new file
|
||||
|
||||
* src/support/mkdir.C: new file
|
||||
|
||||
2000-01-20 Allan Rae <rae@lyx.org>
|
||||
|
||||
* lib/layouts/IEEEtran.layout: Added several theorem environments
|
||||
@ -8,6 +46,16 @@
|
||||
* lib/doc/LaTeXConfig.lyx.in: Use URL insets for ftp sites
|
||||
(except for those in footnotes of course)
|
||||
|
||||
2000-01-19 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/lyxlookup.C (CloseLyXLookup): set xic=0; after destruction.
|
||||
|
||||
* src/mathed/math_utils.C (MathedLookupBOP): rewrite to use
|
||||
std::sort and std::lower_bound instead of qsort and handwritten
|
||||
binarysearch.
|
||||
(struct compara): struct that holds the functors used by std::sort
|
||||
and std::lower_bound in MathedLookupBOP.
|
||||
|
||||
2000-01-19 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* src/support/LAssert.h: do not do partial specialization. We do
|
||||
|
@ -19,7 +19,7 @@ AM_INIT_AUTOMAKE($lyxname, $VERSION)
|
||||
|
||||
# The list of languages known to LyX
|
||||
# This is needed by GNU gettext
|
||||
ALL_LINGUAS="ca cs da de es fi fr hu it nl no pl pt ru sl sv tr wa"
|
||||
ALL_LINGUAS="ca cs da de es fi fr hu it nl no pl pt ro ru sl sv tr wa"
|
||||
|
||||
AC_PREFIX_PROGRAM(lyx)
|
||||
|
||||
|
@ -1,3 +1,8 @@
|
||||
2000-01-20 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* ro.po: new po file for romanian, written for klyx but included
|
||||
here so that updates can be made easier later.
|
||||
|
||||
1999-12-28 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||
|
||||
* fi.po: update from pauli.virtanen@saunalahti.fi
|
||||
|
@ -70,7 +70,7 @@ Buffer * BufferStorage::newBuffer(string const & s,
|
||||
Buffer * tmpbuf = new Buffer(s, lyxrc, ronly);
|
||||
tmpbuf->params.useClassDefaults();
|
||||
lyxerr.debug() << "Assigning to buffer "
|
||||
<< container.size() + 1 << endl;
|
||||
<< container.size() << endl;
|
||||
container.push_back(tmpbuf);
|
||||
return tmpbuf;
|
||||
}
|
||||
@ -81,9 +81,8 @@ Buffer * BufferStorage::newBuffer(string const & s,
|
||||
//
|
||||
|
||||
BufferList::BufferList()
|
||||
{
|
||||
_state = BufferList::OK;
|
||||
}
|
||||
: state_(BufferList::OK)
|
||||
{}
|
||||
|
||||
|
||||
bool BufferList::empty()
|
||||
@ -234,11 +233,11 @@ bool BufferList::write(Buffer * buf, bool makeBackup)
|
||||
|
||||
void BufferList::closeAll()
|
||||
{
|
||||
_state = BufferList::CLOSING;
|
||||
state_ = BufferList::CLOSING;
|
||||
while (!bstore.empty()) {
|
||||
close(bstore.front());
|
||||
}
|
||||
_state = BufferList::OK;
|
||||
state_ = BufferList::OK;
|
||||
}
|
||||
|
||||
|
||||
@ -280,19 +279,14 @@ bool BufferList::close(Buffer * buf)
|
||||
}
|
||||
|
||||
|
||||
void BufferList::makePup(int pup)
|
||||
/* This should be changed to return a char const *const
|
||||
in the same way as for lastfiles.[hC]
|
||||
*/
|
||||
vector<string> BufferList::getFileNames() const
|
||||
{
|
||||
int ant = 0;
|
||||
for(BufferStorage::iterator it = bstore.begin();
|
||||
it != bstore.end(); ++it) {
|
||||
string relbuf = MakeDisplayPath((*it)->fileName(), 30);
|
||||
fl_addtopup(pup, relbuf.c_str());
|
||||
++ant;
|
||||
vector<string> nvec;
|
||||
for(BufferStorage::const_iterator cit = bstore.begin();
|
||||
cit != bstore.end(); ++cit) {
|
||||
nvec.push_back((*cit)->fileName());
|
||||
}
|
||||
if (ant == 0) fl_addtopup(pup, _("No Documents Open!%t"));
|
||||
return nvec;
|
||||
}
|
||||
|
||||
|
||||
|
@ -36,6 +36,8 @@ public:
|
||||
///
|
||||
typedef Container::iterator iterator;
|
||||
///
|
||||
typedef Container::const_iterator const_iterator;
|
||||
///
|
||||
bool empty() const { return container.empty(); }
|
||||
///
|
||||
void release(Buffer * buf);
|
||||
@ -46,6 +48,10 @@ public:
|
||||
///
|
||||
Container::iterator end() { return container.end(); }
|
||||
///
|
||||
Container::const_iterator begin() const { return container.begin(); }
|
||||
///
|
||||
Container::const_iterator end() const { return container.end(); }
|
||||
///
|
||||
Buffer * front() { return container.front(); }
|
||||
///
|
||||
Buffer * operator[](int c) { return container[c]; }
|
||||
@ -76,7 +82,7 @@ public:
|
||||
};
|
||||
|
||||
/// returns the state of the bufferlist
|
||||
list_state getState() { return _state; }
|
||||
list_state getState() { return state_; }
|
||||
|
||||
/** loads a LyX file or...
|
||||
If the optional argument tolastfiles is false (default is
|
||||
@ -106,10 +112,8 @@ public:
|
||||
|
||||
/// Make a new file (buffer) using a template
|
||||
Buffer * newFile(string const &, string);
|
||||
|
||||
/** This one must be moved to some other place.
|
||||
*/
|
||||
void makePup(int);
|
||||
/// returns a vector with all the buffers filenames
|
||||
vector<string> getFileNames() const;
|
||||
|
||||
///
|
||||
void updateInset(Inset *, bool = true);
|
||||
@ -144,7 +148,7 @@ private:
|
||||
BufferStorage bstore;
|
||||
|
||||
///
|
||||
list_state _state;
|
||||
list_state state_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -221,7 +221,6 @@ extern "C" int GhostscriptMsg(FL_OBJECT *, Window, int, int,
|
||||
}
|
||||
{
|
||||
// query current colormap
|
||||
//cmap = (XColor *) malloc(gs_allcolors*sizeof(XColor));
|
||||
XColor * cmap = new XColor[gs_allcolors];
|
||||
for (i = 0; i < gs_allcolors; ++i) cmap[i].pixel = i;
|
||||
XQueryColors(tmpdisp, color_map, cmap, gs_allcolors);
|
||||
@ -368,10 +367,14 @@ void AllocGrays(int num)
|
||||
void InitFigures()
|
||||
{
|
||||
bmparrsize = figarrsize = figallocchunk;
|
||||
figures = static_cast<Figref**>
|
||||
(malloc(sizeof(Figref*) * figallocchunk));
|
||||
bitmaps = static_cast<figdata**>
|
||||
(malloc(sizeof(figdata*) * figallocchunk));
|
||||
typedef Figref * Figref_p;
|
||||
figures = new Figref_p[figallocchunk];
|
||||
//figures = static_cast<Figref**>
|
||||
// (malloc(sizeof(Figref*) * figallocchunk));
|
||||
typedef figdata * figdata_p;
|
||||
bitmaps = new figdata_p[figallocchunk];
|
||||
//bitmaps = static_cast<figdata**>
|
||||
//(malloc(sizeof(figdata*) * figallocchunk));
|
||||
|
||||
unsigned int k;
|
||||
for (unsigned int i = 0; i < 256; ++i) {
|
||||
@ -418,8 +421,10 @@ void InitFigures()
|
||||
|
||||
void DoneFigures()
|
||||
{
|
||||
free(figures);
|
||||
free(bitmaps);
|
||||
//free(figures);
|
||||
//free(bitmaps);
|
||||
delete[] figures;
|
||||
delete[] bitmaps;
|
||||
figarrsize = 0;
|
||||
bmparrsize = 0;
|
||||
|
||||
@ -667,8 +672,10 @@ static void runqueue()
|
||||
|
||||
// set up environment
|
||||
while (environ[ne]) ++ne;
|
||||
env = static_cast<char **>
|
||||
(malloc(sizeof(char*) * (ne + 2)));
|
||||
typedef char * char_p;
|
||||
env = new char_p[ne + 2];
|
||||
//env = static_cast<char **>
|
||||
// (malloc(sizeof(char*) * (ne + 2)));
|
||||
env[0] = tbuf2;
|
||||
memcpy(&env[1], environ, sizeof(char*) * (ne + 1));
|
||||
environ = env;
|
||||
@ -769,11 +776,14 @@ static figdata * getfigdata(int wid, int hgh, string const & fname,
|
||||
if (bmpinsref > bmparrsize) {
|
||||
// allocate more space
|
||||
bmparrsize += figallocchunk;
|
||||
figdata ** tmp = static_cast<figdata**>
|
||||
(malloc(sizeof(figdata*) * bmparrsize));
|
||||
typedef figdata * figdata_p;
|
||||
figdata ** tmp = new figdata_p[bmparrsize];
|
||||
//figdata ** tmp = static_cast<figdata**>
|
||||
// (malloc(sizeof(figdata*) * bmparrsize));
|
||||
memcpy(tmp, bitmaps,
|
||||
sizeof(figdata*) * (bmparrsize - figallocchunk));
|
||||
free(bitmaps);
|
||||
delete[] bitmaps;
|
||||
//free(bitmaps);
|
||||
bitmaps = tmp;
|
||||
}
|
||||
figdata * p = new figdata;
|
||||
@ -938,7 +948,7 @@ static void getbitmaps()
|
||||
}
|
||||
|
||||
|
||||
static void RegisterFigure(InsetFig *fi)
|
||||
static void RegisterFigure(InsetFig * fi)
|
||||
{
|
||||
if (figinsref == 0) InitFigures();
|
||||
fi->form = 0;
|
||||
@ -946,11 +956,14 @@ static void RegisterFigure(InsetFig *fi)
|
||||
if (figinsref > figarrsize) {
|
||||
// allocate more space
|
||||
figarrsize += figallocchunk;
|
||||
Figref ** tmp = static_cast<Figref**>
|
||||
(malloc(sizeof(Figref*)*figarrsize));
|
||||
typedef Figref * Figref_p;
|
||||
Figref ** tmp = new Figref_p[figarrsize];
|
||||
//Figref ** tmp = static_cast<Figref**>
|
||||
// (malloc(sizeof(Figref*)*figarrsize));
|
||||
memcpy(tmp, figures,
|
||||
sizeof(Figref*)*(figarrsize-figallocchunk));
|
||||
free(figures);
|
||||
delete[] figures;
|
||||
//free(figures);
|
||||
figures = tmp;
|
||||
}
|
||||
Figref * tmpfig = new Figref;
|
||||
@ -992,7 +1005,7 @@ static void UnregisterFigure(InsetFig * fi)
|
||||
#warning Reactivate this free_form calls
|
||||
#else
|
||||
fl_free_form(tmpfig->inset->form->Figure);
|
||||
free(tmpfig->inset->form);
|
||||
free(tmpfig->inset->form); // Why free?
|
||||
tmpfig->inset->form = 0;
|
||||
#endif
|
||||
}
|
||||
@ -1926,7 +1939,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
#warning Reactivate this free_form calls
|
||||
#else
|
||||
fl_free_form(form->Figure);
|
||||
free(form);
|
||||
free(form); // Why free?
|
||||
form = 0;
|
||||
#endif
|
||||
}
|
||||
@ -1944,7 +1957,7 @@ void InsetFig::CallbackFig(long arg)
|
||||
#warning Jug, is this still a problem?
|
||||
#else
|
||||
fl_free_form(form->Figure);
|
||||
free(form);
|
||||
free(form); // Why free?
|
||||
form = 0;
|
||||
#endif
|
||||
break;
|
||||
|
156
src/kbmap.C
156
src/kbmap.C
@ -345,9 +345,6 @@ int kb_keymap::bind(char const * seq, int action)
|
||||
|
||||
int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
|
||||
{
|
||||
#ifndef NO_HASH
|
||||
unsigned int hashval;
|
||||
#endif
|
||||
unsigned int ksym, msk1, msk0;
|
||||
kb_key * tab;
|
||||
|
||||
@ -361,18 +358,7 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifndef NO_HASH
|
||||
if(size < 0) { // --- if hash table ---
|
||||
hashval = ((key & 0xff) ^ ((key >> 8) & 0xff)) % KB_HASHSIZE;
|
||||
tab = htable[hashval];
|
||||
if(!tab) {
|
||||
seq->curmap = seq->stdmap;
|
||||
seq->delseq();
|
||||
return -1;
|
||||
}
|
||||
} else // --- else: linear list ---
|
||||
#endif
|
||||
tab = table;
|
||||
tab = table;
|
||||
|
||||
// --- now search the list of keys ---
|
||||
|
||||
@ -418,16 +404,7 @@ void kb_keymap::print(string & buf) const
|
||||
if (!table) return;
|
||||
|
||||
// Process each of its slots recursively and return.
|
||||
#ifndef NO_HASH
|
||||
if ( size < 0 ) { // Hash table
|
||||
for ( int ix = 0; ix < KB_HASHSIZE; ++ix ) {
|
||||
if ( htable[ix] ) {
|
||||
printKeyTab(htable[ix], buf);
|
||||
}
|
||||
}
|
||||
} else // Normal table
|
||||
#endif
|
||||
printKeyTab(table, buf);
|
||||
printKeyTab(table, buf);
|
||||
}
|
||||
|
||||
|
||||
@ -456,19 +433,6 @@ int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
|
||||
tab = table;
|
||||
ptab = &table;
|
||||
size = KB_PREALLOC;
|
||||
#ifndef NO_HASH
|
||||
} else if(size < 0) {
|
||||
// Hash table.
|
||||
int hashval = code & 0xffff;
|
||||
hashval = ((hashval & 0xff) ^ ((hashval >> 8) & 0xff)) % KB_HASHSIZE;
|
||||
tab = htable[hashval];
|
||||
ptab = htable+hashval;
|
||||
if(!tab) {
|
||||
tab = new kb_key[KB_PREALLOC];
|
||||
tab[0].code = NoSymbol;
|
||||
*ptab = tab;
|
||||
}
|
||||
#endif
|
||||
} else {
|
||||
tab = table;
|
||||
ptab = &table;
|
||||
@ -527,52 +491,6 @@ int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
|
||||
tab[tsize].mod = modmsk;
|
||||
kb_key * newone = &tab[tsize];
|
||||
|
||||
// --- convert list to hash table if necessary ----------------------
|
||||
|
||||
#ifndef NO_HASH
|
||||
if(size >= 0 && tsize >= 32) {
|
||||
kb_key * oldtab = tab;
|
||||
kb_key ** nht = new kb_key*[KB_HASHSIZE];
|
||||
for(int i = 0; i < KB_HASHSIZE; ++i)
|
||||
nht[i] = 0;
|
||||
htable = nht;
|
||||
size = -KB_HASHSIZE;
|
||||
|
||||
// --- copy old keys to new hash table ---
|
||||
int hashval;
|
||||
for(kb_key * tu = oldtab; tu->code != NoSymbol; ++tu) {
|
||||
// copy values from oldtab to htable
|
||||
hashval = (tu->code & 0xffff);
|
||||
hashval = ((hashval & 0xff) ^ ((hashval>>8) & 0xff)) % KB_HASHSIZE;
|
||||
tab = htable[hashval];
|
||||
|
||||
if(!tab){
|
||||
htable[hashval] = tab = new kb_key[KB_PREALLOC];
|
||||
tab->code = NoSymbol;
|
||||
}
|
||||
int ts = 1;
|
||||
for(kb_key * tt = tab; tt->code != NoSymbol; ++tt)
|
||||
++ts;
|
||||
if(ts % KB_PREALLOC == 0){
|
||||
// extend table
|
||||
kb_key * nt = new kb_key[ts+KB_PREALLOC];
|
||||
memcpy(nt, tab, ts * sizeof(kb_key));
|
||||
htable[hashval] = nt;
|
||||
delete[] tab;
|
||||
tab = nt;
|
||||
}
|
||||
tab[ts--].code = NoSymbol;
|
||||
tab[ts].code = tu->code;
|
||||
tab[ts].mod = tu->mod;
|
||||
tab[ts].action = tu->action;
|
||||
tab[ts].table = tu->table;
|
||||
|
||||
if(tu == newone)
|
||||
newone = &tab[ts];
|
||||
}
|
||||
delete[] oldtab;
|
||||
}
|
||||
#endif
|
||||
// --- define rest of sequence --------------------------------------
|
||||
|
||||
if(idx+1 == seq->length) {
|
||||
@ -598,27 +516,10 @@ int kb_keymap::defkey(kb_sequence * seq, int action, int idx /*= 0*/)
|
||||
kb_keymap::~kb_keymap()
|
||||
{
|
||||
if(!table) return;
|
||||
#ifndef NO_HASH
|
||||
if(size < 0) {
|
||||
for(int i = 0; i < KB_HASHSIZE; ++i) {
|
||||
if(htable[i]) {
|
||||
for(kb_key * t = htable[i];
|
||||
t->code != NoSymbol; ++t)
|
||||
if(t->table)
|
||||
delete t->table;
|
||||
delete htable[i];
|
||||
}
|
||||
}
|
||||
delete htable;
|
||||
} else {
|
||||
#endif
|
||||
for(kb_key * t = table; t->code != NoSymbol; ++t)
|
||||
if(t->table)
|
||||
delete t->table;
|
||||
delete table;
|
||||
#ifndef NO_HASH
|
||||
}
|
||||
#endif
|
||||
for(kb_key * t = table; t->code != NoSymbol; ++t)
|
||||
if(t->table)
|
||||
delete t->table;
|
||||
delete table;
|
||||
}
|
||||
|
||||
|
||||
@ -636,44 +537,19 @@ string kb_keymap::findbinding(int act) const
|
||||
string res;
|
||||
if (!table) return res;
|
||||
|
||||
#ifndef NO_HASH
|
||||
if (size < 0) {
|
||||
for(int i = 0; i < KB_HASHSIZE; ++i) {
|
||||
if(htable[i]) {
|
||||
for(kb_key * t = htable[i];
|
||||
t->code != NoSymbol; ++t) {
|
||||
if(t->table) {
|
||||
string suffix = t->table->findbinding(act);
|
||||
suffix = strip(suffix, ' ');
|
||||
suffix = strip(suffix, ']');
|
||||
suffix = frontStrip(suffix, '[');
|
||||
if (!suffix.empty()) {
|
||||
res += "[" + keyname(*t) + " " + suffix + "] ";
|
||||
}
|
||||
} else if (t->action == act) {
|
||||
res += "[" + keyname(*t) + "] ";
|
||||
}
|
||||
}
|
||||
for(kb_key * t = table; t->code != NoSymbol; ++t) {
|
||||
if(t->table) {
|
||||
string suffix = t->table->findbinding(act);
|
||||
suffix = strip(suffix, ' ');
|
||||
suffix = strip(suffix, ']');
|
||||
suffix = frontStrip(suffix, '[');
|
||||
if (!suffix.empty()) {
|
||||
res += "[" + keyname(*t) + " " + suffix + "] ";
|
||||
}
|
||||
} else if (t->action == act) {
|
||||
res += "[" + keyname(*t) + "] ";
|
||||
}
|
||||
} else {
|
||||
#endif
|
||||
for(kb_key * t = table; t->code != NoSymbol; ++t) {
|
||||
if(t->table) {
|
||||
string suffix = t->table->findbinding(act);
|
||||
suffix = strip(suffix, ' ');
|
||||
suffix = strip(suffix, ']');
|
||||
suffix = frontStrip(suffix, '[');
|
||||
if (!suffix.empty()) {
|
||||
res += "[" + keyname(*t) + " " + suffix + "] ";
|
||||
}
|
||||
} else if (t->action == act) {
|
||||
res += "[" + keyname(*t) + "] ";
|
||||
}
|
||||
}
|
||||
#ifndef NO_HASH
|
||||
}
|
||||
#endif
|
||||
return res;
|
||||
}
|
||||
|
||||
|
21
src/kbmap.h
21
src/kbmap.h
@ -17,13 +17,8 @@
|
||||
|
||||
#include "LString.h"
|
||||
|
||||
#define NO_HASH 1
|
||||
|
||||
#define KB_PREALLOC 16
|
||||
#ifndef NO_HASH
|
||||
#define KB_HASHSIZE 128 // yes, yes - I know. 128 is not exactly prime :-)
|
||||
// ... but we are dealing with ASCII chars mostly.
|
||||
#endif
|
||||
|
||||
class kb_keymap;
|
||||
class kb_sequence;
|
||||
|
||||
@ -75,18 +70,8 @@ private:
|
||||
int size;
|
||||
|
||||
/// Holds the defined keys
|
||||
/** Both kinds of tables ends with NoSymbol */
|
||||
#ifndef NO_HASH
|
||||
union
|
||||
{
|
||||
#endif
|
||||
/// Table for linear array
|
||||
kb_key * table;
|
||||
#ifndef NO_HASH
|
||||
/// Hash table holding key lists
|
||||
kb_key ** htable;
|
||||
};
|
||||
#endif
|
||||
/// Table for linear array, table ends with NoSymbol.
|
||||
kb_key * table;
|
||||
};
|
||||
|
||||
|
||||
|
@ -207,7 +207,6 @@ LyXGUI::~LyXGUI()
|
||||
}
|
||||
|
||||
CloseLyXLookup();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -193,6 +193,7 @@ void CloseLyXLookup()
|
||||
lyxerr[Debug::KEY] << "CloseLyXLookup: destroying input context"
|
||||
<< endl;
|
||||
XDestroyIC(xic);
|
||||
xic = 0;
|
||||
XCloseIM(xim);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "math_cursor.h"
|
||||
#include "math_parser.h"
|
||||
#include "lyx_main.h"
|
||||
#include "bufferlist.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "minibuffer.h"
|
||||
#include "BufferView.h"
|
||||
@ -42,13 +41,6 @@
|
||||
#include "LyXView.h"
|
||||
|
||||
extern void UpdateInset(Inset * inset, bool mark_dirty = true);
|
||||
//extern void LockedInsetStoreUndo(Undo::undo_kind);
|
||||
//extern void ShowLockedInsetCursor(long, long, int, int);
|
||||
//extern void HideLockedInsetCursor(long, long, int, int);
|
||||
//extern void FitLockedInsetCursor(long, long, int, int);
|
||||
//extern int LockInset(UpdatableInset *);
|
||||
//extern int UnlockInset(UpdatableInset *);
|
||||
|
||||
|
||||
extern GC canvasGC, mathGC, mathLineGC, latexGC, cursorGC, mathFrameGC;
|
||||
extern char * mathed_label;
|
||||
@ -57,7 +49,6 @@ extern int mono_video;
|
||||
extern int fast_selection;
|
||||
|
||||
extern BufferView * current_view;
|
||||
extern BufferList bufferlist;
|
||||
extern char const * latex_special_chars;
|
||||
|
||||
short greek_kb_flag = 0;
|
||||
|
@ -26,7 +26,6 @@
|
||||
#include "math_parser.h"
|
||||
#include "math_macro.h"
|
||||
#include "lyx_main.h"
|
||||
#include "bufferlist.h"
|
||||
#include "lyx_cb.h"
|
||||
#include "BufferView.h"
|
||||
#include "lyxscreen.h"
|
||||
|
@ -11,14 +11,21 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
|
||||
#include "math_defs.h"
|
||||
#include "symbol_def.h"
|
||||
|
||||
using std::sort;
|
||||
using std::lower_bound;
|
||||
|
||||
// This table includes all binary operators and relations
|
||||
struct binary_op_pair { short id, isrel; } binary_op_table[] = {
|
||||
struct binary_op_pair {
|
||||
short id;
|
||||
short isrel;
|
||||
};
|
||||
|
||||
binary_op_pair binary_op_table[] = {
|
||||
{ LM_leq, LMB_RELATION }, { LM_geq, LMB_RELATION },
|
||||
{ LM_equiv, LMB_RELATION }, { LM_models, LMB_RELATION },
|
||||
{ LM_prec, LMB_RELATION }, { LM_succ, LMB_RELATION },
|
||||
@ -55,34 +62,35 @@ struct binary_op_pair { short id, isrel; } binary_op_table[] = {
|
||||
{ LM_ddagger, LMB_OPERATOR }
|
||||
};
|
||||
|
||||
extern "C" int compara(const void *a, const void *b)
|
||||
{
|
||||
int i = ((binary_op_pair const *)a)->id, j = ((binary_op_pair const*)b)->id;
|
||||
return i - j;
|
||||
}
|
||||
|
||||
struct compara {
|
||||
// used by sort
|
||||
int operator()(binary_op_pair const & a,
|
||||
binary_op_pair const & b) const {
|
||||
return a.id < b.id;
|
||||
}
|
||||
// used by lower_bound
|
||||
int operator()(binary_op_pair const & a, short int id) const {
|
||||
return a.id < id;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int MathedLookupBOP(short id)
|
||||
{
|
||||
static int bopCount = sizeof(binary_op_table) / sizeof(binary_op_pair);
|
||||
static bool issorted = false;
|
||||
static int bopCount = sizeof(binary_op_table) / sizeof(binary_op_pair);
|
||||
static bool issorted = false;
|
||||
|
||||
if (!issorted) {
|
||||
qsort(binary_op_table, bopCount, sizeof(binary_op_pair), compara);
|
||||
issorted = true;
|
||||
}
|
||||
if (!issorted) {
|
||||
sort(binary_op_table, binary_op_table + bopCount, compara());
|
||||
issorted = true;
|
||||
}
|
||||
|
||||
int result= 0, m, k, l= 0, r = bopCount;
|
||||
|
||||
while (l < r) {
|
||||
m = (l+r)/2;
|
||||
k = binary_op_table[m].id - id;
|
||||
if (k == 0) {
|
||||
result = binary_op_table[m].isrel;
|
||||
break;
|
||||
} else
|
||||
if (k<0) l = m+1; else r = m;
|
||||
}
|
||||
|
||||
return result;
|
||||
int result = 0;
|
||||
binary_op_pair * res = lower_bound(binary_op_table,
|
||||
binary_op_table + bopCount,
|
||||
id, compara());
|
||||
if (res != (binary_op_table + bopCount))
|
||||
result = res->isrel;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
11
src/menus.C
11
src/menus.C
@ -1558,7 +1558,16 @@ void Menus::ShowBufferMenu(FL_OBJECT * ob, long)
|
||||
fl_redraw_object(ob);
|
||||
|
||||
int BufferMenu = fl_newpup(FL_ObjWin(ob));
|
||||
bufferlist.makePup(BufferMenu);
|
||||
vector<string> namevec = bufferlist.getFileNames();
|
||||
if (namevec.size() != 0) {
|
||||
for (vector<string>::const_iterator cit = namevec.begin();
|
||||
cit != namevec.end(); ++cit) {
|
||||
string relbuf = MakeDisplayPath((*cit), 30);
|
||||
fl_addtopup(BufferMenu, relbuf.c_str());
|
||||
}
|
||||
} else {
|
||||
fl_addtopup(BufferMenu, _("No Documents Open!%t"));
|
||||
}
|
||||
|
||||
fl_setpup_position(
|
||||
men->_view->getForm()->x + ob->x,
|
||||
|
109
src/paragraph.C
109
src/paragraph.C
@ -334,8 +334,9 @@ void LyXParagraph::writeFile(ostream & os, BufferParams & params,
|
||||
void LyXParagraph::validate(LaTeXFeatures & features)
|
||||
{
|
||||
// this will be useful later
|
||||
LyXLayout const & layout = textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
LyXLayout const & layout =
|
||||
textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
|
||||
// check the params.
|
||||
if (line_top || line_bottom)
|
||||
@ -448,6 +449,7 @@ void LyXParagraph::CopyIntoMinibuffer(LyXParagraph::size_type pos) const
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void LyXParagraph::CutIntoMinibuffer(LyXParagraph::size_type pos)
|
||||
{
|
||||
minibuffer_char = GetChar(pos);
|
||||
@ -1000,7 +1002,9 @@ LyXFont LyXParagraph::getFont(LyXParagraph::size_type pos) const
|
||||
}
|
||||
}
|
||||
|
||||
tmpfont.realize(textclasslist.TextClass(current_view->buffer()->params.textclass).defaultfont());
|
||||
tmpfont.realize(textclasslist
|
||||
.TextClass(current_view->buffer()->params.textclass)
|
||||
.defaultfont());
|
||||
return tmpfont;
|
||||
}
|
||||
|
||||
@ -2104,7 +2108,7 @@ int LyXParagraph::BeginningOfMainBody() const
|
||||
if (i == 0 && i == size() &&
|
||||
!(footnoteflag == LyXParagraph::NO_FOOTNOTE
|
||||
&& next && next->footnoteflag != LyXParagraph::NO_FOOTNOTE))
|
||||
i++; /* the cursor should not jump
|
||||
++i; /* the cursor should not jump
|
||||
* to the main body if there
|
||||
* is nothing in! */
|
||||
return i;
|
||||
@ -2485,7 +2489,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
|
||||
texrow.start(this, 0);
|
||||
|
||||
for (size_type i = 0; i < size(); ++i) {
|
||||
column++;
|
||||
++column;
|
||||
// First char in paragraph or after label?
|
||||
if (i == main_body && !IsDummy()) {
|
||||
if (main_body > 0) {
|
||||
@ -2496,11 +2500,11 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
|
||||
basefont = getFont(-1); // Now use the layout font
|
||||
running_font = basefont;
|
||||
file += ']';
|
||||
column++;
|
||||
++column;
|
||||
}
|
||||
if (style.isCommand()) {
|
||||
file += '{';
|
||||
column++;
|
||||
++column;
|
||||
} else if (align != LYX_ALIGN_LAYOUT) {
|
||||
file += "{\\par";
|
||||
column += 4;
|
||||
@ -2542,7 +2546,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
|
||||
if (open_font && c == ' ' && i <= size() - 2
|
||||
&& !getFont(i+1).equalExceptLatex(running_font)
|
||||
&& !getFont(i+1).equalExceptLatex(font)) {
|
||||
font = getFont(i+1);
|
||||
font = getFont(i + 1);
|
||||
}
|
||||
// We end font definition before blanks
|
||||
if (!font.equalExceptLatex(running_font) && open_font) {
|
||||
@ -2589,7 +2593,7 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
|
||||
file += "\\\\\n";
|
||||
}
|
||||
texrow.newline();
|
||||
texrow.start(this, i+1);
|
||||
texrow.start(this, i + 1);
|
||||
column = 0;
|
||||
} else {
|
||||
SimpleTeXSpecialChars(file, texrow,
|
||||
@ -2618,28 +2622,21 @@ bool LyXParagraph::SimpleTeXOnePar(string & file, TexRow & texrow)
|
||||
bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
|
||||
{
|
||||
lyxerr[Debug::LATEX] << "SimpleTeXOneTablePar... " << this << endl;
|
||||
char c;
|
||||
int tmp;
|
||||
|
||||
bool return_value = false;
|
||||
int current_cell_number = -1;
|
||||
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(current_view->buffer()->params.textclass, GetLayout());
|
||||
LyXFont basefont = getFont(-1); // Get layout font
|
||||
// Which font is currently active?
|
||||
LyXFont running_font = basefont;
|
||||
// Do we have an open font change?
|
||||
bool open_font = false;
|
||||
textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
|
||||
int column = 0;
|
||||
if (!IsDummy()) { // it is dummy if it is in a float!!!
|
||||
if (style.isCommand()) {
|
||||
file += '{';
|
||||
column++;
|
||||
++column;
|
||||
} else if (align != LYX_ALIGN_LAYOUT) {
|
||||
file += '{';
|
||||
column++;
|
||||
++column;
|
||||
return_value = true;
|
||||
}
|
||||
if (noindent) {
|
||||
@ -2665,15 +2662,21 @@ bool LyXParagraph::SimpleTeXOneTablePar(string & file, TexRow & texrow)
|
||||
break;
|
||||
}
|
||||
}
|
||||
current_cell_number = -1;
|
||||
tmp = table->TexEndOfCell(file, current_cell_number);
|
||||
|
||||
LyXFont basefont = getFont(-1); // Get layout font
|
||||
// Which font is currently active?
|
||||
LyXFont running_font = basefont;
|
||||
// Do we have an open font change?
|
||||
bool open_font = false;
|
||||
int current_cell_number = -1;
|
||||
int tmp = table->TexEndOfCell(file, current_cell_number);
|
||||
for (; tmp > 0 ; --tmp)
|
||||
texrow.newline();
|
||||
|
||||
texrow.start(this, 0);
|
||||
|
||||
for (size_type i = 0; i < size(); ++i) {
|
||||
c = GetChar(i);
|
||||
char c = GetChar(i);
|
||||
if (table->IsContRow(current_cell_number+1)) {
|
||||
if (c == LyXParagraph::META_NEWLINE)
|
||||
current_cell_number++;
|
||||
@ -2786,11 +2789,10 @@ bool LyXParagraph::TeXContTableRows(string & file,
|
||||
char c;
|
||||
|
||||
bool return_value = false;
|
||||
LyXLayout const & style = textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
LyXFont basefont;
|
||||
|
||||
basefont = getFont(-1); // Get layout font
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
LyXFont basefont = getFont(-1); // Get layout font
|
||||
// Which font is currently active?
|
||||
LyXFont running_font = basefont;
|
||||
// Do we have an open font change?
|
||||
@ -2961,8 +2963,9 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
|
||||
string emph = "emphasis";
|
||||
bool emph_flag = false;
|
||||
|
||||
LyXLayout const & style = textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
|
||||
if (style.labeltype != LABEL_MANUAL)
|
||||
main_body = 0;
|
||||
@ -3064,7 +3067,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
|
||||
// "TeX"-Mode on == > SGML-Mode on.
|
||||
if (c != '\0')
|
||||
file += c;
|
||||
char_line_count++;
|
||||
++char_line_count;
|
||||
} else {
|
||||
string sgml_string;
|
||||
if (linuxDocConvertChar(c, sgml_string)
|
||||
@ -3096,7 +3099,7 @@ void LyXParagraph::SimpleDocBookOneTablePar(string & file, string & extra,
|
||||
file += "</emphasis>";
|
||||
}
|
||||
|
||||
current_cell_number++;
|
||||
++current_cell_number;
|
||||
tmp = table->DocBookEndOfCell(file, current_cell_number, depth);
|
||||
// Resets description flag correctly.
|
||||
switch(desc_on){
|
||||
@ -3123,32 +3126,32 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
|
||||
|
||||
lyxerr[Debug::LATEX] << "DocBookContTableRows... " << this << endl;
|
||||
|
||||
int cell;
|
||||
LyXFont font1, font2;
|
||||
LyXFont font2;
|
||||
char c;
|
||||
Inset * inset;
|
||||
size_type main_body;
|
||||
size_type lastpos;
|
||||
string emph= "emphasis";
|
||||
bool emph_flag= false;
|
||||
int char_line_count= 0;
|
||||
|
||||
LyXLayout const & style = textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
GetLayout());
|
||||
|
||||
size_type main_body;
|
||||
if (style.labeltype != LABEL_MANUAL)
|
||||
main_body = 0;
|
||||
else
|
||||
main_body = BeginningOfMainBody();
|
||||
|
||||
// Gets paragraph main font.
|
||||
LyXFont font1;
|
||||
if (main_body > 0)
|
||||
font1 = style.labelfont;
|
||||
else
|
||||
font1 = style.font;
|
||||
|
||||
lastpos = i;
|
||||
cell = table->CellHasContRow(current_cell_number);
|
||||
size_type lastpos = i;
|
||||
int cell = table->CellHasContRow(current_cell_number);
|
||||
++current_cell_number;
|
||||
while(cell >= 0) {
|
||||
// first find the right position
|
||||
@ -3195,11 +3198,13 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
|
||||
//
|
||||
// This code needs some explanation:
|
||||
// Two insets are treated specially
|
||||
// label if it is the first element in a command paragraph
|
||||
// label if it is the first element in a
|
||||
// command paragraph
|
||||
// desc_on == 3
|
||||
// graphics inside tables or figure floats can't go on
|
||||
// title (the equivalente in latex for this case is caption
|
||||
// and title should come first
|
||||
// graphics inside tables or figure floats
|
||||
// can't go on title (the equivalente in
|
||||
// latex for this case is caption and title
|
||||
// should come first
|
||||
// desc_on == 4
|
||||
//
|
||||
if(desc_on != 3 || i != 0) {
|
||||
@ -3215,14 +3220,14 @@ void LyXParagraph::DocBookContTableRows(string & file, string & extra,
|
||||
// "TeX"-Mode on == > SGML-Mode on.
|
||||
if (c!= '\0')
|
||||
file += c;
|
||||
char_line_count++;
|
||||
++char_line_count;
|
||||
} else {
|
||||
string sgml_string;
|
||||
if (linuxDocConvertChar(c, sgml_string)
|
||||
&& !style.free_spacing) {
|
||||
// in freespacing mode, spaces are
|
||||
// non-breaking characters
|
||||
// char is ' '
|
||||
// in freespacing mode, spaces are
|
||||
// non-breaking characters
|
||||
// char is ' '
|
||||
if (desc_on == 1) {
|
||||
char_line_count++;
|
||||
file += '\n';
|
||||
@ -3653,7 +3658,8 @@ LyXParagraph * LyXParagraph::TeXDeeper(string & file, TexRow & texrow,
|
||||
|
||||
|
||||
LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
|
||||
string & foot, TexRow & foot_texrow,
|
||||
string & foot,
|
||||
TexRow & foot_texrow,
|
||||
int & foot_count)
|
||||
{
|
||||
bool eindent_open = false;
|
||||
@ -3667,8 +3673,9 @@ LyXParagraph * LyXParagraph::TeXEnvironment(string & file, TexRow & texrow,
|
||||
if (IsDummy())
|
||||
lyxerr << "ERROR (LyXParagraph::TeXEnvironment)" << endl;
|
||||
|
||||
LyXLayout const & style = textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
layout);
|
||||
LyXLayout const & style =
|
||||
textclasslist.Style(current_view->buffer()->params.textclass,
|
||||
layout);
|
||||
|
||||
if (pextra_type == PEXTRA_INDENT) {
|
||||
if (!pextra_width.empty()) {
|
||||
|
@ -8,30 +8,19 @@
|
||||
|
||||
#ifdef ENABLE_ASSERTIONS
|
||||
|
||||
//template<class X, class A> inline void Assert(A assertion)
|
||||
template<class A> inline void Assert(A assertion)
|
||||
{
|
||||
//if (!assertion) throw X();
|
||||
if (!assertion) {
|
||||
lyx::abort();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//template<class A, class E> inline void Assert(A assertion, E except)
|
||||
//{
|
||||
// if (!assertion) except;
|
||||
//}
|
||||
|
||||
#else
|
||||
|
||||
template<class A> inline void Assert(A /*assertion*/) {}
|
||||
|
||||
#endif /* ENABLE_ASSERTIONS */
|
||||
|
||||
|
||||
//} // end of namespace LyX
|
||||
|
||||
|
||||
#endif /* LASSERT_H */
|
||||
|
||||
|
@ -36,7 +36,9 @@ libsupport_la_SOURCES = \
|
||||
lstrings.h \
|
||||
lyxlib.h \
|
||||
$(LYXSTRING) lyxsum.C \
|
||||
mkdir.C \
|
||||
path.h \
|
||||
putenv.C \
|
||||
$(REGEX) syscall.C \
|
||||
syscall.h \
|
||||
syscontr.C \
|
||||
|
@ -188,7 +188,7 @@ int IsDirWriteable (string const & path)
|
||||
// If path entry begins with $$User/, use user_lyxdir
|
||||
// Example: "$$User/doc;$$LyX/doc"
|
||||
string FileOpenSearch (string const & path, string const & name,
|
||||
string const & ext)
|
||||
string const & ext)
|
||||
{
|
||||
string real_file, path_element;
|
||||
bool notfound = true;
|
||||
@ -204,11 +204,11 @@ string FileOpenSearch (string const & path, string const & name,
|
||||
real_file = FileSearch(path_element, name, ext);
|
||||
|
||||
if (real_file.empty()) {
|
||||
do {
|
||||
tmppath = split(tmppath, path_element, ';');
|
||||
} while(!tmppath.empty() && path_element.empty());
|
||||
do {
|
||||
tmppath = split(tmppath, path_element, ';');
|
||||
} while(!tmppath.empty() && path_element.empty());
|
||||
} else {
|
||||
notfound = false;
|
||||
notfound = false;
|
||||
}
|
||||
}
|
||||
#ifdef __EMX__
|
||||
@ -278,7 +278,7 @@ string i18nLibFileSearch(string const & dir, string const & name,
|
||||
return LibFileSearch(dir, name, ext);
|
||||
else {
|
||||
string tmp = LibFileSearch(dir, lang + '_' + name,
|
||||
ext);
|
||||
ext);
|
||||
if (!tmp.empty())
|
||||
return tmp;
|
||||
else
|
||||
@ -322,17 +322,19 @@ bool PutEnv(string const & envstr)
|
||||
// does not make a copy of the string. It is also not very wise to
|
||||
// put a string on the free store. If we have to leak we should do it
|
||||
// like this:
|
||||
/*
|
||||
char * leaker = new char[envstr.length() + 1];
|
||||
envstr.copy(leaker, envstr.length());
|
||||
leaker[envstr.length()] = '\0';
|
||||
int retval = putenv(const_cast<PUTENV_TYPE_ARG>(leaker));
|
||||
*/
|
||||
int retval = lyx::putenv(leaker);
|
||||
|
||||
// If putenv does not make a copy of the char const * this
|
||||
// is very dangerous. OTOH if it does take a copy this is the
|
||||
// best solution.
|
||||
int retval = putenv(const_cast<PUTENV_TYPE_ARG>(envstr.c_str()));
|
||||
// The only implementation of putenv that I have seen does not
|
||||
// allocate memory. _And_ after testing the putenv in glibc it
|
||||
// seems that we need to make a copy of the string contents.
|
||||
// I will enable the above.
|
||||
//int retval = lyx::putenv(envstr.c_str());
|
||||
#else
|
||||
#ifdef HAVE_SETENV
|
||||
string varname;
|
||||
@ -353,6 +355,24 @@ bool PutEnvPath(string const & envstr)
|
||||
static
|
||||
int DeleteAllFilesInDir (string const & path)
|
||||
{
|
||||
// I have decided that we will be using parts from the boost
|
||||
// library. Check out http://www.boost.org/
|
||||
// For directory access we will then use the directory_iterator.
|
||||
// Then the code will be something like:
|
||||
// directory_iterator dit(path.c_str());
|
||||
// if (<some way to detect failure>) {
|
||||
// WriteFSAlert(_("Error! Cannot open directory:"), path);
|
||||
// return -1;
|
||||
// }
|
||||
// for (; dit != <someend>; ++dit) {
|
||||
// if ((*dit) == 2." || (*dit) == "..")
|
||||
// continue;
|
||||
// string unlinkpath = AddName(path, temp);
|
||||
// if (remove(unlinkpath.c_str()))
|
||||
// WriteFSAlert(_("Error! Could not remove file:"),
|
||||
// unlinkpath);
|
||||
// }
|
||||
// return 0;
|
||||
DIR * dir = opendir(path.c_str());
|
||||
if (!dir) {
|
||||
WriteFSAlert (_("Error! Cannot open directory:"), path);
|
||||
@ -381,7 +401,7 @@ string CreateTmpDir (string const & tempdir, string const & mask)
|
||||
{
|
||||
string tmpfl = TmpFileName(tempdir, mask);
|
||||
|
||||
if ((tmpfl.empty()) || mkdir (tmpfl.c_str(), 0777)) {
|
||||
if ((tmpfl.empty()) || lyx::mkdir (tmpfl.c_str(), 0777)) {
|
||||
WriteFSAlert(_("Error! Couldn't create temporary directory:"),
|
||||
tempdir);
|
||||
return string();
|
||||
@ -421,7 +441,7 @@ int DestroyBufferTmpDir (string const & tmpdir)
|
||||
string CreateLyXTmpDir (string const & deflt)
|
||||
{
|
||||
if ((!deflt.empty()) && (deflt != "/tmp")) {
|
||||
if (mkdir(deflt.c_str(), 0777)) {
|
||||
if (lyx::mkdir(deflt.c_str(), 0777)) {
|
||||
#ifdef __EMX__
|
||||
Path p(user_lyxdir);
|
||||
#endif
|
||||
@ -456,7 +476,7 @@ bool createDirectory(string const & path, int permission)
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mkdir(temp.c_str(), permission)) {
|
||||
if (lyx::mkdir(temp.c_str(), permission)) {
|
||||
WriteFSAlert (_("Error! Couldn't create directory:"), temp);
|
||||
return false;
|
||||
}
|
||||
|
@ -35,6 +35,10 @@ namespace lyx {
|
||||
int kill(long int pid, int sig);
|
||||
///
|
||||
void abort();
|
||||
///
|
||||
int mkdir(char const * pathname, unsigned int mode);
|
||||
///
|
||||
int putenv(char const * str);
|
||||
}
|
||||
#else
|
||||
struct lyx {
|
||||
@ -52,6 +56,10 @@ struct lyx {
|
||||
static int kill(long int pid, int sig);
|
||||
///
|
||||
static void abort();
|
||||
///
|
||||
static int mkdir(char const * pathname, unsigned int mode);
|
||||
///
|
||||
static int putenv(char const * str);
|
||||
};
|
||||
#endif // CXX_WORKING_NAMESPACES
|
||||
#endif
|
||||
|
22
src/support/mkdir.C
Normal file
22
src/support/mkdir.C
Normal file
@ -0,0 +1,22 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef CXX_WORKING_NAMESPACES
|
||||
namespace lyx {
|
||||
int mkdir(char const * pathname, mode_t mode)
|
||||
{
|
||||
return ::mkdir(pathname, mode);
|
||||
}
|
||||
}
|
||||
#else
|
||||
#include "lyxlib.h"
|
||||
|
||||
int lyx::mkdir(char const * pathname, mode_t mode)
|
||||
{
|
||||
return ::mkdir(pathname, mode);
|
||||
}
|
||||
#endif
|
19
src/support/putenv.C
Normal file
19
src/support/putenv.C
Normal file
@ -0,0 +1,19 @@
|
||||
#include <config.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef CXX_WORKING_NAMESPACES
|
||||
namespace lyx {
|
||||
int putenv(char const * str)
|
||||
{
|
||||
return ::putenv(const_cast<char*>(str));
|
||||
}
|
||||
}
|
||||
#else
|
||||
#include "lyxlib.h"
|
||||
int lyx::putenv(char const * str)
|
||||
{
|
||||
return ::putenv(const_cast<char*>(str));
|
||||
}
|
||||
|
||||
#endif
|
Loading…
Reference in New Issue
Block a user