mirror of
https://github.com/fltk/fltk.git
synced 2026-06-02 07:26:57 +08:00
Use strspn() to look at full words (better "o" detection)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5577 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
@@ -1995,19 +1995,22 @@ void Fl_Widget_Type::write_code1() {
|
|||||||
{
|
{
|
||||||
int instring = 0;
|
int instring = 0;
|
||||||
int inname = 0;
|
int inname = 0;
|
||||||
for (ptr = extra_code(n); *ptr; ptr ++)
|
for (ptr = extra_code(n); *ptr; ptr ++) {
|
||||||
if (instring) {
|
if (instring) {
|
||||||
if (*ptr == '\\') ptr++;
|
if (*ptr == '\\') ptr++;
|
||||||
else if (*ptr == '\"') instring = 0;
|
else if (*ptr == '\"') instring = 0;
|
||||||
} else if (inname && !isalnum(*ptr & 255)) inname = 0;
|
} else if (inname && !isalnum(*ptr & 255)) inname = 0;
|
||||||
else if (*ptr == '\"') instring = 1;
|
else if (*ptr == '\"') instring = 1;
|
||||||
else if (!strncmp(ptr, "o->", 3) || !strncmp(ptr, "o)", 2) ||
|
else if (isalnum(*ptr & 255) || *ptr == '_') {
|
||||||
!strncmp(ptr, "o,", 2) || !strncmp(ptr, "o ", 2)) break;
|
size_t len = strspn(ptr, "0123456789_"
|
||||||
else if (isalnum(*ptr & 255)) inname = 1;
|
"abcdefghijklmnopqrstuvwxyz"
|
||||||
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ");
|
||||||
|
|
||||||
if (*ptr) {
|
if (!strncmp(ptr, "o", len)) {
|
||||||
varused = 1;
|
varused = 1;
|
||||||
break;
|
break;
|
||||||
|
} else ptr += len - 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user