Changed all toupper, tolower, isupper, islower and isalpha to internal defined function. Case insensitive regexp should work on Win9x now.

This commit is contained in:
Ianos Gnatiuc
2005-10-31 22:18:26 +00:00
parent ad8b2a9d36
commit 21b44b65d2
69 changed files with 228 additions and 192 deletions

View File

@@ -281,7 +281,7 @@ void AreaList::WriteAreaDef(const char* file) {
maxpath = MaxV(maxpath, tmp);
if((*aa)->groupid() & 0x8000u)
sprintf(groupid, "#%u", (*aa)->groupid()&0x7FFF);
else if(isupper((*aa)->groupid()))
else if(g_isupper((*aa)->groupid()))
*groupid = (char)(*aa)->groupid(), groupid[1] = NUL;
else
*groupid = '0', groupid[1] = NUL;
@@ -301,7 +301,7 @@ void AreaList::WriteAreaDef(const char* file) {
sprintf(desc, "\"%s\"", (*aa)->desc());
if((*aa)->groupid() & 0x8000u)
sprintf(groupid, "#%u", (*aa)->groupid()&0x7FFF);
else if(isupper((*aa)->groupid()))
else if(g_isupper((*aa)->groupid()))
*groupid = (char)(*aa)->groupid(), groupid[1] = NUL;
else
*groupid = '0', groupid[1] = NUL;

View File

@@ -474,7 +474,7 @@ void AreaList::GetArea(char* def) {
StripQuotes(desc); // Copy description, stripping quotes ("")
aa.setdesc(desc);
switch(toupper(*base)) { // Store area info
switch(g_toupper(*base)) { // Store area info
case '-':
aa.basetype = "SEPARATOR";
@@ -859,7 +859,7 @@ void AreaList::ReadEcholist(char* val) {
continue;
}
else if(is_dz) {
if(not isalpha(*val) and (*val != ','))
if(not g_isalpha(*val) and (*val != ','))
continue;
tok(&key, &val);
}
@@ -877,7 +877,7 @@ void AreaList::ReadEcholist(char* val) {
}
for(area_iterator ap = idx.begin(); ap != idx.end(); ap++) {
if(strieql(key, (*ap)->echoid())) {
(*ap)->set_groupid(toupper(*grp));
(*ap)->set_groupid(g_toupper(*grp));
if(desc)
(*ap)->set_desc(desc);
break;

View File

@@ -42,7 +42,7 @@ int getgroup(const char *key)
if(*key == '#')
return atoi(key+1)+0x8000u;
else
return (isupper(*key) ? *key : 0);
return (g_isupper(*key) ? *key : 0);
}

View File

@@ -149,7 +149,7 @@ int SwitchCfg(word crc, char k, char* v) {
return true;
// Switch the first letter of the keyword
switch(toupper(k)) {
switch(g_toupper(k)) {
case 'A': goto SwitchA;
case 'B': goto SwitchB;
case 'C': goto SwitchC;
@@ -742,7 +742,7 @@ int ReadCfg(const char* cfgfile, int ignoreunknown) {
val = strskip_wht(val);
if(isalpha(*val)) {
if(g_isalpha(*val)) {
// Extract key and val
crc = getkeyvalcrc(&key, &val);

View File

@@ -137,7 +137,7 @@ void CfgNodev7flags() {
char* flagstring = t.First(val);
char* flagvals = t.Next();
uint flagval;
if(tolower(*flagvals) == 'b')
if(g_tolower(*flagvals) == 'b')
flagval = atoi(flagvals+1);
else {
flagval = atoi(flagvals);
@@ -168,7 +168,7 @@ void CfgNodev7modem() {
char* modemstring = t.First(val);
char* modemvals = t.Next();
int modemval;
if(tolower(*modemvals) == 'b')
if(g_tolower(*modemvals) == 'b')
modemval = atoi(modemvals+1);
else {
modemval = atoi(modemvals);

View File

@@ -407,7 +407,7 @@ void CfgSeqOutRun() {
CfgSeqOutRun_Error();
return;
}
switch(tolower(*p)) {
switch(g_tolower(*p)) {
case 'y':
s *= 365;
case 'd':

View File

@@ -966,7 +966,7 @@ static void SetKeybDefaults() {
int k = 0;
while(k < keys) {
if(tmp->key <= 0xFF)
tmp->key = (gkey)tolower(tmp->key);
tmp->key = (gkey)g_tolower(tmp->key);
KeyCmdAdd(tmp->cmd, tmp->key, tmp->type);
tmp++;
k++;
@@ -1037,7 +1037,7 @@ int ReadKeysCfg(int force) {
keyval = (gkey)_keyval;
}
else if(strlen(ptr2) == 1)
keyval = (gkey)tolower(*ptr2); // Always convert to lowercase internally
keyval = (gkey)g_tolower(*ptr2); // Always convert to lowercase internally
else {
keycmd = SwitchKeyDefs(strCrc16(strupr(ptr2)), &keytype);
if(not keycmd or keytype) {

View File

@@ -658,7 +658,7 @@ void LoadLanguage(const char* file) {
while(fgets((ptr=buf), sizeof(buf), fp)) {
line++;
ptr = strskip_wht(ptr);
if(isalpha(*ptr)) {
if(g_isalpha(*ptr)) {
str = ptr;
strtrim(str);
str = strskip_txt(str);
@@ -715,7 +715,7 @@ bool ReadLangCfg(int force) {
while(fgets((ptr=buf), sizeof(buf), fpi)) {
line++;
ptr = strskip_wht(ptr);
if(isalpha(*ptr)) {
if(g_isalpha(*ptr)) {
str = ptr;
strtrim(str);
str = strskip_txt(str);

View File

@@ -193,7 +193,7 @@ void GPickArealist::dispbuf(char* buf, int areano) {
if(groupid_width > 2)
sprintf(groupidbuf, "%u", area->groupid()&0x7FFF);
}
else if(isupper(area->groupid()))
else if(g_isupper(area->groupid()))
sprintf(groupidbuf, "%c", (char)area->groupid());
}
int groupidwidth = strlen(groupidbuf);
@@ -748,7 +748,7 @@ bool GPickArealist::handle_key() {
default:
if(key < KK_Macro) {
n = toupper(key & 0xFF);
n = g_toupper(key & 0xFF);
if((area_fuzidx < area_maxfuz) or (key == Key_BS)) {
// Incremental search in the echoids

View File

@@ -43,7 +43,7 @@ static bool strncont(const char *beginword, const char *stylestopchars, int n)
static bool in_ftn_domained_address(const char *ptr, const char *txt) {
while((ptr != txt) and (not isspace(*ptr) and not isalpha(*ptr))) {
while((ptr != txt) and (not isspace(*ptr) and not g_isalpha(*ptr))) {
if(isdigit(ptr[0]) and ((ptr[1] == ':') or (ptr[1] == '/')) and isdigit(ptr[2]))
return true;
--ptr;

View File

@@ -1998,7 +1998,7 @@ void IEclass::ToUpper() {
if(col < currline->txt.length()) {
Undo->PushItem(EDIT_UNDO_OVR_CHAR);
currline->txt[col] = toupper(currline->txt[col]);
currline->txt[col] = g_toupper(currline->txt[col]);
}
GFTRK(NULL);
@@ -2013,7 +2013,7 @@ void IEclass::ToLower() {
if(col < currline->txt.length()) {
Undo->PushItem(EDIT_UNDO_OVR_CHAR);
currline->txt[col] = tolower(currline->txt[col]);
currline->txt[col] = g_tolower(currline->txt[col]);
}
GFTRK(NULL);
@@ -2028,10 +2028,10 @@ void IEclass::ToggleCase() {
if(col < currline->txt.length()) {
Undo->PushItem(EDIT_UNDO_OVR_CHAR);
if(toupper(currline->txt[col]) == currline->txt[col])
currline->txt[col] = tolower(currline->txt[col]);
if(g_toupper(currline->txt[col]) == currline->txt[col])
currline->txt[col] = g_tolower(currline->txt[col]);
else
currline->txt[col] = toupper(currline->txt[col]);
currline->txt[col] = g_toupper(currline->txt[col]);
}
GFTRK(NULL);
@@ -2050,18 +2050,18 @@ void IEclass::ToggleCaseChar(gkey key,
switch (key)
{
case KK_EditToLower:
newchar = tolower(*it);
newchar = g_tolower(*it);
break;
case KK_EditToUpper:
newchar = toupper(*it);
newchar = g_toupper(*it);
break;
case KK_EditToggleCase:
if (toupper(*it) == oldchar)
newchar = tolower(*it);
if (g_toupper(*it) == oldchar)
newchar = g_tolower(*it);
else
newchar = toupper(*it);
newchar = g_toupper(*it);
break;
}

View File

@@ -259,7 +259,7 @@ bool inline samekey(gkey key1, gkey key2) {
return true;
if((key1 > 0xFF) or (key2 > 0xFF))
return false;
return (tolower(key1) == key2) or (tolower(key2) == key1);
return (g_tolower(key1) == key2) or (g_tolower(key2) == key1);
}

View File

@@ -76,7 +76,7 @@ static void InitCmdline(char* val) {
trueval = val;
if(*val == NUL)
val = key+1;
switch(toupper(*key)) {
switch(g_toupper(*key)) {
case 'C': // Use another Configfile
if(*val)
strcpy(cmdlinecfg, val);
@@ -94,7 +94,7 @@ static void InitCmdline(char* val) {
break;
case 'F':
cmdlineforce = make_bool_not(*val == '-');
if(toupper(key[1]) == 'F')
if(g_toupper(key[1]) == 'F')
cmdlineforce++;
break;
case '?':
@@ -134,7 +134,7 @@ static void InitCmdline(char* val) {
break;
case 'V':
quiet = false;
veryverbose = (toupper(key[1]) == 'V');
veryverbose = (g_toupper(key[1]) == 'V');
break;
case 'W':
cmdlinewriteareas = make_bool_not(*val == '-');
@@ -318,7 +318,7 @@ static void kbputstr(const char* buf) {
break;
case '~':
case '^':
xkey = (gkey)(toupper(buf[++n]) - '@');
xkey = (gkey)(g_toupper(buf[++n]) - '@');
if(xkey)
kbput(xkey);
break;
@@ -974,13 +974,13 @@ void Initialize(int argc, char* argv[]) {
int pos = 0;
char* p = CFG->arealistformat;
while(*p) {
char c = (char)toupper(*p);
char c = (char)g_toupper(*p);
char d = *(++p);
int w = atoi(p);
while(isdigit(*p))
p++;
if(pass == 1) {
if(isalpha(c)) {
if(g_isalpha(c)) {
switch(c) {
case 'A': area_found = true; if(isdigit(d)) area_width = w; break;
case 'M': marked_found = true; if(isdigit(d)) marked_width = w; break;

View File

@@ -756,7 +756,7 @@ void KludgeDATE(GMsg* msg, const char* ptr) {
if(isdigit(*ptr)) {
day = atoi(ptr);
ptr = strskip_wht(strskip_txt(ptr));
if(isalpha(*ptr)) {
if(g_isalpha(*ptr)) {
month = str2mon(ptr);
if(month) {
ptr = strskip_wht(strskip_txt(ptr));
@@ -1383,7 +1383,7 @@ int ScanLine(GMsg* msg, Line* line, const char* ptr, int getvalue, int mask) {
// Skip past "RFC" string, if any
if(strnieql(kludge1, "RFC", 3) and (kludge1[3] != ':')) {
kludge1 += 3;
if(not isalpha(*kludge1))
if(not g_isalpha(*kludge1))
kludge1++;
}
@@ -1696,8 +1696,8 @@ void Latin2Local(char *str)
byte left = i ? str[i-1] : 0;
byte right = str[i+1];
if (((left >= 0x80) && (toupper(left) != tolower(left))) ||
((right >= 0x80) && (toupper(right) != tolower(right))))
if (((left >= 0x80) && (g_toupper(left) != g_tolower(left))) ||
((right >= 0x80) && (g_toupper(right) != g_tolower(right))))
{
str[i] = xch;
@@ -2101,7 +2101,7 @@ void MakeLineIndex(GMsg* msg, int margin, bool getvalue, bool header_recode) {
char* kludge = ptr + (*ptr == CTRL_A ? 1 : 0);
if(strnieql(kludge, "RFC", 3)) {
kludge += 3;
if(not isalpha(*kludge))
if(not g_isalpha(*kludge))
kludge++;
}
while((*ptr != ' ') and (*ptr != ':') and *ptr)

View File

@@ -430,7 +430,7 @@ char* TokenXlat(int mode, char* input, GMsg* msg, GMsg* oldmsg, int __origarea)
char buff[1024];
char token[1024];
char fill = dst[5];
char align = toupper(dst[6]);
char align = g_toupper(dst[6]);
int size = atoi(dst+7);
if (strchr("CLR", align))

View File

@@ -56,7 +56,7 @@ std::string &strtrimline(std::string &p) {
const char* get_subject_re_info(const char* s, uint32_t& n) {
if(toupper(*s) == 'R' and tolower(s[1]) == 'e') {
if(g_toupper(*s) == 'R' and g_tolower(s[1]) == 'e') {
if(s[2] == ':') {
n = 1;
@@ -99,7 +99,7 @@ void CheckSubject(GMsg* msg, char* subj) {
#ifdef __UNIX__
if((*ptr == '/') and not strchr(ptr, ':')) { /* } */
#else
if((in_range((char)tolower(*ptr), (char)'c', (char)'z') and (ptr[1] == ':')) or ((*ptr == '\\') and (ptr[1] == '\\'))) {
if((in_range((char)g_tolower(*ptr), (char)'c', (char)'z') and (ptr[1] == ':')) or ((*ptr == '\\') and (ptr[1] == '\\'))) {
#endif
// Autoattach
msg->attr.att1();

View File

@@ -199,7 +199,7 @@ void Area::InitData() {
if(groupid() & 0x8000u)
sprintf(_groupid, "#%u", groupid() & 0x7FFF);
else {
_groupid[0] = (char)(isalpha(groupid()) ? groupid() : NUL);
_groupid[0] = (char)(g_isalpha(groupid()) ? groupid() : NUL);
_groupid[1] = NUL;
}
}
@@ -244,7 +244,7 @@ void Area::RandomizeData(int mode) {
if(groupid() & 0x8000u)
sprintf(_groupid, "#%u", groupid() & 0x7FFF);
else {
_groupid[0] = (char)(isalpha(groupid()) ? groupid() : NUL);
_groupid[0] = (char)(g_isalpha(groupid()) ? groupid() : NUL);
_groupid[1] = NUL;
}
}

View File

@@ -74,7 +74,7 @@ const char* search_item_set(search_item& item, const char* s) {
case '=': search_item_option(item.case_sensitive, s); break;
case '?':
s++;
switch(tolower(*s)) {
switch(g_tolower(*s)) {
case 'r': item.type = gsearch::regex; break;
case 'w': item.type = gsearch::wildcard; break;
case 'p': item.type = gsearch::plain; break;

View File

@@ -63,7 +63,7 @@ bool is_user(const char* name) {
inline int IsInitial(char c) {
return isalpha(c) or (c > 127);
return g_isalpha(c) or (c > 127);
}

View File

@@ -411,7 +411,7 @@ bool is_quote2(Line* line, const char* ptr)
int nr = 0;
for (char *tmp = head; tmp < ptr; tmp++)
{
char ch = toupper(*tmp);
char ch = g_toupper(*tmp);
if ((ch >= 'A') && (ch <= 'Z'))
nr++;
}

View File

@@ -297,7 +297,7 @@ void GMsgHeaderView::Paint() {
while(ptr) {
if(*ptr == '^')
ptr++;
if((isalpha(*ptr) and (ptr[1] == ':')) or (ptr[0] == '\\') or (ptr[0] == '/'))
if((g_isalpha(*ptr) and (ptr[1] == ':')) or (ptr[0] == '\\') or (ptr[0] == '/'))
strcpy(buf2, ptr);
else
sprintf(buf2, "%s%s", CFG->inboundpath, ptr);