mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +00:00
small things.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@375 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
af1ecc336d
commit
e8db0ccc46
@ -193,8 +193,8 @@ dnl Check the version of g++
|
||||
fi
|
||||
if test x$with_warnings = xyes ; then
|
||||
case $gxx_version in
|
||||
2.95.*) CXXFLAGS="$CXXFLAGS -Wall";;
|
||||
*) CXXFLAGS="$CXXFLAGS -ansi -Wall";;
|
||||
2.95.*) CXXFLAGS="$CXXFLAGS -Wall -W -Wconversion";;
|
||||
*) CXXFLAGS="$CXXFLAGS -ansi -Wall -W";;
|
||||
esac
|
||||
if test $lyx_devel_version = yes ; then
|
||||
case $gxx_version in
|
||||
|
@ -1,9 +1,17 @@
|
||||
Rules for the code in LyX
|
||||
-------------------------
|
||||
[updated from the C++STYLE distrubuted with the GNU C++ Standard]
|
||||
|
||||
The aim of this file is to serve as a guide for the developers, to aid us to
|
||||
get clean and uniform code. Still uncomplete.
|
||||
|
||||
We really like to have new developers joining the LyX Project. However
|
||||
since we have had problems in the past with developers leaving the
|
||||
project and their contributed code in a far from perfect state. Most
|
||||
of this happened before that we really became aware of these issues,
|
||||
but still, we don't want it to happen again. So we have put together
|
||||
some guidelines and rules for the developers.
|
||||
|
||||
In general, if you want to contribute to the main source, we expect at least
|
||||
that you:
|
||||
|
||||
@ -12,24 +20,70 @@ that you:
|
||||
- adapt the code to the structures already existing in LyX, or in case that
|
||||
you have better ideas, discuss them on the developer's list before writing
|
||||
the code.
|
||||
- take advantage of the C++ standard library.
|
||||
|
||||
These guidelines should save us a lot of work while cleaning up the code and
|
||||
help us to have quality code. LyX has been haunted by problems coming from
|
||||
unfinished projects by people who have left the team. Those problems will
|
||||
hopefully disappear if the code is easy to hand over to somebody else.
|
||||
|
||||
When you send in a patch or commit to the LyX cvs repository we expect
|
||||
you to add a ChangeLog entry. The entry should have this syntax:
|
||||
|
||||
1999-12-13 Lars Gullik Bjønnes <larsbj@lyx.org>
|
||||
|
||||
* src/support/lyxstring.C (find): assert bug fixed.
|
||||
|
||||
* Pointers and references
|
||||
char * p = "flop";
|
||||
char & c = *p;
|
||||
-NOT-
|
||||
char *p = "flop"; // wrong
|
||||
char &c = *p; // wrong
|
||||
|
||||
Some time ago we had a huge discusion on this subject and after
|
||||
convincing argumentation from Asger this is what we decided. Also note
|
||||
that we will have:
|
||||
char const * p;
|
||||
-NOT-
|
||||
const char * p;
|
||||
|
||||
* Operator names and parentheses
|
||||
operator==(type)
|
||||
-NOT-
|
||||
operator == (type) // wrong
|
||||
|
||||
The == is part of the function name, separating it makes the
|
||||
declaration look like an expression.
|
||||
|
||||
* Function names and parentheses
|
||||
void mangle()
|
||||
-NOT-
|
||||
void mangle () // wrong
|
||||
|
||||
* Enumerators
|
||||
enum {
|
||||
one = 1,
|
||||
two = 2,
|
||||
three = 3
|
||||
};
|
||||
-NOT-
|
||||
enum { one = 1, two = 2, three 3 };
|
||||
|
||||
* Naming rules for classes
|
||||
|
||||
- Use descriptive but simple and short names. For stuff specific to LyX
|
||||
use LyX as prefix. Some modules, like mathed or spellchecker, could have
|
||||
other prefixes.
|
||||
[I am not so sure about the LyX prefix]
|
||||
|
||||
- Class names are usually capitalized, and function names lowercased.
|
||||
Enums are in CAPS.
|
||||
Enums are named like Classes, enum values in CAPS.
|
||||
|
||||
- Long variables are named like thisLongVariableName.
|
||||
|
||||
New types are capitalized, so this goes for typedefs,classes,structs
|
||||
and enums.
|
||||
|
||||
* Formatting
|
||||
|
||||
@ -41,12 +95,16 @@ hopefully disappear if the code is easy to hand over to somebody else.
|
||||
|
||||
* Use existing structures
|
||||
|
||||
- Use LString whereever possible. LyX will someday move to Unicode, and
|
||||
that will be easy if everybody uses LString now.
|
||||
- Use string whereever possible. LyX will someday move to Unicode, and
|
||||
that will be easy if everybody uses string now.
|
||||
|
||||
- Check out the filename and path tools in filetools.h
|
||||
|
||||
- Use the Error class to report errors and messages
|
||||
- Check out the string tools in lstring.h, and the SubString class
|
||||
and the regex class.
|
||||
|
||||
- Use the DebugStream class to report errors and messages using
|
||||
the lyxerr instantation.
|
||||
|
||||
[add description of other existing structures]
|
||||
|
||||
@ -56,7 +114,9 @@ hopefully disappear if the code is easy to hand over to somebody else.
|
||||
- Use this order for the access sections of your class: public,
|
||||
protected, private. The public section is interesting for every
|
||||
user of the class. The private section is only of interest for the
|
||||
implementors of the class (you).
|
||||
implementors of the class (you). [Obvously not true since this is
|
||||
for developers, and we do not want one developer only to be able to
|
||||
read and understand the implementation of class internals. Lgb]
|
||||
|
||||
- Avoid to declare global objects in the declaration file of the class.
|
||||
If the same variable is used for all object, use a static member.
|
||||
@ -74,8 +134,7 @@ hopefully disappear if the code is easy to hand over to somebody else.
|
||||
- You document for the other developers, not for yourself.
|
||||
- You should document what the funtion do, not the implementation.
|
||||
- in the .C files you document the implementation.
|
||||
- Short description (///), large description (/** ... */)
|
||||
(someone explain this please)
|
||||
- Single line description (///), multiple lines description (/** ... */)
|
||||
- You make the documentation by doing "make srcdoc" in the root,
|
||||
and then you'll find HTML in the srcdoc/ directory. Read with
|
||||
Netscape for best results.
|
||||
|
@ -5,4 +5,3 @@ POTFILES
|
||||
*.mo
|
||||
cat-id-tbl.c
|
||||
stamp-cat-id
|
||||
lyx.pot
|
||||
|
@ -4,8 +4,8 @@
|
||||
*
|
||||
* LyX, The Document Processor
|
||||
*
|
||||
* Copyright (C) 1995 Matthias Ettrich
|
||||
* Copyright (C) 1995-1999 The LyX Team.
|
||||
* Copyright 1995 Matthias Ettrich
|
||||
* Copyright 1995-1999 The LyX Team.
|
||||
*
|
||||
* ====================================================== */
|
||||
|
||||
@ -25,7 +25,7 @@ typedef lyxstring string;
|
||||
// __get_c_string() ourselves since SGI expects it to exist and block
|
||||
// their string declarations as best we can. ARRae.
|
||||
# define __SGI_STL_STRING_FWD_H
|
||||
static const char* __get_c_string(const string&);
|
||||
static char const * __get_c_string(string const &);
|
||||
#endif // HAVE_STL_STRING_FWD_H
|
||||
#endif
|
||||
#endif
|
||||
|
@ -70,7 +70,7 @@ int Literate::weave(TeXErrors & terr, MiniBuffer * minib)
|
||||
}
|
||||
|
||||
|
||||
int Literate::build(TeXErrors & terr, MiniBuffer * minib)
|
||||
int Literate::build(TeXErrors & /*terr*/, MiniBuffer * minib)
|
||||
// We know that this function will only be run if the lyx buffer
|
||||
// has been changed.
|
||||
{
|
||||
|
@ -260,7 +260,12 @@ void fl_set_bmtable_pixmap_data(FL_OBJECT * ob, int nx, int ny,
|
||||
sp->maxi = sp->nx * sp->ny;
|
||||
sp->bdata = 0;
|
||||
Pixmap dummy_shapemask = 0;
|
||||
XpmAttributes dumb_attributes= {0};
|
||||
#if 0
|
||||
// I can't see why this initalization is needed. (Lgb)
|
||||
XpmAttributes dumb_attributes = {0};
|
||||
#else
|
||||
XpmAttributes dumb_attributes;
|
||||
#endif
|
||||
dumb_attributes.colormap = color_map;
|
||||
dumb_attributes.closeness = 30000;
|
||||
dumb_attributes.valuemask = XpmColormap | XpmCloseness;
|
||||
@ -324,7 +329,11 @@ void fl_set_bmtable_pixmap_file(FL_OBJECT *ob, int nx, int ny, char const *filen
|
||||
sp->bdata = 0;
|
||||
|
||||
Pixmap dummy_shapemask = 0;
|
||||
XpmAttributes dumb_attributes= {0};
|
||||
#if 0
|
||||
XpmAttributes dumb_attributes = {0};
|
||||
#else
|
||||
XpmAttributes dumb_attributes;
|
||||
#endif
|
||||
dumb_attributes.colormap = color_map;
|
||||
dumb_attributes.closeness = 30000;
|
||||
dumb_attributes.valuemask = XpmColormap | XpmCloseness;
|
||||
|
@ -1240,7 +1240,7 @@ bool Buffer::writeFile(string const & filename, bool flag)
|
||||
lyxerr << _("Error! Cannot open file: ")
|
||||
<< filename << endl;
|
||||
else
|
||||
WriteFSAlert(_("Error! Canno open file:"),
|
||||
WriteFSAlert(_("Error! Cannot open file: "),
|
||||
filename);
|
||||
return false;
|
||||
}
|
||||
@ -1611,7 +1611,7 @@ void Buffer::makeLaTeXFile(string const & filename,
|
||||
|
||||
ofstream ofs(filename.c_str());
|
||||
if (!ofs) {
|
||||
WriteFSAlert(_("Error: Cannot open file:"), filename);
|
||||
WriteFSAlert(_("Error: Cannot open file: "), filename);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -2534,7 +2534,7 @@ void linux_doc_line_break(ostream & os, unsigned int & colcount,
|
||||
|
||||
|
||||
void Buffer::SimpleLinuxDocOnePar(ostream & os, LyXParagraph * par,
|
||||
int desc_on, int const depth)
|
||||
int desc_on, int const /*depth*/)
|
||||
{
|
||||
LyXFont font1, font2;
|
||||
char c;
|
||||
|
17
src/debug.C
17
src/debug.C
@ -40,8 +40,10 @@ static error_item errorTags[] = {
|
||||
{ Debug::ANY, "any", "All debugging messages"}
|
||||
};
|
||||
|
||||
|
||||
static const int numErrorTags = sizeof(errorTags)/sizeof(error_item);
|
||||
|
||||
|
||||
Debug::type Debug::value(string const & val)
|
||||
{
|
||||
type l = Debug::NONE;
|
||||
@ -56,7 +58,7 @@ Debug::type Debug::value(string const & val)
|
||||
l |= static_cast<type>(strToInt(tmp));
|
||||
else
|
||||
// Search for an explicit name
|
||||
for (int i = 0 ; i<numErrorTags ; ++i)
|
||||
for (int i = 0 ; i < numErrorTags ; ++i)
|
||||
if (tmp == errorTags[i].name) {
|
||||
l |= errorTags[i].level;
|
||||
break;
|
||||
@ -67,7 +69,8 @@ Debug::type Debug::value(string const & val)
|
||||
return l;
|
||||
}
|
||||
|
||||
void Debug::showLevel(ostream &o, Debug::type level)
|
||||
|
||||
void Debug::showLevel(ostream & o, Debug::type level)
|
||||
{
|
||||
// Show what features are traced
|
||||
for (int i = 0 ; i < numErrorTags ; ++i)
|
||||
@ -79,13 +82,13 @@ void Debug::showLevel(ostream &o, Debug::type level)
|
||||
}
|
||||
|
||||
|
||||
void Debug::showTags(ostream &)
|
||||
void Debug::showTags(ostream & os)
|
||||
{
|
||||
for (int i = 0 ; i < numErrorTags ; ++i)
|
||||
fprintf(stdout, " %5d %-10s%-35s\n",
|
||||
errorTags[i].level,
|
||||
errorTags[i].name,
|
||||
errorTags[i].desc);
|
||||
os << " " << errorTags[i].level
|
||||
<< " " << errorTags[i].name
|
||||
<< " " << errorTags[i].desc << '\n';
|
||||
os.flush();
|
||||
}
|
||||
|
||||
|
||||
|
@ -62,13 +62,14 @@ struct Debug {
|
||||
/** Display the tags and descriptions of the current debug level
|
||||
of ds
|
||||
*/
|
||||
static void showLevel(ostream &o, type level);
|
||||
static void showLevel(ostream & o, type level);
|
||||
|
||||
/** show all the possible tags that can be used for debugging */
|
||||
static void showTags(ostream &o);
|
||||
static void showTags(ostream & o);
|
||||
|
||||
};
|
||||
|
||||
|
||||
///
|
||||
inline void operator|= (Debug::type & d1, Debug::type d2)
|
||||
{
|
||||
@ -78,6 +79,7 @@ inline void operator|= (Debug::type & d1, Debug::type d2)
|
||||
|
||||
#include "support/DebugStream.h"
|
||||
|
||||
|
||||
///
|
||||
ostream & operator<<(ostream & o, Debug::type t);
|
||||
|
||||
|
@ -33,7 +33,7 @@ InsetLatexAccent::InsetLatexAccent()
|
||||
|
||||
|
||||
InsetLatexAccent::InsetLatexAccent(InsetLatexAccent const & other)
|
||||
: contents(other.contents),
|
||||
: Inset(), contents(other.contents),
|
||||
candisp(other.candisp),
|
||||
modtype(other.modtype),
|
||||
remdot(other.remdot),
|
||||
|
129
src/kbmap.C
129
src/kbmap.C
@ -43,18 +43,15 @@ enum { ModsMask = ShiftMask | ControlMask | Mod1Mask};
|
||||
static
|
||||
int printKeysym( KeySym key, unsigned int mod, char *buf, int maxlen )
|
||||
{
|
||||
int len;
|
||||
char *s;
|
||||
|
||||
mod &= ModsMask;
|
||||
|
||||
// calc required length;
|
||||
len = 0;
|
||||
int len = 0;
|
||||
if ( mod & ShiftMask ) len += 2;
|
||||
if ( mod & ControlMask ) len += 2;
|
||||
if ( mod & Mod1Mask ) len += 2;
|
||||
|
||||
s = XKeysymToString( key );
|
||||
char * s = XKeysymToString( key );
|
||||
if ( s ) len += strlen( s );
|
||||
if ( len < maxlen ) {
|
||||
if ( mod & ShiftMask ) {
|
||||
@ -81,13 +78,13 @@ int printKeysym( KeySym key, unsigned int mod, char *buf, int maxlen )
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
static
|
||||
int printKeyTab( kb_key *tabPt, char *buf, int maxLen )
|
||||
int printKeyTab( kb_key * tabPt, char *buf, int maxLen )
|
||||
{
|
||||
int len, doneLen = 0;
|
||||
unsigned int ksym, mod;
|
||||
|
||||
/* -------> Print each of the slots into buf. */
|
||||
for( ; (tabPt->code & 0xffff) != NoSymbol; tabPt++) {
|
||||
for( ; (tabPt->code & 0xffff) != NoSymbol; ++tabPt) {
|
||||
if ( maxLen <= 0 ) break;
|
||||
|
||||
ksym = tabPt->code;
|
||||
@ -128,21 +125,21 @@ int printKeyTab( kb_key *tabPt, char *buf, int maxLen )
|
||||
|
||||
int kb_sequence::addkey(KeySym key, unsigned int mod, unsigned int nmod /*= 0*/)
|
||||
{
|
||||
if(length<0) length = 0;
|
||||
if(length < 0) length = 0;
|
||||
|
||||
if(length+1 >= size) {
|
||||
unsigned int *nseq = new unsigned int[size+KB_PREALLOC];
|
||||
if(length + 1 >= size) {
|
||||
unsigned int * nseq = new unsigned int[size+KB_PREALLOC];
|
||||
size += KB_PREALLOC;
|
||||
memcpy(nseq, sequence, length*sizeof(unsigned int));
|
||||
memcpy(nseq, sequence, length * sizeof(unsigned int));
|
||||
if(sequence != staticseq) delete sequence;
|
||||
sequence = nseq;
|
||||
nseq = new unsigned int[size];
|
||||
memcpy(nseq, modifiers, length*sizeof(unsigned int));
|
||||
memcpy(nseq, modifiers, length * sizeof(unsigned int));
|
||||
if(modifiers != staticmod) delete modifiers;
|
||||
modifiers = nseq;
|
||||
}
|
||||
|
||||
modifiers[length] = mod + (nmod<<16);
|
||||
modifiers[length] = mod + (nmod << 16);
|
||||
sequence[length++] = key;
|
||||
|
||||
if(curmap)
|
||||
@ -163,7 +160,7 @@ int kb_sequence::addkey(KeySym key, unsigned int mod, unsigned int nmod /*= 0*/)
|
||||
Prefixes are S-, C-, M- for shift, control, meta
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
int kb_sequence::parse(char const*s)
|
||||
int kb_sequence::parse(char const * s)
|
||||
{
|
||||
int i = 0;
|
||||
unsigned int mod = 0, nmod = 0;
|
||||
@ -173,7 +170,7 @@ int kb_sequence::parse(char const*s)
|
||||
if(!s[0]) return 1;
|
||||
|
||||
while(s[i]) {
|
||||
if(s[i] && (s[i]) <= ' ') i++;
|
||||
if(s[i] && (s[i]) <= ' ') ++i;
|
||||
if(!s[i]) break;
|
||||
|
||||
if(s[i+1] == '-') { // is implicit that s[i] == true
|
||||
@ -212,7 +209,7 @@ int kb_sequence::parse(char const*s)
|
||||
}
|
||||
} else {
|
||||
int j = 0;
|
||||
for(j = i; s[j] && (s[j])>' '; j++)
|
||||
for(j = i; s[j] && (s[j])>' '; ++j)
|
||||
tbuf[j-i] = s[j]; // (!!!check bounds :-)
|
||||
|
||||
tbuf[j-i] = '\0';
|
||||
@ -245,15 +242,15 @@ int kb_sequence::parse(char const*s)
|
||||
Returns : 0, if ok, -1 if string too long
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
int kb_sequence::print(char *buf, int maxlen, bool when_defined) const
|
||||
int kb_sequence::print(char * buf, int maxlen, bool when_defined) const
|
||||
{
|
||||
KeySym key;
|
||||
unsigned int mod;
|
||||
int len;
|
||||
int l = length;
|
||||
if ( l<0 && !when_defined ) l = -l;
|
||||
if ( l < 0 && !when_defined ) l = -l;
|
||||
|
||||
for(int i = 0; i < l; i++) {
|
||||
for(int i = 0; i < l; ++i) {
|
||||
key = sequence[i];
|
||||
mod = modifiers[i] & 0xffff;
|
||||
|
||||
@ -286,12 +283,10 @@ int kb_sequence::print(char *buf, int maxlen, bool when_defined) const
|
||||
Returns : 0, if ok, -1 if string too long
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
int kb_sequence::printOptions(char *buf, int maxlen) const
|
||||
int kb_sequence::printOptions(char * buf, int maxlen) const
|
||||
{
|
||||
int len;
|
||||
|
||||
print( buf, maxlen, true );
|
||||
len = strlen( buf );
|
||||
print(buf, maxlen, true);
|
||||
int len = strlen(buf);
|
||||
maxlen -= len;
|
||||
buf += len;
|
||||
|
||||
@ -338,7 +333,7 @@ KeySym kb_sequence::getsym()
|
||||
{
|
||||
int l = length;
|
||||
if(l == 0) return NoSymbol;
|
||||
if(l<0) l = -l;
|
||||
if(l < 0) l = -l;
|
||||
return sequence[l-1];
|
||||
}
|
||||
|
||||
@ -380,7 +375,7 @@ void kb_sequence::reset()
|
||||
// === kb_keymap methods ==================================================
|
||||
|
||||
// This binds a key to an action
|
||||
int kb_keymap::bind(char const *seq, int action)
|
||||
int kb_keymap::bind(char const * seq, int action)
|
||||
{
|
||||
kb_sequence k;
|
||||
|
||||
@ -405,10 +400,10 @@ int kb_keymap::bind(char const *seq, int action)
|
||||
Returns : user defined action; 0 for prefix key, -1 if key not found
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence *seq)
|
||||
int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence * seq)
|
||||
{
|
||||
unsigned int hashval, ksym, msk1, msk0;
|
||||
kb_key *tab;
|
||||
kb_key * tab;
|
||||
|
||||
//suppress modifier bits we do not handle
|
||||
mod &= ModsMask;
|
||||
@ -433,12 +428,12 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence *seq)
|
||||
|
||||
// --- now search the list of keys ---
|
||||
|
||||
for( ; (tab->code & 0xffff) != NoSymbol; tab++) {
|
||||
for( ; (tab->code & 0xffff) != NoSymbol; ++tab) {
|
||||
ksym = tab->code;
|
||||
msk1 = tab->mod & 0xffff;
|
||||
msk0 = (tab->mod>>16) & 0xffff;
|
||||
msk0 = (tab->mod >> 16) & 0xffff;
|
||||
|
||||
if(ksym == key && (mod&~msk0) == msk1) {
|
||||
if(ksym == key && (mod & ~msk0) == msk1) {
|
||||
// match found:
|
||||
if(tab->table) {
|
||||
// this is a prefix key - set new map
|
||||
@ -469,10 +464,8 @@ int kb_keymap::lookup(KeySym key, unsigned int mod, kb_sequence *seq)
|
||||
Returns : updated maxLen.
|
||||
\* ---F------------------------------------------------------------------- */
|
||||
|
||||
int kb_keymap::print(char *buf, int maxLen) const
|
||||
int kb_keymap::print(char * buf, int maxLen) const
|
||||
{
|
||||
int len;
|
||||
|
||||
/* -----> Return when running out of string space or when keymap has no table.
|
||||
Else, place a terminating newline in case no other output is generated. */
|
||||
|
||||
@ -482,16 +475,16 @@ int kb_keymap::print(char *buf, int maxLen) const
|
||||
|
||||
/* -------> Hash table. Process each of its slots recursively and return. */
|
||||
if ( size < 0 ) {
|
||||
for ( int ix = 0; (ix < KB_HASHSIZE) && (maxLen > 1); ix++ ) {
|
||||
for ( int ix = 0; (ix < KB_HASHSIZE) && (maxLen > 1); ++ix ) {
|
||||
if ( htable[ix] ) {
|
||||
len = printKeyTab( htable[ix], buf, maxLen );
|
||||
int len = printKeyTab( htable[ix], buf, maxLen );
|
||||
maxLen -= len;
|
||||
buf += len;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* -------> Normal table. */
|
||||
len = printKeyTab( table, buf, maxLen );
|
||||
int len = printKeyTab( table, buf, maxLen );
|
||||
maxLen -= len;
|
||||
buf += len;
|
||||
}
|
||||
@ -511,14 +504,11 @@ int kb_keymap::print(char *buf, int maxLen) const
|
||||
|
||||
int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
|
||||
{
|
||||
int tsize;
|
||||
unsigned int code, modmsk;
|
||||
kb_key *tab, **ptab;
|
||||
|
||||
code = seq->sequence[idx];
|
||||
modmsk = seq->modifiers[idx];
|
||||
unsigned int code = seq->sequence[idx];
|
||||
if(code == NoSymbol) return -1;
|
||||
|
||||
unsigned int modmsk = seq->modifiers[idx];
|
||||
kb_key *tab, **ptab;
|
||||
// --- get list------------------------------------------------------
|
||||
if(!table) {
|
||||
// If we don't have any yet, make an empty one
|
||||
@ -545,8 +535,9 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
|
||||
|
||||
// --- check if key is already there --------------------------------
|
||||
|
||||
kb_key *t;
|
||||
for(t = tab, tsize = 1; t->code != NoSymbol; t++, tsize++) {
|
||||
kb_key * t;
|
||||
int tsize;
|
||||
for(t = tab, tsize = 1; t->code != NoSymbol; ++t, ++tsize) {
|
||||
if(code == t->code && modmsk == t->mod) { // -- overwrite binding ---
|
||||
if(idx+1 == seq->length) {
|
||||
char buf[20]; buf[0] = 0;
|
||||
@ -578,14 +569,14 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
|
||||
// --- extend list if necessary -------------------------------------
|
||||
|
||||
if(tsize % KB_PREALLOC == 0) {
|
||||
kb_key *nt = new kb_key[tsize+KB_PREALLOC];
|
||||
kb_key * nt = new kb_key[tsize+KB_PREALLOC];
|
||||
// Set to 0 as table is used uninitialised later (thornley)
|
||||
nt[tsize].table = 0;
|
||||
memcpy(nt, tab, tsize*sizeof(kb_key));
|
||||
memcpy(nt, tab, tsize * sizeof(kb_key));
|
||||
*ptab = nt;
|
||||
delete[] tab;
|
||||
tab = nt;
|
||||
if(size>= 0) size = tsize+KB_PREALLOC;
|
||||
if(size>= 0) size = tsize + KB_PREALLOC;
|
||||
}
|
||||
|
||||
// --- add action ---------------------------------------------------
|
||||
@ -593,24 +584,24 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
|
||||
tab[tsize--].code = NoSymbol;
|
||||
tab[tsize].code = code;
|
||||
tab[tsize].mod = modmsk;
|
||||
kb_key *newone = &tab[tsize];
|
||||
kb_key * newone = &tab[tsize];
|
||||
|
||||
// --- convert list to hash table if necessary ----------------------
|
||||
|
||||
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++)
|
||||
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++){
|
||||
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;
|
||||
hashval = (tu->code & 0xffff);
|
||||
hashval = ((hashval & 0xff) ^ ((hashval>>8) & 0xff)) % KB_HASHSIZE;
|
||||
tab = htable[hashval];
|
||||
|
||||
if(!tab){
|
||||
@ -618,12 +609,12 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
|
||||
tab->code = NoSymbol;
|
||||
}
|
||||
int ts = 1;
|
||||
for(kb_key *tt = tab; tt->code != NoSymbol; tt++)
|
||||
ts++;
|
||||
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));
|
||||
kb_key * nt = new kb_key[ts+KB_PREALLOC];
|
||||
memcpy(nt, tab, ts * sizeof(kb_key));
|
||||
htable[hashval] = nt;
|
||||
delete[] tab;
|
||||
tab = nt;
|
||||
@ -665,10 +656,11 @@ int kb_keymap::defkey(kb_sequence *seq, int action, int idx /*= 0*/)
|
||||
kb_keymap::~kb_keymap()
|
||||
{
|
||||
if(!table) return;
|
||||
if(size<0) {
|
||||
for(int i = 0; i < KB_HASHSIZE; i++) {
|
||||
if(size < 0) {
|
||||
for(int i = 0; i < KB_HASHSIZE; ++i) {
|
||||
if(htable[i]) {
|
||||
for(kb_key *t = htable[i]; t->code != NoSymbol; t++)
|
||||
for(kb_key * t = htable[i];
|
||||
t->code != NoSymbol; ++t)
|
||||
if(t->table)
|
||||
delete t->table;
|
||||
delete htable[i];
|
||||
@ -676,7 +668,7 @@ kb_keymap::~kb_keymap()
|
||||
}
|
||||
delete htable;
|
||||
} else {
|
||||
for(kb_key *t = table; t->code != NoSymbol; t++)
|
||||
for(kb_key * t = table; t->code != NoSymbol; ++t)
|
||||
if(t->table)
|
||||
delete t->table;
|
||||
delete table;
|
||||
@ -695,10 +687,11 @@ string kb_keymap::findbinding(int act) const {
|
||||
if (!table)
|
||||
return res;
|
||||
|
||||
if (size<0) {
|
||||
for(int i = 0; i < KB_HASHSIZE; i++) {
|
||||
if (size < 0) {
|
||||
for(int i = 0; i < KB_HASHSIZE; ++i) {
|
||||
if(htable[i]) {
|
||||
for(kb_key *t = htable[i]; t->code != NoSymbol; t++) {
|
||||
for(kb_key * t = htable[i];
|
||||
t->code != NoSymbol; ++t) {
|
||||
if(t->table) {
|
||||
string suffix = t->table->findbinding(act);
|
||||
suffix = strip(suffix, ' ');
|
||||
@ -714,7 +707,7 @@ string kb_keymap::findbinding(int act) const {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for(kb_key *t = table; t->code != NoSymbol; t++) {
|
||||
for(kb_key * t = table; t->code != NoSymbol; ++t) {
|
||||
if(t->table) {
|
||||
string suffix = t->table->findbinding(act);
|
||||
suffix = strip(suffix, ' ');
|
||||
|
28
src/kbmap.h
28
src/kbmap.h
@ -33,7 +33,7 @@ struct kb_key {
|
||||
unsigned int mod;
|
||||
|
||||
/// Keymap for prefix keys
|
||||
kb_keymap *table;
|
||||
kb_keymap * table;
|
||||
|
||||
/// Action for !prefix keys
|
||||
int action;
|
||||
@ -54,19 +54,19 @@ public:
|
||||
/// Bind a key-sequence to an action
|
||||
/** Returns 0 on success. Otherwise, position in string where
|
||||
error occured. */
|
||||
int bind(char const* seq, int action);
|
||||
int bind(char const * seq, int action);
|
||||
|
||||
///
|
||||
int print(char* buf, int maxlen) const;
|
||||
int print(char * buf, int maxlen) const;
|
||||
|
||||
/// Look up a key in the keymap
|
||||
int lookup(KeySym key, unsigned mod, kb_sequence *seq);
|
||||
int lookup(KeySym key, unsigned mod, kb_sequence * seq);
|
||||
|
||||
/// Given an action, find all keybindings.
|
||||
string findbinding(int action) const;
|
||||
private:
|
||||
/// Define a new key sequence
|
||||
int defkey(kb_sequence *seq, int action, int idx = 0);
|
||||
int defkey(kb_sequence * seq, int action, int idx = 0);
|
||||
|
||||
/// Size of the table (<0: hashtab)
|
||||
int size;
|
||||
@ -76,10 +76,10 @@ private:
|
||||
union
|
||||
{
|
||||
/// Table for linear array
|
||||
kb_key *table;
|
||||
kb_key * table;
|
||||
|
||||
/// Hash table holding key lists
|
||||
kb_key **htable;
|
||||
kb_key ** htable;
|
||||
};
|
||||
};
|
||||
|
||||
@ -114,10 +114,10 @@ public:
|
||||
int addkey(KeySym key, unsigned mod, unsigned nmod = 0);
|
||||
|
||||
///
|
||||
int print(char *buf, int maxlen, bool when_defined = false) const; //RVDK_PATCH_5
|
||||
int print(char * buf, int maxlen, bool when_defined = false) const; //RVDK_PATCH_5
|
||||
|
||||
///
|
||||
int printOptions(char *buf, int maxlen) const;
|
||||
int printOptions(char * buf, int maxlen) const;
|
||||
|
||||
/// Make length negative to mark the sequence as deleted
|
||||
void delseq();
|
||||
@ -132,20 +132,20 @@ public:
|
||||
void reset();
|
||||
|
||||
///
|
||||
int parse(char const *s);
|
||||
int parse(char const * s);
|
||||
|
||||
/// Keymap to use if a new sequence is starting
|
||||
kb_keymap *stdmap;
|
||||
kb_keymap * stdmap;
|
||||
|
||||
/// Keymap to use for the next key
|
||||
kb_keymap *curmap;
|
||||
kb_keymap * curmap;
|
||||
|
||||
/// Array holding the current key sequence
|
||||
/** If sequence[length-1] < 0xff it can be used as ISO8859 char */
|
||||
unsigned int *sequence;
|
||||
unsigned int * sequence;
|
||||
|
||||
///
|
||||
unsigned int *modifiers;
|
||||
unsigned int * modifiers;
|
||||
|
||||
/// Current length of key sequence
|
||||
int length;
|
||||
|
28
src/layout.C
28
src/layout.C
@ -26,9 +26,11 @@ using std::sort;
|
||||
#include "gettext.h"
|
||||
#include "support/LAssert.h"
|
||||
|
||||
|
||||
// Global variable: textclass table.
|
||||
LyXTextClassList textclasslist;
|
||||
|
||||
|
||||
// Reads the style files
|
||||
void LyXSetStyle()
|
||||
{
|
||||
@ -380,6 +382,7 @@ bool LyXLayout::Read (LyXLex & lexrc, LyXTextClass const & tclass)
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
enum AlignTags {
|
||||
AT_BLOCK = 1,
|
||||
AT_LEFT,
|
||||
@ -388,6 +391,7 @@ enum AlignTags {
|
||||
AT_LAYOUT
|
||||
};
|
||||
|
||||
|
||||
static keyword_item alignTags[] = {
|
||||
{ "block", AT_BLOCK },
|
||||
{ "center", AT_CENTER },
|
||||
@ -461,6 +465,7 @@ void LyXLayout::readAlignPossible(LyXLex & lexrc)
|
||||
lexrc.popTable();
|
||||
}
|
||||
|
||||
|
||||
enum LabelTypeTags {
|
||||
LA_NO_LABEL = 1,
|
||||
LA_MANUAL,
|
||||
@ -481,6 +486,7 @@ enum LabelTypeTags {
|
||||
LA_BIBLIO
|
||||
};
|
||||
|
||||
|
||||
static keyword_item labelTypeTags[] = {
|
||||
{ "bibliography", LA_BIBLIO },
|
||||
{ "centered_top_environment", LA_CENTERED_TOP_ENVIRONMENT },
|
||||
@ -501,6 +507,7 @@ static keyword_item labelTypeTags[] = {
|
||||
{ "top_environment", LA_TOP_ENVIRONMENT }
|
||||
};
|
||||
|
||||
|
||||
void LyXLayout::readLabelType(LyXLex & lexrc)
|
||||
{
|
||||
pushpophelper pph(lexrc, labelTypeTags, LA_BIBLIO);
|
||||
@ -566,6 +573,7 @@ void LyXLayout::readLabelType(LyXLex & lexrc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum MarginTags {
|
||||
MT_STATIC = 1,
|
||||
MT_MANUAL,
|
||||
@ -574,6 +582,7 @@ enum MarginTags {
|
||||
MT_RIGHT_ADDRESS_BOX
|
||||
};
|
||||
|
||||
|
||||
static keyword_item marginTags[] = {
|
||||
{ "dynamic", MT_DYNAMIC },
|
||||
{ "first_dynamic", MT_FIRST_DYNAMIC },
|
||||
@ -582,6 +591,7 @@ static keyword_item marginTags[] = {
|
||||
{ "static", MT_STATIC }
|
||||
};
|
||||
|
||||
|
||||
void LyXLayout::readMargin(LyXLex & lexrc)
|
||||
{
|
||||
pushpophelper pph(lexrc, marginTags, MT_RIGHT_ADDRESS_BOX);
|
||||
@ -611,6 +621,7 @@ void LyXLayout::readMargin(LyXLex & lexrc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum LatexTypeTags {
|
||||
LX_PARAGRAPH = 1,
|
||||
LX_COMMAND,
|
||||
@ -619,6 +630,7 @@ enum LatexTypeTags {
|
||||
LX_LIST_ENVIRONMENT
|
||||
};
|
||||
|
||||
|
||||
static keyword_item latexTypeTags[] = {
|
||||
{ "command", LX_COMMAND },
|
||||
{ "environment", LX_ENVIRONMENT },
|
||||
@ -627,6 +639,7 @@ static keyword_item latexTypeTags[] = {
|
||||
{ "paragraph", LX_PARAGRAPH }
|
||||
};
|
||||
|
||||
|
||||
void LyXLayout::readLatexType(LyXLex & lexrc)
|
||||
{
|
||||
pushpophelper pph(lexrc, latexTypeTags, LX_LIST_ENVIRONMENT);
|
||||
@ -656,6 +669,7 @@ void LyXLayout::readLatexType(LyXLex & lexrc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum SpacingTags {
|
||||
ST_SPACING_SINGLE = 1,
|
||||
ST_SPACING_ONEHALF,
|
||||
@ -663,6 +677,7 @@ enum SpacingTags {
|
||||
ST_OTHER
|
||||
};
|
||||
|
||||
|
||||
static keyword_item spacingTags[] = {
|
||||
{"double", ST_SPACING_DOUBLE },
|
||||
{"onehalf", ST_SPACING_ONEHALF },
|
||||
@ -670,6 +685,7 @@ static keyword_item spacingTags[] = {
|
||||
{"single", ST_SPACING_SINGLE }
|
||||
};
|
||||
|
||||
|
||||
void LyXLayout::readSpacing(LyXLex & lexrc)
|
||||
{
|
||||
pushpophelper pph(lexrc, spacingTags, ST_OTHER);
|
||||
@ -697,6 +713,7 @@ void LyXLayout::readSpacing(LyXLex & lexrc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ******************************************************************* */
|
||||
|
||||
LyXTextClass::LyXTextClass(string const & fn, string const & cln,
|
||||
@ -755,6 +772,7 @@ enum TextClassTags {
|
||||
TC_RIGHTMARGIN
|
||||
};
|
||||
|
||||
|
||||
static keyword_item textClassTags[] = {
|
||||
{ "classoptions", TC_CLASSOPTIONS },
|
||||
{ "columns", TC_COLUMNS },
|
||||
@ -776,6 +794,7 @@ static keyword_item textClassTags[] = {
|
||||
{ "tocdepth", TC_TOCDEPTH }
|
||||
};
|
||||
|
||||
|
||||
// Reads a textclass structure from file.
|
||||
bool LyXTextClass::Read(string const & filename, bool merge)
|
||||
{
|
||||
@ -952,6 +971,7 @@ bool LyXTextClass::Read(string const & filename, bool merge)
|
||||
return error;
|
||||
}
|
||||
|
||||
|
||||
enum OutputTypeTags {
|
||||
OT_OTLATEX = 1,
|
||||
OT_OTLINUXDOC,
|
||||
@ -959,6 +979,7 @@ enum OutputTypeTags {
|
||||
OT_OTLITERATE
|
||||
};
|
||||
|
||||
|
||||
static keyword_item outputTypeTags[] = {
|
||||
{ "docbook", OT_OTDOCBOOK },
|
||||
{ "latex", OT_OTLATEX },
|
||||
@ -966,6 +987,7 @@ static keyword_item outputTypeTags[] = {
|
||||
{ "literate", OT_OTLITERATE }
|
||||
};
|
||||
|
||||
|
||||
void LyXTextClass::readOutputType(LyXLex & lexrc)
|
||||
{
|
||||
pushpophelper pph(lexrc, outputTypeTags, OT_OTLITERATE);
|
||||
@ -992,6 +1014,7 @@ void LyXTextClass::readOutputType(LyXLex & lexrc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum MaxCounterTags {
|
||||
MC_COUNTER_CHAPTER = 1,
|
||||
MC_COUNTER_SECTION,
|
||||
@ -1005,6 +1028,7 @@ enum MaxCounterTags {
|
||||
MC_COUNTER_ENUMIV
|
||||
};
|
||||
|
||||
|
||||
static keyword_item maxCounterTags[] = {
|
||||
{"counter_chapter", MC_COUNTER_CHAPTER },
|
||||
{"counter_enumi", MC_COUNTER_ENUMI },
|
||||
@ -1018,6 +1042,7 @@ static keyword_item maxCounterTags[] = {
|
||||
{"counter_subsubsection", MC_COUNTER_SUBSUBSECTION }
|
||||
};
|
||||
|
||||
|
||||
void LyXTextClass::readMaxCounter(LyXLex & lexrc)
|
||||
{
|
||||
pushpophelper pph(lexrc, maxCounterTags, MC_COUNTER_ENUMIV);
|
||||
@ -1062,6 +1087,7 @@ void LyXTextClass::readMaxCounter(LyXLex & lexrc)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
enum ClassOptionsTags {
|
||||
CO_FONTSIZE = 1,
|
||||
CO_PAGESTYLE,
|
||||
@ -1069,6 +1095,7 @@ enum ClassOptionsTags {
|
||||
CO_END
|
||||
};
|
||||
|
||||
|
||||
static keyword_item classOptionsTags[] = {
|
||||
{"end", CO_END },
|
||||
{"fontsize", CO_FONTSIZE },
|
||||
@ -1076,6 +1103,7 @@ static keyword_item classOptionsTags[] = {
|
||||
{"pagestyle", CO_PAGESTYLE }
|
||||
};
|
||||
|
||||
|
||||
void LyXTextClass::readClassOptions(LyXLex & lexrc)
|
||||
{
|
||||
lexrc.pushTable(classOptionsTags, CO_END);
|
||||
|
@ -121,13 +121,13 @@ char selection_color[32];
|
||||
|
||||
FL_resource res[] =
|
||||
{
|
||||
{"width", "widthClass", FL_INT, &width, "690"},
|
||||
{"height", "heightClass", FL_INT, &height, "510"},
|
||||
{"xpos", "xposClass", FL_INT, &xpos, "-1"},
|
||||
{"ypos", "yposClass", FL_INT, &ypos, "-1"},
|
||||
{"Reverse", "reverseClass", FL_INT, &reverse_video, "0"},
|
||||
{"Mono", "monoClass", FL_INT, &mono_video, "0"},
|
||||
{"FastSelection", "selectionClass", FL_INT, &fast_selection, "0"},
|
||||
{"width", "widthClass", FL_INT, &width, "690", 0},
|
||||
{"height", "heightClass", FL_INT, &height, "510", 0},
|
||||
{"xpos", "xposClass", FL_INT, &xpos, "-1", 0},
|
||||
{"ypos", "yposClass", FL_INT, &ypos, "-1", 0},
|
||||
{"Reverse", "reverseClass", FL_INT, &reverse_video, "0", 0},
|
||||
{"Mono", "monoClass", FL_INT, &mono_video, "0", 0},
|
||||
{"FastSelection", "selectionClass", FL_INT, &fast_selection, "0", 0},
|
||||
{"MathColor", "colorClass", FL_STRING, math_color, "blue", 31},
|
||||
{"MathFrameColor", "colorClass", FL_STRING, math_frame_color, "magenta", 31},
|
||||
{"FootColor", "colorClass", FL_STRING, foot_color, "red", 31},
|
||||
|
@ -38,23 +38,23 @@ math_hash (register char const *str, register int len)
|
||||
return len + asso_values[str[len - 1]] + asso_values[str[0]];
|
||||
}
|
||||
|
||||
static struct latexkeys wordlist[] =
|
||||
static latexkeys wordlist[] =
|
||||
{
|
||||
{"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",}, {"",},
|
||||
{"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0}, {"",0,0},
|
||||
{"setminus", LM_TK_SYM, LM_setminus},
|
||||
{"ldots", LM_TK_DOTS, LM_ldots},
|
||||
{"limits", LM_TK_LIMIT, 1 },
|
||||
{"stackrel", LM_TK_STACK},
|
||||
{"stackrel", LM_TK_STACK, 0},
|
||||
{"ll", LM_TK_SYM, LM_ll},
|
||||
{"label", LM_TK_LABEL},
|
||||
{"label", LM_TK_LABEL, 0},
|
||||
{"lceil", LM_TK_SYM, LM_lceil},
|
||||
{"sqrt", LM_TK_SQRT},
|
||||
{"sqrt", LM_TK_SQRT, 0},
|
||||
{"times", LM_TK_SYM, LM_times},
|
||||
{"subset", LM_TK_SYM, LM_subset},
|
||||
{"supset", LM_TK_SYM, LM_supset},
|
||||
{"spadesuit", LM_TK_SYM, LM_spadesuit},
|
||||
{"Re", LM_TK_SYM, LM_Re},
|
||||
{"left", LM_TK_LEFT},
|
||||
{"left", LM_TK_LEFT, 0},
|
||||
{"smile", LM_TK_SYM, LM_smile},
|
||||
{"exists", LM_TK_SYM, LM_exists},
|
||||
{"Vert", LM_TK_SYM, LM_Vert},
|
||||
@ -65,8 +65,8 @@ static struct latexkeys wordlist[] =
|
||||
{"scriptscriptstyle", LM_TK_STY, LM_ST_SCRIPTSCRIPT},
|
||||
{"zeta", LM_TK_SYM, LM_zeta},
|
||||
{"sigma", LM_TK_SYM, LM_sigma},
|
||||
{"arccos", LM_TK_FUNC},
|
||||
{"sup", LM_TK_FUNCLIM},
|
||||
{"arccos", LM_TK_FUNC, 0},
|
||||
{"sup", LM_TK_FUNCLIM, 0},
|
||||
{"sharp", LM_TK_SYM, LM_sharp},
|
||||
{"sqcup", LM_TK_SYM, LM_sqcup},
|
||||
{"sqcap", LM_TK_SYM, LM_sqcap},
|
||||
@ -79,7 +79,7 @@ static struct latexkeys wordlist[] =
|
||||
{"triangle", LM_TK_SYM, LM_triangle},
|
||||
{"textstyle", LM_TK_STY, LM_ST_TEXT},
|
||||
{"tau", LM_TK_SYM, LM_tau},
|
||||
{"limsup", LM_TK_FUNCLIM},
|
||||
{"limsup", LM_TK_FUNCLIM, 0},
|
||||
{"partial", LM_TK_SYM, LM_partial},
|
||||
{"parallel", LM_TK_SYM, LM_parallel},
|
||||
{"infty", LM_TK_SYM, LM_infty},
|
||||
@ -97,7 +97,7 @@ static struct latexkeys wordlist[] =
|
||||
{"eta", LM_TK_SYM, LM_eta},
|
||||
{"acute", LM_TK_ACCENT, LM_acute},
|
||||
{"angle", LM_TK_SYM, LM_angle},
|
||||
{"exp", LM_TK_FUNC},
|
||||
{"exp", LM_TK_FUNC, 0},
|
||||
{"leftarrow", LM_TK_SYM, LM_leftarrow},
|
||||
{"prime", LM_TK_SYM, LM_prime},
|
||||
{"int", LM_TK_BIGSYM, LM_int},
|
||||
@ -111,12 +111,12 @@ static struct latexkeys wordlist[] =
|
||||
{"longleftrightarrow", LM_TK_SYM, LM_longleftrightarrow},
|
||||
{"alpha", LM_TK_SYM, LM_alpha},
|
||||
{"widehat", LM_TK_WIDE, LM_widehat},
|
||||
{"sin", LM_TK_FUNC},
|
||||
{"sin", LM_TK_FUNC, 0},
|
||||
{"asymp", LM_TK_SYM, LM_asymp},
|
||||
{"nolimits", LM_TK_LIMIT, 0 },
|
||||
{"perp", LM_TK_MACRO, LM_perp},
|
||||
{"wedge", LM_TK_SYM, LM_wedge},
|
||||
{"ln", LM_TK_FUNC},
|
||||
{"ln", LM_TK_FUNC, 0},
|
||||
{"widetilde", LM_TK_WIDE, LM_widetilde},
|
||||
{"Omega", LM_TK_SYM, LM_Omega},
|
||||
{"natural", LM_TK_SYM, LM_natural},
|
||||
@ -131,33 +131,33 @@ static struct latexkeys wordlist[] =
|
||||
{"leftharpoondown", LM_TK_SYM, LM_leftharpoondown},
|
||||
{"wp", LM_TK_SYM, LM_wp},
|
||||
{"not", LM_TK_ACCENT, LM_not},
|
||||
{"tan", LM_TK_FUNC},
|
||||
{"tan", LM_TK_FUNC, 0},
|
||||
{"Theta", LM_TK_SYM, LM_Theta},
|
||||
{"rceil", LM_TK_SYM, LM_rceil},
|
||||
{"lfloor", LM_TK_SYM, LM_lfloor},
|
||||
{"rightleftharpoons", LM_TK_SYM, LM_rightleftharpoons},
|
||||
{"cos", LM_TK_FUNC},
|
||||
{"sec", LM_TK_FUNC},
|
||||
{"cos", LM_TK_FUNC, 0},
|
||||
{"sec", LM_TK_FUNC, 0},
|
||||
{"succ", LM_TK_SYM, LM_succ},
|
||||
{"cdots", LM_TK_DOTS, LM_cdots},
|
||||
{"epsilon", LM_TK_SYM, LM_epsilon},
|
||||
{"ker", LM_TK_FUNC},
|
||||
{"ker", LM_TK_FUNC, 0},
|
||||
{"nu", LM_TK_SYM, LM_nu},
|
||||
{"Delta", LM_TK_SYM, LM_Delta},
|
||||
{"forall", LM_TK_SYM, LM_forall},
|
||||
{"liminf", LM_TK_FUNCLIM},
|
||||
{"liminf", LM_TK_FUNCLIM, 0},
|
||||
{"Uparrow", LM_TK_SYM, LM_Uparrow},
|
||||
{"upsilon", LM_TK_SYM, LM_upsilon},
|
||||
{"right", LM_TK_RIGHT},
|
||||
{"right", LM_TK_RIGHT, 0},
|
||||
{"Updownarrow", LM_TK_SYM, LM_Updownarrow},
|
||||
{"Pr", LM_TK_FUNCLIM},
|
||||
{"Pr", LM_TK_FUNCLIM, 0},
|
||||
{"nabla", LM_TK_SYM, LM_nabla},
|
||||
{"arcsin", LM_TK_FUNC},
|
||||
{"arctan", LM_TK_FUNC},
|
||||
{"arcsin", LM_TK_FUNC, 0},
|
||||
{"arctan", LM_TK_FUNC, 0},
|
||||
{"flat", LM_TK_SYM, LM_flat},
|
||||
{"check", LM_TK_ACCENT, LM_check},
|
||||
{"rangle", LM_TK_SYM, LM_rangle},
|
||||
{"cot", LM_TK_FUNC},
|
||||
{"cot", LM_TK_FUNC, 0},
|
||||
{"cdot", LM_TK_SYM, LM_cdot},
|
||||
{"clubsuit", LM_TK_SYM, LM_clubsuit},
|
||||
{"in", LM_TK_SYM, LM_in},
|
||||
@ -169,9 +169,9 @@ static struct latexkeys wordlist[] =
|
||||
{"models", LM_TK_SYM, LM_models},
|
||||
{"nearrow", LM_TK_SYM, LM_nearrow},
|
||||
{"nwarrow", LM_TK_SYM, LM_nwarrow},
|
||||
{"max", LM_TK_FUNCLIM},
|
||||
{"max", LM_TK_FUNCLIM, 0},
|
||||
{"Im", LM_TK_SYM, LM_Im},
|
||||
{"lim", LM_TK_FUNCLIM},
|
||||
{"lim", LM_TK_FUNCLIM, 0},
|
||||
{"rightharpoonup", LM_TK_SYM, LM_rightharpoonup},
|
||||
{"mathcal", LM_TK_FONT, LM_TC_CAL},
|
||||
{"cap", LM_TK_SYM, LM_cap},
|
||||
@ -179,7 +179,7 @@ static struct latexkeys wordlist[] =
|
||||
{"prec", LM_TK_SYM, LM_prec},
|
||||
{"mathnormal", LM_TK_FONT, LM_TC_NORMAL},
|
||||
{"wr", LM_TK_SYM, LM_wr},
|
||||
{"inf", LM_TK_FUNCLIM},
|
||||
{"inf", LM_TK_FUNCLIM, 0},
|
||||
{"bigoplus", LM_TK_BIGSYM, LM_oplus},
|
||||
{"biguplus", LM_TK_BIGSYM, LM_biguplus},
|
||||
{"bigotimes", LM_TK_BIGSYM, LM_otimes},
|
||||
@ -202,31 +202,31 @@ static struct latexkeys wordlist[] =
|
||||
{"bot", LM_TK_SYM, LM_bot},
|
||||
{"bullet", LM_TK_SYM, LM_bullet},
|
||||
{"bigodot", LM_TK_BIGSYM, LM_bigodot},
|
||||
{"sinh", LM_TK_FUNC},
|
||||
{"sinh", LM_TK_FUNC, 0},
|
||||
{"jmath", LM_TK_SYM, LM_jmath},
|
||||
{"mp", LM_TK_SYM, LM_mp},
|
||||
{"pm", LM_TK_SYM, LM_pm},
|
||||
{"nonumber", LM_TK_NONUM},
|
||||
{"nonumber", LM_TK_NONUM, 0},
|
||||
{"breve", LM_TK_ACCENT, LM_breve},
|
||||
{"bigvee", LM_TK_BIGSYM, LM_vee},
|
||||
{"bowtie", LM_TK_SYM, LM_bowtie},
|
||||
{"bigwedge", LM_TK_BIGSYM, LM_wedge},
|
||||
{"frown", LM_TK_SYM, LM_frown},
|
||||
{"rightharpoondown", LM_TK_SYM, LM_rightharpoondown},
|
||||
{"det", LM_TK_FUNCLIM},
|
||||
{"det", LM_TK_FUNCLIM, 0},
|
||||
{"dot", LM_TK_ACCENT, LM_dot},
|
||||
{"ddot", LM_TK_ACCENT, LM_ddot},
|
||||
{"lg", LM_TK_FUNC},
|
||||
{"log", LM_TK_FUNC},
|
||||
{"lg", LM_TK_FUNC, 0},
|
||||
{"log", LM_TK_FUNC, 0},
|
||||
{"oplus", LM_TK_SYM, LM_oplus},
|
||||
{"ominus", LM_TK_SYM, LM_ominus},
|
||||
{"otimes", LM_TK_SYM, LM_otimes},
|
||||
{"beta", LM_TK_SYM, LM_beta},
|
||||
{"diamondsuit", LM_TK_SYM, LM_diamondsuit},
|
||||
{"rfloor", LM_TK_SYM, LM_rfloor},
|
||||
{"end", LM_TK_END},
|
||||
{"end", LM_TK_END, 0},
|
||||
{"hat", LM_TK_ACCENT, LM_hat},
|
||||
{"tanh", LM_TK_FUNC},
|
||||
{"tanh", LM_TK_FUNC, 0},
|
||||
{"vdots", LM_TK_DOTS, LM_vdots},
|
||||
{"bigcap", LM_TK_BIGSYM, LM_cap},
|
||||
{"bigcup", LM_TK_BIGSYM, LM_cup},
|
||||
@ -240,15 +240,15 @@ static struct latexkeys wordlist[] =
|
||||
{"odot", LM_TK_SYM, LM_odot},
|
||||
{"oint", LM_TK_BIGSYM, LM_oint},
|
||||
{"grave", LM_TK_ACCENT, LM_grave},
|
||||
{"pmod", LM_TK_PMOD},
|
||||
{"pmod", LM_TK_PMOD, 0},
|
||||
{"prod", LM_TK_BIGSYM, LM_prod},
|
||||
{"frac", LM_TK_FRAC},
|
||||
{"csc", LM_TK_FUNC},
|
||||
{"frac", LM_TK_FRAC, 0},
|
||||
{"csc", LM_TK_FUNC, 0},
|
||||
{"circ", LM_TK_SYM, LM_circ},
|
||||
{"aleph", LM_TK_SYM, LM_aleph},
|
||||
{"min", LM_TK_FUNCLIM},
|
||||
{"min", LM_TK_FUNCLIM, 0},
|
||||
{"overline", LM_TK_WIDE, LM_overline},
|
||||
{"arg", LM_TK_FUNC},
|
||||
{"arg", LM_TK_FUNC, 0},
|
||||
{"overbrace", LM_TK_WIDE, LM_overbrace},
|
||||
{"amalg", LM_TK_SYM, LM_amalg},
|
||||
{"gamma", LM_TK_SYM, LM_gamma},
|
||||
@ -258,7 +258,7 @@ static struct latexkeys wordlist[] =
|
||||
{"downarrow", LM_TK_SYM, LM_downarrow},
|
||||
{"imath", LM_TK_SYM, LM_imath},
|
||||
{"propto", LM_TK_SYM, LM_propto},
|
||||
{"begin", LM_TK_BEGIN},
|
||||
{"begin", LM_TK_BEGIN, 0},
|
||||
{"Lambda", LM_TK_SYM, LM_Lambda},
|
||||
{"varsigma", LM_TK_SYM, LM_varsigma},
|
||||
{"vartheta", LM_TK_SYM, LM_vartheta},
|
||||
@ -271,7 +271,7 @@ static struct latexkeys wordlist[] =
|
||||
{"bar", LM_TK_ACCENT, LM_bar},
|
||||
{"varpi", LM_TK_SYM, LM_varpi},
|
||||
{"varphi", LM_TK_SYM, LM_varphi},
|
||||
{"newcommand", LM_TK_NEWCOMMAND },
|
||||
{"newcommand", LM_TK_NEWCOMMAND, 0 },
|
||||
{"overleftarrow", LM_TK_WIDE, LM_overleftarrow},
|
||||
{"overrightarrow", LM_TK_WIDE, LM_overightarrow},
|
||||
{"Leftarrow", LM_TK_SYM, LM_Leftarrow},
|
||||
@ -287,15 +287,15 @@ static struct latexkeys wordlist[] =
|
||||
{"coprod", LM_TK_BIGSYM, LM_coprod},
|
||||
{"mathrm", LM_TK_FONT, LM_TC_RM},
|
||||
{"varepsilon", LM_TK_SYM, LM_varepsilon},
|
||||
{"cosh", LM_TK_FUNC},
|
||||
{"coth", LM_TK_FUNC},
|
||||
{"cosh", LM_TK_FUNC, 0},
|
||||
{"coth", LM_TK_FUNC, 0},
|
||||
{"rho", LM_TK_SYM, LM_rho},
|
||||
{"cong", LM_TK_SYM, LM_cong},
|
||||
{"vec", LM_TK_ACCENT, LM_vec},
|
||||
{"dim", LM_TK_FUNC},
|
||||
{"dim", LM_TK_FUNC, 0},
|
||||
{"mid", LM_TK_SYM, LM_mid},
|
||||
{"hom", LM_TK_FUNC},
|
||||
{"bmod", LM_TK_FUNC},
|
||||
{"hom", LM_TK_FUNC, 0},
|
||||
{"bmod", LM_TK_FUNC, 0},
|
||||
{"quad", LM_TK_SPACE, LM_quad},
|
||||
{"doteq", LM_TK_SYM, LM_doteq},
|
||||
{"qquad", LM_TK_SPACE, LM_qquad},
|
||||
@ -303,8 +303,8 @@ static struct latexkeys wordlist[] =
|
||||
{"backslash", LM_TK_SYM, LM_backslash},
|
||||
{"diamond", LM_TK_SYM, LM_diamond},
|
||||
{"geq", LM_TK_SYM, LM_geq},
|
||||
{"deg", LM_TK_FUNC},
|
||||
{"gcd", LM_TK_FUNCLIM},
|
||||
{"deg", LM_TK_FUNC, 0},
|
||||
{"gcd", LM_TK_FUNCLIM, 0},
|
||||
{"gg", LM_TK_SYM, LM_gg},
|
||||
{"div", LM_TK_SYM, LM_div},
|
||||
{"dashv", LM_TK_SYM, LM_dashv},
|
||||
|
@ -67,17 +67,21 @@ enum MathTokenEnum
|
||||
};
|
||||
|
||||
///
|
||||
struct latexkeys { char const * name; short token; int id; };
|
||||
struct latexkeys {
|
||||
char const * name;
|
||||
short token;
|
||||
int id;
|
||||
};
|
||||
|
||||
///
|
||||
struct latexkeys *
|
||||
latexkeys *
|
||||
in_word_set (register char const * str, register int len);
|
||||
|
||||
///
|
||||
struct latexkeys * lm_get_key(int index);
|
||||
latexkeys * lm_get_key(int index);
|
||||
|
||||
///
|
||||
struct latexkeys * lm_get_key_by_id(int id, short tc = LM_TK_SYM);
|
||||
latexkeys * lm_get_key_by_id(int id, short tc = LM_TK_SYM);
|
||||
|
||||
///
|
||||
typedef union{
|
||||
|
@ -16,7 +16,8 @@
|
||||
#pragma implementation "lyxstring.h"
|
||||
#endif
|
||||
|
||||
#include "LString.h"
|
||||
//#include "LString.h"
|
||||
#include "lyxstring.h"
|
||||
#include <cstdlib>
|
||||
#include <cctype>
|
||||
#include <algorithm>
|
||||
@ -59,6 +60,27 @@ using std::min;
|
||||
|
||||
// Lgb.
|
||||
|
||||
|
||||
#if 0
|
||||
// I have no clue why this function is needed at all, it is static and
|
||||
// confined to this filescope. How can any other file/fuction/module
|
||||
// get access to it at all?? Perhaps the forward declaration in LString.h
|
||||
// is enough. ARRae, any clues? Lgb.
|
||||
|
||||
#ifdef HAVE_STL_STRING_FWD_H
|
||||
// SGI's STL > 3.13 expects string to provide __get_c_string.
|
||||
// Due to a clash with SGI's forward declaration of string we have
|
||||
// to provide this ourselves and block their string declarations
|
||||
// as best we can. ARRae.
|
||||
|
||||
static char const * __get_c_string(string const & s)
|
||||
{
|
||||
return s.c_str();
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
///////////////////////////////////////
|
||||
// The internal string representation
|
||||
///////////////////////////////////////
|
||||
@ -1445,19 +1467,6 @@ lyxstring::size_type lyxstring::copy(value_type * buf, size_type len,
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_STL_STRING_FWD_H
|
||||
// SGI's STL > 3.13 expects string to provide __get_c_string.
|
||||
// Due to a clash with SGI's forward declaration of string we have
|
||||
// to provide this ourselves and block their string declarations
|
||||
// as best we can. ARRae.
|
||||
|
||||
static const char* __get_c_string(const string & s)
|
||||
{
|
||||
return s.c_str();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
////////////////////
|
||||
// Comparisons
|
||||
////////////////////
|
||||
|
@ -73,7 +73,7 @@ int Systemcalls::startscript() {
|
||||
return retval;
|
||||
}
|
||||
|
||||
void Systemcalls::kill(int tolerance) {
|
||||
void Systemcalls::kill(int /*tolerance*/) {
|
||||
if (getpid() == 0) {
|
||||
lyxerr << "LyX: Can't kill non-existing process." << endl;
|
||||
return;
|
||||
|
@ -162,7 +162,7 @@ void Trans::AddDeadkey(tex_accent accent, string const & keys,
|
||||
|
||||
for(string::size_type i = 0; i < keys.length(); ++i) {
|
||||
char * temp =
|
||||
keymap_[static_cast<unsigned int>(keys[i])] =
|
||||
keymap_[static_cast<unsigned char>(keys[i])] =
|
||||
new char[2];
|
||||
temp[0] = 0; temp[1] = accent;
|
||||
}
|
||||
@ -347,7 +347,7 @@ string Trans::process(char c, TransManager & k)
|
||||
{
|
||||
char dummy[2] = "?";
|
||||
char * dt = dummy;
|
||||
char * t = Match(c);
|
||||
char * t = Match(static_cast<unsigned char>(c));
|
||||
|
||||
if ((t == 0 && (*dt = c)) || (t[0] != 0 && (dt = t)) ){
|
||||
return k.normalkey(c, dt);
|
||||
|
@ -77,7 +77,7 @@ private:
|
||||
///
|
||||
int Load(LyXLex &);
|
||||
///
|
||||
inline char * Match(unsigned int c);
|
||||
inline char * Match(unsigned char c);
|
||||
///
|
||||
void InsertException(keyexc & exclist, char c,
|
||||
string const & data, bool = false,
|
||||
@ -95,7 +95,7 @@ private:
|
||||
};
|
||||
|
||||
|
||||
char * Trans::Match(unsigned int c)
|
||||
char * Trans::Match(unsigned char c)
|
||||
{
|
||||
return keymap_[c];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user