diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-05-12 01:02:17 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-05-12 01:02:17 +0000 |
| commit | a04c2e28e731039cf154041423fa5a3f71618d2d (patch) | |
| tree | 94b23615fb0bbdb2d028808dc7afd755f65cc5b0 /fluid | |
| parent | e2084610ad0a92d4782ea0326f6a81ee4aa6f82f (diff) | |
Default argument patch from Fabien Constantini.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2207 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid')
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 661379cc7..8d232c6c2 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.4 2002/05/04 05:28:11 easysw Exp $" +// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.5 2002/05/12 01:02:17 easysw Exp $" // // C function type code for the Fast Light Tool Kit (FLTK). // @@ -257,7 +257,29 @@ void Fl_Function_Type::write_code1() { *sptr = '\0'; write_h("%s;\n", s); - write_c("%s::%s {\n", k, name()); + // skip all function default param. init in body: + int skips=0; + int nc=0,level=0; + for (sptr=s,nptr=(char*)name(); *nptr; nc++,nptr++) { + if (!skips && *nptr=='(') level++; + else if (!skips && *nptr==')') level--; + + if ( *nptr=='"' && !(nc && *(nptr-1)=='\\') ) + skips = skips ? 0 : 1; + if(!skips && level==1 && *nptr =='=' && + !(nc && *(nptr-1)=='\'') ) // ignore '=' case + while(*++nptr && (skips || *(nptr-1)=='\'' || + (*nptr!=',' && (*nptr!=')' || level!=1) ))) { + if ( *nptr=='"' && *(nptr-1)!='\\' ) + skips = skips ? 0 : 1; + if (!skips && *nptr=='(') level++; + else if (!skips && *nptr==')') level--; + } + *sptr++ = *nptr; + } + *sptr = '\0'; + + write_c("%s::%s {\n", k, s); } else { if (public_) { if (cdecl_) @@ -680,5 +702,5 @@ void Fl_Class_Type::write_code2() { } // -// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.4 2002/05/04 05:28:11 easysw Exp $". +// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.5 2002/05/12 01:02:17 easysw Exp $". // |
