Fix formatting
This commit is contained in:
parent
ad6294124f
commit
a39960cd13
@ -257,7 +257,7 @@ bool inline samekey(gkey key1, gkey key2) {
|
|||||||
return false;
|
return false;
|
||||||
if(key1 == key2)
|
if(key1 == key2)
|
||||||
return true;
|
return true;
|
||||||
if((key1 > 0xFF) || (key2 > 0xFF))
|
if((key1 > 0xFF) or (key2 > 0xFF))
|
||||||
return false;
|
return false;
|
||||||
return (tolower(key1) == key2) or (tolower(key2) == key1);
|
return (tolower(key1) == key2) or (tolower(key2) == key1);
|
||||||
}
|
}
|
||||||
|
@ -2086,7 +2086,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
|
|||||||
strcpy(msg->charset, chsbuf);
|
strcpy(msg->charset, chsbuf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if((kludgetype == FSC_CHARSET) || (kludgetype == FSC_CODEPAGE)) {
|
else if((kludgetype == FSC_CHARSET) or (kludgetype == FSC_CODEPAGE)) {
|
||||||
*chsbuf = NUL;
|
*chsbuf = NUL;
|
||||||
qpencoded = IsQuotedPrintable(ptr);
|
qpencoded = IsQuotedPrintable(ptr);
|
||||||
if(kludgetype == FSC_CODEPAGE)
|
if(kludgetype == FSC_CODEPAGE)
|
||||||
|
@ -60,7 +60,7 @@ static bool tokenxchg(char*& dst, char* tok, const char* src, int len = 0, int c
|
|||||||
char *p = strchr(dst+toklen, '}');
|
char *p = strchr(dst+toklen, '}');
|
||||||
if(p) {
|
if(p) {
|
||||||
uint dstlen = p-dst-toklen-1;
|
uint dstlen = p-dst-toklen-1;
|
||||||
if(use && dstlen) {
|
if(use and dstlen) {
|
||||||
strxcpy (buf, dst+toklen+1, dstlen+1);
|
strxcpy (buf, dst+toklen+1, dstlen+1);
|
||||||
src = buf;
|
src = buf;
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@ gposixdir::~gposixdir()
|
|||||||
void gposixdir::cd(const char *name, bool relative)
|
void gposixdir::cd(const char *name, bool relative)
|
||||||
{
|
{
|
||||||
std::string ndirname;
|
std::string ndirname;
|
||||||
if(!*name)
|
if(not *name)
|
||||||
name = ".";
|
name = ".";
|
||||||
if(relative) {
|
if(relative) {
|
||||||
dirname += "/";
|
dirname += "/";
|
||||||
@ -97,9 +97,9 @@ void gposixdir::cd(const char *name, bool relative)
|
|||||||
while((de=readdir(d)) != NULL) {
|
while((de=readdir(d)) != NULL) {
|
||||||
ndirname = de->d_name;
|
ndirname = de->d_name;
|
||||||
#ifdef __HAVE_DRIVES__
|
#ifdef __HAVE_DRIVES__
|
||||||
if((ndirname != ".") && !((ndirname == "..") && streql(dirname.c_str()+1, ":/")))
|
if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/")))
|
||||||
#else
|
#else
|
||||||
if((ndirname != ".") && !((ndirname == "..") && (dirname == "/")))
|
if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/")))
|
||||||
#endif
|
#endif
|
||||||
entries.push_back(ndirname);
|
entries.push_back(ndirname);
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ void gposixdir::cd(const char *name, bool relative)
|
|||||||
void gposixdir::cd(const char *name, bool relative)
|
void gposixdir::cd(const char *name, bool relative)
|
||||||
{
|
{
|
||||||
std::string ndirname;
|
std::string ndirname;
|
||||||
if(!*name)
|
if(not *name)
|
||||||
name = ".";
|
name = ".";
|
||||||
if(relative) {
|
if(relative) {
|
||||||
dirname += "/";
|
dirname += "/";
|
||||||
@ -134,9 +134,9 @@ void gposixdir::cd(const char *name, bool relative)
|
|||||||
do {
|
do {
|
||||||
ndirname = de.name;
|
ndirname = de.name;
|
||||||
#ifdef __HAVE_DRIVES__
|
#ifdef __HAVE_DRIVES__
|
||||||
if((ndirname != ".") && !((ndirname == "..") && streql(dirname.c_str()+1, ":/")))
|
if((ndirname != ".") and not ((ndirname == "..") and streql(dirname.c_str()+1, ":/")))
|
||||||
#else
|
#else
|
||||||
if((ndirname != ".") && !((ndirname == "..") && (dirname == "/")))
|
if((ndirname != ".") and not ((ndirname == "..") and (dirname == "/")))
|
||||||
#endif
|
#endif
|
||||||
entries.push_back(ndirname);
|
entries.push_back(ndirname);
|
||||||
} while(_findnext(d, &de) == 0);
|
} while(_findnext(d, &de) == 0);
|
||||||
@ -151,13 +151,13 @@ void gposixdir::cd(const char *name, bool relative)
|
|||||||
const gdirentry *gposixdir::nextentry(const char *mask, bool nameonly)
|
const gdirentry *gposixdir::nextentry(const char *mask, bool nameonly)
|
||||||
{
|
{
|
||||||
while(last_entry < entries.size()) {
|
while(last_entry < entries.size()) {
|
||||||
if(mask && !gwildmat(entries[last_entry].c_str(), mask)) {
|
if(mask and not gwildmat(entries[last_entry].c_str(), mask)) {
|
||||||
++last_entry;
|
++last_entry;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
ret.name = entries[last_entry];
|
ret.name = entries[last_entry];
|
||||||
ret.dirname = dirname.c_str();
|
ret.dirname = dirname.c_str();
|
||||||
if(!nameonly) {
|
if(not nameonly) {
|
||||||
std::string pn = ret.dirname;
|
std::string pn = ret.dirname;
|
||||||
pn += "/";
|
pn += "/";
|
||||||
pn += ret.name;
|
pn += ret.name;
|
||||||
|
@ -113,7 +113,7 @@
|
|||||||
#define GOLD_SHELL_ENV "SHELL"
|
#define GOLD_SHELL_ENV "SHELL"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
inline bool isslash(char c) { return (c == '\\') || (c == '/'); }
|
inline bool isslash(char c) { return (c == '\\') or (c == '/'); }
|
||||||
|
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
@ -278,7 +278,7 @@ FILE *fsopen(const char *path, const char *type, int shflag) {
|
|||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while((n < 3) && (c));
|
} while((n < 3) and (c));
|
||||||
|
|
||||||
fh = sopen(path, acc, shflag, mode);
|
fh = sopen(path, acc, shflag, mode);
|
||||||
if(fh != -1)
|
if(fh != -1)
|
||||||
|
@ -164,16 +164,16 @@ bool maketruepath(std::string &dirname) {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
long inspos = -1;
|
long inspos = -1;
|
||||||
if((dirname.length() == 2) && (dirname[1] == ':'))
|
if((dirname.length() == 2) and (dirname[1] == ':'))
|
||||||
inspos = 2;
|
inspos = 2;
|
||||||
else if((dirname.length() < 2) || (dirname[1] != ':') || isslash(dirname[0]))
|
else if((dirname.length() < 2) or (dirname[1] != ':') or isslash(dirname[0]))
|
||||||
inspos = 0;
|
inspos = 0;
|
||||||
else if(!isslash(dirname[2]))
|
else if(not isslash(dirname[2]))
|
||||||
inspos = 2;
|
inspos = 2;
|
||||||
if(inspos != -1) {
|
if(inspos != -1) {
|
||||||
char chdrive[] = " :";
|
char chdrive[] = " :";
|
||||||
chdrive[0] = (inspos == 2) ? dirname[0] : cwd[0];
|
chdrive[0] = (inspos == 2) ? dirname[0] : cwd[0];
|
||||||
if(!chdir(chdrive)) {
|
if(not chdir(chdrive)) {
|
||||||
char dwd[GMAXPATH];
|
char dwd[GMAXPATH];
|
||||||
getcwd(dwd, GMAXPATH);
|
getcwd(dwd, GMAXPATH);
|
||||||
if(isslash(dirname[0]))
|
if(isslash(dirname[0]))
|
||||||
@ -192,11 +192,11 @@ bool maketruepath(std::string &dirname) {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
if(!dirname.empty() && (dirname[0] == '~')) {
|
if(not dirname.empty() and (dirname[0] == '~')) {
|
||||||
char* lname;
|
char* lname;
|
||||||
const char *p = dirname.c_str()+1;
|
const char *p = dirname.c_str()+1;
|
||||||
if((dirname.length() != 1) && !isslash(*p)) {
|
if((dirname.length() != 1) and not isslash(*p)) {
|
||||||
while(*p && !isslash(*p))
|
while(*p and not isslash(*p))
|
||||||
ndirname += *p++; // get user name
|
ndirname += *p++; // get user name
|
||||||
} else {
|
} else {
|
||||||
if ((lname = getlogin()) == NULL)
|
if ((lname = getlogin()) == NULL)
|
||||||
@ -215,7 +215,7 @@ bool maketruepath(std::string &dirname) {
|
|||||||
dirname = cwd;
|
dirname = cwd;
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
} else if(!dirname.empty() && !isslash(dirname[0])) {
|
} else if(not dirname.empty() and not isslash(dirname[0])) {
|
||||||
ndirname = cwd;
|
ndirname = cwd;
|
||||||
ndirname += "/";
|
ndirname += "/";
|
||||||
ndirname += dirname;
|
ndirname += dirname;
|
||||||
@ -234,9 +234,9 @@ bool maketruepath(std::string &dirname) {
|
|||||||
#endif
|
#endif
|
||||||
size_t len = dirname.length();
|
size_t len = dirname.length();
|
||||||
#ifdef __HAVE_DRIVES__
|
#ifdef __HAVE_DRIVES__
|
||||||
while((len > 3) && isslash(dirname[--len]))
|
while((len > 3) and isslash(dirname[--len]))
|
||||||
#else
|
#else
|
||||||
while((len > 1) && isslash(dirname[--len]))
|
while((len > 1) and isslash(dirname[--len]))
|
||||||
#endif
|
#endif
|
||||||
dirname.erase(len, 1);
|
dirname.erase(len, 1);
|
||||||
if(access(dirname.c_str(), R_OK)) {
|
if(access(dirname.c_str(), R_OK)) {
|
||||||
@ -259,13 +259,13 @@ bool maketruepath(std::string &dirname) {
|
|||||||
while((skipfrom=dirname.find("/./")) != dirname.npos)
|
while((skipfrom=dirname.find("/./")) != dirname.npos)
|
||||||
dirname.erase(skipfrom, 2);
|
dirname.erase(skipfrom, 2);
|
||||||
len = dirname.length();
|
len = dirname.length();
|
||||||
if(len > 2 && !strcmp(&(dirname.c_str()[len-2]), "/."))
|
if(len > 2 and not strcmp(&(dirname.c_str()[len-2]), "/."))
|
||||||
dirname.erase(len-2, 2);
|
dirname.erase(len-2, 2);
|
||||||
len = dirname.length();
|
len = dirname.length();
|
||||||
#ifdef __HAVE_DRIVES__
|
#ifdef __HAVE_DRIVES__
|
||||||
if((len > 3) && isslash(dirname[--len]))
|
if((len > 3) and isslash(dirname[--len]))
|
||||||
#else
|
#else
|
||||||
if((len > 1) && isslash(dirname[--len]))
|
if((len > 1) and isslash(dirname[--len]))
|
||||||
#endif
|
#endif
|
||||||
dirname.erase(len, 1);
|
dirname.erase(len, 1);
|
||||||
return ok;
|
return ok;
|
||||||
|
@ -885,7 +885,7 @@ int gkbd_nt2bios(INPUT_RECORD& inp) {
|
|||||||
else {
|
else {
|
||||||
// If it is a letter key, use the ASCII value supplied
|
// If it is a letter key, use the ASCII value supplied
|
||||||
// by NT to take into account the CapsLock state.
|
// by NT to take into account the CapsLock state.
|
||||||
if(isupper(keycode) || (k->normal == -1))
|
if(isupper(keycode) or (k->normal == -1))
|
||||||
c = ascii;
|
c = ascii;
|
||||||
else
|
else
|
||||||
c = k->normal;
|
c = k->normal;
|
||||||
@ -1037,7 +1037,7 @@ gkey kbxget_raw(int mode) {
|
|||||||
ungetch(key2);
|
ungetch(key2);
|
||||||
}
|
}
|
||||||
// Curses sequence; lookup in nice table above
|
// Curses sequence; lookup in nice table above
|
||||||
else if((key >= KEY_MIN) && (key <= KEY_MIN+sizeof(gkbd_curstable)/sizeof(int)))
|
else if((key >= KEY_MIN) and (key <= KEY_MIN+sizeof(gkbd_curstable)/sizeof(int)))
|
||||||
k = (gkbd_curstable[key - KEY_MIN]);
|
k = (gkbd_curstable[key - KEY_MIN]);
|
||||||
else if(key == '\015')
|
else if(key == '\015')
|
||||||
k = Key_Ent;
|
k = Key_Ent;
|
||||||
|
@ -30,7 +30,7 @@
|
|||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
|
|
||||||
inline int isleap(unsigned yr) { return yr % 400 == 0 || (yr % 4 == 0 && yr % 100 != 0); }
|
inline int isleap(unsigned yr) { return (yr % 400 == 0) or ((yr % 4 == 0) and (yr % 100 != 0)); }
|
||||||
inline unsigned months_to_days(unsigned month) { return (month * 3057 - 3007) / 100; }
|
inline unsigned months_to_days(unsigned month) { return (month * 3057 - 3007) / 100; }
|
||||||
inline long years_to_days(unsigned yr) { return yr * 365L + yr / 4 - yr / 100 + yr / 400; }
|
inline long years_to_days(unsigned yr) { return yr * 365L + yr / 4 - yr / 100 + yr / 400; }
|
||||||
|
|
||||||
|
@ -108,7 +108,7 @@ int g_init_os(int flags) {
|
|||||||
tolower(c) = i + 128;
|
tolower(c) = i + 128;
|
||||||
}
|
}
|
||||||
for(i=128; i<256; i++) {
|
for(i=128; i<256; i++) {
|
||||||
if((toupper(tolower(i)) != i) && (tolower(toupper(i)) != i))
|
if((toupper(tolower(i)) != i) and (tolower(toupper(i)) != i))
|
||||||
tolower(i) = toupper(i) = i;
|
tolower(i) = toupper(i) = i;
|
||||||
if(toupper(tolower(i)) != toupper(i))
|
if(toupper(tolower(i)) != toupper(i))
|
||||||
toupper(i) = i;
|
toupper(i) = i;
|
||||||
|
@ -217,7 +217,7 @@ void g_increase_priority(void) {
|
|||||||
|
|
||||||
void g_set_ostitle(char *title) {
|
void g_set_ostitle(char *title) {
|
||||||
|
|
||||||
if(ge_os2_hsw && ge_os2_hwndframe) {
|
if(ge_os2_hsw and ge_os2_hwndframe) {
|
||||||
strxcpy(ge_os2_swdata.szSwtitle, title, MAXNAMEL);
|
strxcpy(ge_os2_swdata.szSwtitle, title, MAXNAMEL);
|
||||||
pfnWinChangeSwitchEntry(ge_os2_hsw, &ge_os2_swdata);
|
pfnWinChangeSwitchEntry(ge_os2_hsw, &ge_os2_swdata);
|
||||||
pfnWinSetWindowText(ge_os2_hwndframe, (PSZ)title);
|
pfnWinSetWindowText(ge_os2_hwndframe, (PSZ)title);
|
||||||
@ -230,7 +230,7 @@ void g_set_ostitle(char *title) {
|
|||||||
|
|
||||||
void g_set_osicon(void) {
|
void g_set_osicon(void) {
|
||||||
|
|
||||||
if(ge_os2_hwndframe && ge_os2_hsw) {
|
if(ge_os2_hwndframe and ge_os2_hsw) {
|
||||||
ULONG ulPicture = (ULONG) pfnWinLoadPointer(HWND_DESKTOP, 0, 1);
|
ULONG ulPicture = (ULONG) pfnWinLoadPointer(HWND_DESKTOP, 0, 1);
|
||||||
if(ulPicture) {
|
if(ulPicture) {
|
||||||
pfnWinSendMsg(ge_os2_hwndframe, WM_SETICON, (MPARAM) ulPicture, (MPARAM) 0);
|
pfnWinSendMsg(ge_os2_hwndframe, WM_SETICON, (MPARAM) ulPicture, (MPARAM) 0);
|
||||||
|
@ -1786,7 +1786,7 @@ int wborder(int btype) {
|
|||||||
return gwin.werrno=W_NOACTIVE;
|
return gwin.werrno=W_NOACTIVE;
|
||||||
|
|
||||||
// check for valid box type
|
// check for valid box type
|
||||||
if(btype<0||btype>7)
|
if((btype<0) or (btype>7))
|
||||||
return gwin.werrno=W_INVBTYPE;
|
return gwin.werrno=W_INVBTYPE;
|
||||||
|
|
||||||
// see if window is to have a border
|
// see if window is to have a border
|
||||||
|
@ -173,7 +173,7 @@ int whline(int wsrow, int wscol, int count, int btype, int attr) {
|
|||||||
// see if a left junction or corner is needed
|
// see if a left junction or corner is needed
|
||||||
up = isupvert (btype,wgetc(row-1,col));
|
up = isupvert (btype,wgetc(row-1,col));
|
||||||
down = isdownvert(btype,wgetc(row+1,col));
|
down = isdownvert(btype,wgetc(row+1,col));
|
||||||
if(up&&down)
|
if(up and down)
|
||||||
ch=LVJ;
|
ch=LVJ;
|
||||||
else if(up)
|
else if(up)
|
||||||
ch=LLC;
|
ch=LLC;
|
||||||
@ -195,7 +195,7 @@ int whline(int wsrow, int wscol, int count, int btype, int attr) {
|
|||||||
// see if a middle junction is needed
|
// see if a middle junction is needed
|
||||||
up = isupvert (btype,wgetc(row-1,col));
|
up = isupvert (btype,wgetc(row-1,col));
|
||||||
down = isdownvert(btype,wgetc(row+1,col));
|
down = isdownvert(btype,wgetc(row+1,col));
|
||||||
if(up&&down)
|
if(up and down)
|
||||||
ch=MJ;
|
ch=MJ;
|
||||||
else if(up)
|
else if(up)
|
||||||
ch=LHJ;
|
ch=LHJ;
|
||||||
@ -216,7 +216,7 @@ int whline(int wsrow, int wscol, int count, int btype, int attr) {
|
|||||||
// see if a right junction or corner is needed
|
// see if a right junction or corner is needed
|
||||||
up = isupvert (btype,wgetc(row-1,col));
|
up = isupvert (btype,wgetc(row-1,col));
|
||||||
down = isdownvert(btype,wgetc(row+1,col));
|
down = isdownvert(btype,wgetc(row+1,col));
|
||||||
if(up&&down)
|
if(up and down)
|
||||||
ch=RVJ;
|
ch=RVJ;
|
||||||
else if(up)
|
else if(up)
|
||||||
ch=LRC;
|
ch=LRC;
|
||||||
@ -254,7 +254,7 @@ int wvline(int wsrow, int wscol, int count, int btype, int attr) {
|
|||||||
// see if a top junction or corner is needed
|
// see if a top junction or corner is needed
|
||||||
left = islefthorz (btype,wgetc(row,col-1));
|
left = islefthorz (btype,wgetc(row,col-1));
|
||||||
right = isrighthorz(btype,wgetc(row,col+1));
|
right = isrighthorz(btype,wgetc(row,col+1));
|
||||||
if(left&&right)
|
if(left and right)
|
||||||
ch=UHJ;
|
ch=UHJ;
|
||||||
else if(left)
|
else if(left)
|
||||||
ch=URC;
|
ch=URC;
|
||||||
@ -274,7 +274,7 @@ int wvline(int wsrow, int wscol, int count, int btype, int attr) {
|
|||||||
while(count>1) {
|
while(count>1) {
|
||||||
left = islefthorz (btype,wgetc(row,col-1));
|
left = islefthorz (btype,wgetc(row,col-1));
|
||||||
right = isrighthorz(btype,wgetc(row,col+1));
|
right = isrighthorz(btype,wgetc(row,col+1));
|
||||||
if(left&&right)
|
if(left and right)
|
||||||
ch=MJ;
|
ch=MJ;
|
||||||
else if(left)
|
else if(left)
|
||||||
ch=RVJ;
|
ch=RVJ;
|
||||||
@ -295,7 +295,7 @@ int wvline(int wsrow, int wscol, int count, int btype, int attr) {
|
|||||||
// see if a bottom junction or corner is needed
|
// see if a bottom junction or corner is needed
|
||||||
left = islefthorz (btype,wgetc(row,col-1));
|
left = islefthorz (btype,wgetc(row,col-1));
|
||||||
right = isrighthorz(btype,wgetc(row,col+1));
|
right = isrighthorz(btype,wgetc(row,col+1));
|
||||||
if(left&&right)
|
if(left and right)
|
||||||
ch=LHJ;
|
ch=LHJ;
|
||||||
else if(left)
|
else if(left)
|
||||||
ch=LRC;
|
ch=LRC;
|
||||||
|
@ -220,7 +220,7 @@ static void disp_item(_item_t *witem,int bar)
|
|||||||
// see if currently in bar region. if so, then use
|
// see if currently in bar region. if so, then use
|
||||||
// a space for the character. otherwise use the
|
// a space for the character. otherwise use the
|
||||||
// character from the current position in the string
|
// character from the current position in the string
|
||||||
ch = (i<gwin.cmenu->textpos||i>textend)?' ':(*p++);
|
ch = ((i<gwin.cmenu->textpos) or (i>textend)) ? ' ' : (*p++);
|
||||||
|
|
||||||
// select attribute of character to be displayed based upon if
|
// select attribute of character to be displayed based upon if
|
||||||
// selection bar was specified, if the menu item is non-selectable,
|
// selection bar was specified, if the menu item is non-selectable,
|
||||||
@ -229,7 +229,7 @@ static void disp_item(_item_t *witem,int bar)
|
|||||||
chattr = gwin.cmenu->barattr;
|
chattr = gwin.cmenu->barattr;
|
||||||
else if(witem->fmask&M_NOSEL)
|
else if(witem->fmask&M_NOSEL)
|
||||||
chattr = gwin.cmenu->noselattr;
|
chattr = gwin.cmenu->noselattr;
|
||||||
else if((ch==witem->schar)&&!found) {
|
else if((ch==witem->schar) and not found) {
|
||||||
found = YES;
|
found = YES;
|
||||||
chattr = gwin.cmenu->scharattr;
|
chattr = gwin.cmenu->scharattr;
|
||||||
}
|
}
|
||||||
@ -248,7 +248,7 @@ static void disp_item(_item_t *witem,int bar)
|
|||||||
wprintws(witem->wrow, wcol, (vatch*)buf, width);
|
wprintws(witem->wrow, wcol, (vatch*)buf, width);
|
||||||
|
|
||||||
// display text description, if one exists
|
// display text description, if one exists
|
||||||
if(witem->desc!=NULL&&dispdesc) {
|
if((witem->desc!=NULL) and dispdesc) {
|
||||||
whp = wfindrec(witem->dwhdl);
|
whp = wfindrec(witem->dwhdl);
|
||||||
i = (1 + whp->ecol - whp->scol) - (whp->border ? 2 : 0);
|
i = (1 + whp->ecol - whp->scol) - (whp->border ? 2 : 0);
|
||||||
sprintf(buf, "%-*.*s", i, i, witem->desc);
|
sprintf(buf, "%-*.*s", i, i, witem->desc);
|
||||||
@ -286,7 +286,7 @@ static _item_t * down_item(_item_t *curr)
|
|||||||
if(trow>crow) {
|
if(trow>crow) {
|
||||||
tdist=abs((ccol-tcol));
|
tdist=abs((ccol-tcol));
|
||||||
bdist=abs((ccol-bcol));
|
bdist=abs((ccol-bcol));
|
||||||
if((trow<brow)||((trow==brow&&tdist<bdist))) {
|
if((trow<brow) or ((trow==brow) and (tdist<bdist))) {
|
||||||
best=temp;
|
best=temp;
|
||||||
brow=trow;
|
brow=trow;
|
||||||
bcol=tcol;
|
bcol=tcol;
|
||||||
@ -328,8 +328,7 @@ static _item_t * first_item(void)
|
|||||||
|
|
||||||
// search backwards through linked list, testing each item
|
// search backwards through linked list, testing each item
|
||||||
for(temp=best->prev;temp!=NULL;temp=temp->prev) {
|
for(temp=best->prev;temp!=NULL;temp=temp->prev) {
|
||||||
if( (temp->wrow<best->wrow) ||
|
if((temp->wrow<best->wrow) or ((temp->wrow==best->wrow) and (temp->wcol<best->wcol)))
|
||||||
( (temp->wrow==best->wrow) && (temp->wcol<best->wcol) ) )
|
|
||||||
best=temp;
|
best=temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -376,9 +375,7 @@ static _item_t * last_item(void)
|
|||||||
|
|
||||||
// search backwards through linked list, testing each item
|
// search backwards through linked list, testing each item
|
||||||
for(temp=best->prev;temp!=NULL;temp=temp->prev) {
|
for(temp=best->prev;temp!=NULL;temp=temp->prev) {
|
||||||
if( (temp->wrow>best->wrow) ||
|
if((temp->wrow>best->wrow) or ((temp->wrow==best->wrow) and (temp->wcol>bcol))) {
|
||||||
( (temp->wrow==best->wrow) &&
|
|
||||||
(temp->wcol>bcol) ) ) {
|
|
||||||
best=temp;
|
best=temp;
|
||||||
bcol=best->wcol;
|
bcol=best->wcol;
|
||||||
}
|
}
|
||||||
@ -456,7 +453,7 @@ static _item_t * left_item(_item_t *curr)
|
|||||||
tpos=(temp->wrow*wwidth) + temp->wcol;
|
tpos=(temp->wrow*wwidth) + temp->wcol;
|
||||||
|
|
||||||
// compare position of test item with best item, current item
|
// compare position of test item with best item, current item
|
||||||
if(tpos>bpos && tpos<cpos) {
|
if((tpos>bpos) and (tpos<cpos)) {
|
||||||
best=temp;
|
best=temp;
|
||||||
bpos=tpos;
|
bpos=tpos;
|
||||||
}
|
}
|
||||||
@ -492,7 +489,7 @@ static _item_t *mouse_on_item(_menu_t *menu,int mcrow,int mccol)
|
|||||||
if(mcrow==(srow+border+item->wrow)) {
|
if(mcrow==(srow+border+item->wrow)) {
|
||||||
start = scol+border+item->wcol;
|
start = scol+border+item->wcol;
|
||||||
end = start+calc_bar_width(menu,item)-1;
|
end = start+calc_bar_width(menu,item)-1;
|
||||||
if(mccol>=start&&mccol<=end) {
|
if((mccol>=start) and (mccol<=end)) {
|
||||||
found=item;
|
found=item;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -615,7 +612,7 @@ static _item_t * right_item(_item_t *curr)
|
|||||||
tpos=(temp->wrow*wwidth) + temp->wcol;
|
tpos=(temp->wrow*wwidth) + temp->wcol;
|
||||||
|
|
||||||
// compare position of test item with best item, current item
|
// compare position of test item with best item, current item
|
||||||
if(tpos<bpos && tpos>cpos) {
|
if((tpos<bpos) and (tpos>cpos)) {
|
||||||
best=temp;
|
best=temp;
|
||||||
bpos=tpos;
|
bpos=tpos;
|
||||||
}
|
}
|
||||||
@ -661,7 +658,7 @@ static _item_t * up_item(_item_t *curr)
|
|||||||
if(trow<crow) {
|
if(trow<crow) {
|
||||||
tdist=abs(ccol-tcol);
|
tdist=abs(ccol-tcol);
|
||||||
bdist=abs(ccol-bcol);
|
bdist=abs(ccol-bcol);
|
||||||
if((trow>brow)||((trow==brow&&tdist<bdist))) {
|
if((trow>brow) or ((trow==brow) and (tdist<bdist))) {
|
||||||
best=temp;
|
best=temp;
|
||||||
brow=trow;
|
brow=trow;
|
||||||
bcol=tcol;
|
bcol=tcol;
|
||||||
@ -823,7 +820,7 @@ int wmenuend(int taginit, int menutype, int barwidth, int textpos, int textattr,
|
|||||||
int w_width, border, found;
|
int w_width, border, found;
|
||||||
|
|
||||||
// make sure at least 1 menu item has been defined
|
// make sure at least 1 menu item has been defined
|
||||||
if(!gwin.mlevel||gwin.mlevel>gwin.ilevel)
|
if(not gwin.mlevel or (gwin.mlevel>gwin.ilevel))
|
||||||
return(gwin.werrno=W_NOITMDEF);
|
return(gwin.werrno=W_NOITMDEF);
|
||||||
|
|
||||||
// make sure that the specified initial tagid matches the
|
// make sure that the specified initial tagid matches the
|
||||||
@ -886,7 +883,7 @@ int wmenuget() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// make sure that wmenuend() was called
|
// make sure that wmenuend() was called
|
||||||
if(gwin.mlevel||gwin.ilevel) {
|
if(gwin.mlevel or gwin.ilevel) {
|
||||||
gwin.werrno=W_NOMNUEND;
|
gwin.werrno=W_NOMNUEND;
|
||||||
return(-1);
|
return(-1);
|
||||||
}
|
}
|
||||||
@ -939,14 +936,13 @@ int wmenuget() {
|
|||||||
citem=NULL;
|
citem=NULL;
|
||||||
if(gwin.cmenu->menutype&M_SAVE) {
|
if(gwin.cmenu->menutype&M_SAVE) {
|
||||||
for(citem=gwin.cmenu->item;citem!=NULL;citem=citem->prev) {
|
for(citem=gwin.cmenu->item;citem!=NULL;citem=citem->prev) {
|
||||||
if((gwin.cmenu->citem==citem)&&
|
if((gwin.cmenu->citem==citem) and not (citem->fmask&M_NOSEL))
|
||||||
(!(citem->fmask&M_NOSEL)))
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(citem==NULL) {
|
if(citem==NULL) {
|
||||||
citem=wmenuifind(gwin.cmenu->tagcurr);
|
citem=wmenuifind(gwin.cmenu->tagcurr);
|
||||||
if((citem==NULL)||(citem->fmask&M_NOSEL)) citem=first_item();
|
if((citem==NULL) or (citem->fmask&M_NOSEL)) citem=first_item();
|
||||||
}
|
}
|
||||||
|
|
||||||
// call the current menu item's 'before'
|
// call the current menu item's 'before'
|
||||||
@ -975,7 +971,7 @@ int wmenuget() {
|
|||||||
|
|
||||||
// if Esc checking is on, erase selection bar,
|
// if Esc checking is on, erase selection bar,
|
||||||
// free menu records and return to caller
|
// free menu records and return to caller
|
||||||
if(gwin.esc||(gwin.cmenu!=gwin.menu)) {
|
if(gwin.esc or (gwin.cmenu!=gwin.menu)) {
|
||||||
ESCAPE_KEY:
|
ESCAPE_KEY:
|
||||||
pre_move(citem);
|
pre_move(citem);
|
||||||
pre_exit(w,YES);
|
pre_exit(w,YES);
|
||||||
@ -1008,7 +1004,8 @@ int wmenuget() {
|
|||||||
citem=goto_item(citem,ITM_LT);
|
citem=goto_item(citem,ITM_LT);
|
||||||
|
|
||||||
// if pull-down menu flag is set, select this item
|
// if pull-down menu flag is set, select this item
|
||||||
if(pulldown&&citem->child!=NULL) goto ENTER;
|
if(pulldown and (citem->child!=NULL))
|
||||||
|
goto ENTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Key_Up:
|
case Key_Up:
|
||||||
@ -1037,13 +1034,15 @@ int wmenuget() {
|
|||||||
citem=goto_item(citem,ITM_RT);
|
citem=goto_item(citem,ITM_RT);
|
||||||
|
|
||||||
// if pulldown flag is set, then select this item
|
// if pulldown flag is set, then select this item
|
||||||
if(pulldown&&citem->child!=NULL) goto ENTER;
|
if(pulldown and (citem->child!=NULL))
|
||||||
|
goto ENTER;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Key_Dwn:
|
case Key_Dwn:
|
||||||
|
|
||||||
// if current item has a pull-down menu, select it
|
// if current item has a pull-down menu, select it
|
||||||
if(citem->fmask&M_HASPD) goto ENTER;
|
if(citem->fmask&M_HASPD)
|
||||||
|
goto ENTER;
|
||||||
|
|
||||||
// if current menu is a vertical menu, then hide
|
// if current menu is a vertical menu, then hide
|
||||||
// selection bar and find menu item downwards
|
// selection bar and find menu item downwards
|
||||||
@ -1064,7 +1063,8 @@ int wmenuget() {
|
|||||||
|
|
||||||
// if current menu item has a pull-down menu
|
// if current menu item has a pull-down menu
|
||||||
// attached, then set the pulldown flag
|
// attached, then set the pulldown flag
|
||||||
if(citem->fmask&M_HASPD) pulldown=YES;
|
if(citem->fmask&M_HASPD)
|
||||||
|
pulldown=YES;
|
||||||
|
|
||||||
// display menu item with selection bar
|
// display menu item with selection bar
|
||||||
disp_item(citem,1);
|
disp_item(citem,1);
|
||||||
@ -1090,7 +1090,7 @@ int wmenuget() {
|
|||||||
// if an error was returned by
|
// if an error was returned by
|
||||||
// child menu, free menu records
|
// child menu, free menu records
|
||||||
// and pass error code to caller
|
// and pass error code to caller
|
||||||
if(menuerr==-1&&winerr!=W_ESCPRESS) {
|
if((menuerr==-1) and (winerr!=W_ESCPRESS)) {
|
||||||
call_after(citem);
|
call_after(citem);
|
||||||
menuerr=winerr;
|
menuerr=winerr;
|
||||||
pre_exit(w,YES);
|
pre_exit(w,YES);
|
||||||
@ -1134,7 +1134,7 @@ int wmenuget() {
|
|||||||
// function. if so, then move selection bar to new item
|
// function. if so, then move selection bar to new item
|
||||||
if(gwin.cmenu->tagcurr!=-1) {
|
if(gwin.cmenu->tagcurr!=-1) {
|
||||||
item=wmenuifind(gwin.cmenu->tagcurr);
|
item=wmenuifind(gwin.cmenu->tagcurr);
|
||||||
if(item!=NULL&&(!(item->fmask&M_NOSEL))) {
|
if((item!=NULL) and not (item->fmask&M_NOSEL)) {
|
||||||
pre_move(citem);
|
pre_move(citem);
|
||||||
post_move(gwin.cmenu->citem=citem=item);
|
post_move(gwin.cmenu->citem=citem=item);
|
||||||
break;
|
break;
|
||||||
@ -1167,7 +1167,7 @@ int wmenuget() {
|
|||||||
// if child menu returned an exit-all-menus flag,
|
// if child menu returned an exit-all-menus flag,
|
||||||
// then free menu records and pass exit-all-menus
|
// then free menu records and pass exit-all-menus
|
||||||
// flag onto caller
|
// flag onto caller
|
||||||
if((menuerr==M_EXITALL)||(citem->fmask&M_CLALL)) {
|
if((menuerr==M_EXITALL) or (citem->fmask&M_CLALL)) {
|
||||||
disp_item(citem,1);
|
disp_item(citem,1);
|
||||||
call_after(citem);
|
call_after(citem);
|
||||||
if(citem->fmask&M_CLALL)
|
if(citem->fmask&M_CLALL)
|
||||||
@ -1182,8 +1182,8 @@ int wmenuget() {
|
|||||||
// child menu, or current item has close-menu
|
// child menu, or current item has close-menu
|
||||||
// specified, free menu records, and return tag
|
// specified, free menu records, and return tag
|
||||||
// identifier of current menu item
|
// identifier of current menu item
|
||||||
if(citem->child!=NULL||citem->select!=NULL)
|
if((citem->child!=NULL) or (citem->select!=NULL))
|
||||||
if((menuerr!=M_EXIT)&&(!(citem->fmask&M_CLOSE)))
|
if((menuerr!=M_EXIT) and (not (citem->fmask&M_CLOSE)))
|
||||||
break;
|
break;
|
||||||
call_after(citem);
|
call_after(citem);
|
||||||
_finaltagid = citem->tagid;
|
_finaltagid = citem->tagid;
|
||||||
@ -1208,16 +1208,15 @@ int wmenuget() {
|
|||||||
item=citem->next;
|
item=citem->next;
|
||||||
for(;;) {
|
for(;;) {
|
||||||
while(item!=NULL) {
|
while(item!=NULL) {
|
||||||
if((toupper(ch)==toupper(item->schar))&&(!(item->fmask
|
if((toupper(ch)==toupper(item->schar)) and not (item->fmask&M_NOSEL))
|
||||||
&M_NOSEL))) goto FARBREAK;
|
goto FARBREAK;
|
||||||
if(citem==item) {
|
if(citem==item) {
|
||||||
valid=NO;
|
valid=NO;
|
||||||
goto FARBREAK;
|
goto FARBREAK;
|
||||||
}
|
}
|
||||||
item=item->next;
|
item=item->next;
|
||||||
}
|
}
|
||||||
for(item=gwin.cmenu->item;item->prev!=NULL;
|
for(item=gwin.cmenu->item; item->prev!=NULL; item=item->prev) {}
|
||||||
item=item->prev);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FARBREAK:
|
FARBREAK:
|
||||||
|
@ -56,6 +56,7 @@ void gareafile::ReadMaximus3(char* mxpath, char* areafile, char* options) {
|
|||||||
fread(prmp, sizeof(m_pointers), 1, fp);
|
fread(prmp, sizeof(m_pointers), 1, fp);
|
||||||
long heapsz = fsize(fp) - prm.heap_offset;
|
long heapsz = fsize(fp) - prm.heap_offset;
|
||||||
char* offsets = (char*)throw_calloc(1, (uint)heapsz);
|
char* offsets = (char*)throw_calloc(1, (uint)heapsz);
|
||||||
|
fseek(fp, prm.heap_offset, SEEK_SET);
|
||||||
fread(offsets, (uint)heapsz, 1, fp);
|
fread(offsets, (uint)heapsz, 1, fp);
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user