diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2006-09-24 19:24:12 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2006-09-24 19:24:12 +0000 |
| commit | 174c006fd527f02fe5ec4b5121aa88847e503052 (patch) | |
| tree | 04c41511f69a7d373f497e18442721505710e06b | |
| parent | ad40154ca3130e6b4731f57294b6caa4f59b782d (diff) | |
Update "o" variable detection code to handle more cases (STR #1429)
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@5487 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | CHANGES | 20 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 24 |
2 files changed, 28 insertions, 16 deletions
@@ -35,19 +35,19 @@ CHANGES IN FLTK 1.1.8 - Fixed Fl_Positioner callback when released (STR #1387) - Fixed WIN32 zero size window issue (STR #1387) - Fixed Sudoku window positioning (STR #1398) - - Fluid Code Declarations can now handle - C++ style comments (STR #1383) - - Fixed uninitialized data in OS X and WIN32 - timout functions (STR #1374). - - Fixed speed issues when measuring text on OS X - with Quartz (STR #1386). + - Fluid Code Declarations can now handle C++ style + comments (STR #1383) + - Fixed uninitialized data in OS X and WIN32 timeout + functions (STR #1374). + - Fixed speed issues when measuring text on OS X with + Quartz (STR #1386). - Fixed focus issues on OS X (STR #1377) - Optional precission argument when storing floats or doubles in a Preferences file (STR #1381) - - Fixed callback not called when using arrow keys - in Fl_Slider (STR #1333) - - Changing the shorcut of a widget in fluid now marks - the document as dirty (STR #1382) + - Fixed callback not called when using arrow keys in + Fl_Slider (STR #1333) + - Changing the shorcut of a widget in fluid now marks the + document as dirty (STR #1382) - Fl_Text_Editor now correctly handles middle mouse clicks (STR #1384) - Added some GLUT4 functions (STR #1370) diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index 8d936830e..68ea38bd9 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1985,12 +1985,24 @@ void Fl_Widget_Type::write_code1() { if (!varused) { for (int n=0; n < NUM_EXTRA_CODE; n++) - if (extra_code(n) && !isdeclare(extra_code(n)) && - (ptr = strstr(extra_code(n), "o->")) != NULL && - (ptr == extra_code(n) || - (!isalnum(ptr[-1] & 255) && ptr[-1] != '_'))) { - varused = 1; - break; + if (extra_code(n) && !isdeclare(extra_code(n))) + { + int instring = 0; + int inname = 0; + for (ptr = extra_code(n); *ptr; ptr ++) + if (instring) { + if (*ptr == '\\') ptr++; + else if (*ptr == '\"') instring = 0; + } else if (inname && !isalnum(*ptr & 255)) inname = 0; + else if (*ptr == '\"') instring = 1; + else if (!strncmp(ptr, "o->", 3) || !strncmp(ptr, "o)", 2) || + !strncmp(ptr, "o,", 2) || !strncmp(ptr, "o ", 2)) break; + else if (isalnum(*ptr & 255)) inname = 1; + + if (*ptr) { + varused = 1; + break; + } } } |
