Пример #1
0
int gs_compare ( const char *s1, const char *s2 )
 {
   int c1, c2; // ANSI definition of toupper() uses int types
   while ( *s1 && *s2 )
    { c1 = GS_UPPER(*s1);
      c2 = GS_UPPER(*s2);
      if ( c1!=c2 ) return c1-c2;
      s1++; s2++;
    }
   if ( !*s1 && !*s2 ) return 0;
   return !*s1? -1:1;
 }
Пример #2
0
int gs_compare ( const char *s1, const char *s2, int n )
 {
   int c1, c2; // ANSI definition of toupper() uses int types

   //   printf("[%s]<>[%s] (%d)\n",s1,s2,n);

   while ( *s1 && *s2 )
    { c1 = GS_UPPER(*s1);
      c2 = GS_UPPER(*s2);
      if ( c1!=c2 ) return c1-c2;
      s1++; s2++; n--;
      if ( n==0 ) return n; // are equal
    }
   if ( !*s1 && !*s2 ) return 0;
   return !*s1? -1:1;
 }
void SeLct::get_funnel_corners ( GsArray<GsVec2>& points, GsArray<char>& sides, FunnelDeque* funnel )
 {
   char s;
   points.size(0);
   sides.size(0);
   if ( !funnel ) funnel=_fdeque;
   if ( !funnel ) return;
   for ( int i=0; i<funnel->size(); i++ )
    { points.push() = (*funnel)[i];
      s = (*funnel)[i].side;
      sides.push() = s;
      if ( (*funnel)[i].apex ) sides.top() = GS_UPPER(s);
    }
 }
static const char* sFunnelDesc ( GsDeque<SeFunnelPt>& dq )
 { static GsString s;
   s.len(0);
   for ( int i=0; i<dq.size(); i++ ){ char c=dq[i].side; if(dq[i].apex)c=GS_UPPER(c); s<<c; }
   return (const char*)s;
 }