Fixes a few non C89 compliant comments
authorGabriel Jacobo <gabomdq@gmail.com>
Tue, 20 Aug 2013 19:49:24 -0300
changeset 7662d31efd717578
parent 7661 93dac5ca9cb9
child 7663 53fe1b64eb2d
Fixes a few non C89 compliant comments
src/events/SDL_gesture.c
src/joystick/SDL_joystick.c
src/video/SDL_video.c
     1.1 --- a/src/events/SDL_gesture.c	Tue Aug 20 15:56:08 2013 -0400
     1.2 +++ b/src/events/SDL_gesture.c	Tue Aug 20 19:49:24 2013 -0300
     1.3 @@ -121,8 +121,8 @@
     1.4      if (src == NULL) return 0;
     1.5  
     1.6  
     1.7 -    //No Longer storing the Hash, rehash on load
     1.8 -    //if(SDL_RWops.write(src,&(templ->hash),sizeof(templ->hash),1) != 1) return 0;
     1.9 +    /*No Longer storing the Hash, rehash on load*/
    1.10 +    /*if(SDL_RWops.write(src,&(templ->hash),sizeof(templ->hash),1) != 1) return 0;*/
    1.11  
    1.12      if (SDL_RWwrite(src,templ->path,
    1.13                      sizeof(templ->path[0]),DOLLARNPOINTS) != DOLLARNPOINTS)
    1.14 @@ -158,8 +158,8 @@
    1.15      return SDL_SetError("Unknown gestureId");
    1.16  }
    1.17  
    1.18 -//path is an already sampled set of points
    1.19 -//Returns the index of the gesture on success, or -1
    1.20 +/*path is an already sampled set of points
    1.21 +Returns the index of the gesture on success, or -1*/
    1.22  static int SDL_AddDollarGesture_one(SDL_GestureTouch* inTouch, SDL_FloatPoint* path)
    1.23  {
    1.24      SDL_DollarTemplate* dollarTemplate;
    1.25 @@ -196,7 +196,7 @@
    1.26              if (index < 0)
    1.27                  return -1;
    1.28          }
    1.29 -        // Use the index of the last one added.
    1.30 +        /* Use the index of the last one added.*/
    1.31          return index;
    1.32      } else {
    1.33          return SDL_AddDollarGesture_one(inTouch, path);
    1.34 @@ -223,16 +223,16 @@
    1.35             DOLLARNPOINTS) break;
    1.36  
    1.37          if (touchId >= 0) {
    1.38 -            //printf("Adding loaded gesture to 1 touch\n");
    1.39 +            /*printf("Adding loaded gesture to 1 touch\n");*/
    1.40              if (SDL_AddDollarGesture(touch, templ.path) >= 0)
    1.41                  loaded++;
    1.42          }
    1.43          else {
    1.44 -            //printf("Adding to: %i touches\n",SDL_numGestureTouches);
    1.45 +            /*printf("Adding to: %i touches\n",SDL_numGestureTouches);*/
    1.46              for (i = 0; i < SDL_numGestureTouches; i++) {
    1.47                  touch = &SDL_gestureTouch[i];
    1.48 -                //printf("Adding loaded gesture to + touches\n");
    1.49 -                //TODO: What if this fails?
    1.50 +                /*printf("Adding loaded gesture to + touches\n");*/
    1.51 +                /*TODO: What if this fails?*/
    1.52                  SDL_AddDollarGesture(touch,templ.path);
    1.53              }
    1.54              loaded++;
    1.55 @@ -245,7 +245,7 @@
    1.56  
    1.57  static float dollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ,float ang)
    1.58  {
    1.59 -    //  SDL_FloatPoint p[DOLLARNPOINTS];
    1.60 +    /*  SDL_FloatPoint p[DOLLARNPOINTS];*/
    1.61      float dist = 0;
    1.62      SDL_FloatPoint p;
    1.63      int i;
    1.64 @@ -261,9 +261,10 @@
    1.65  
    1.66  static float bestDollarDifference(SDL_FloatPoint* points,SDL_FloatPoint* templ)
    1.67  {
    1.68 -    //------------BEGIN DOLLAR BLACKBOX----------------//
    1.69 -    //-TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-//
    1.70 -    //-"http://depts.washington.edu/aimgroup/proj/dollar/"-//
    1.71 +    /*------------BEGIN DOLLAR BLACKBOX------------------
    1.72 +      -TRANSLATED DIRECTLY FROM PSUDEO-CODE AVAILABLE AT-
    1.73 +      -"http://depts.washington.edu/aimgroup/proj/dollar/"
    1.74 +    */
    1.75      double ta = -M_PI/4;
    1.76      double tb = M_PI/4;
    1.77      double dt = M_PI/90;
    1.78 @@ -296,7 +297,7 @@
    1.79      return SDL_min(f1,f2);
    1.80  }
    1.81  
    1.82 -//DollarPath contains raw points, plus (possibly) the calculated length
    1.83 +/*DollarPath contains raw points, plus (possibly) the calculated length*/
    1.84  static int dollarNormalize(const SDL_DollarPath *path,SDL_FloatPoint *points)
    1.85  {
    1.86      int i;
    1.87 @@ -309,7 +310,7 @@
    1.88      float w,h;
    1.89      float length = path->length;
    1.90  
    1.91 -    //Calculate length if it hasn't already been done
    1.92 +    /*Calculate length if it hasn't already been done*/
    1.93      if (length <= 0) {
    1.94          for (i=1;i < path->numPoints; i++) {
    1.95              float dx = path->p[i  ].x - path->p[i-1].x;
    1.96 @@ -318,17 +319,17 @@
    1.97          }
    1.98      }
    1.99  
   1.100 -    //Resample
   1.101 +    /*Resample*/
   1.102      interval = length/(DOLLARNPOINTS - 1);
   1.103      dist = interval;
   1.104  
   1.105      centroid.x = 0;centroid.y = 0;
   1.106  
   1.107 -    //printf("(%f,%f)\n",path->p[path->numPoints-1].x,path->p[path->numPoints-1].y);
   1.108 +    /*printf("(%f,%f)\n",path->p[path->numPoints-1].x,path->p[path->numPoints-1].y);*/
   1.109      for (i = 1; i < path->numPoints; i++) {
   1.110          float d = (float)(SDL_sqrt((path->p[i-1].x-path->p[i].x)*(path->p[i-1].x-path->p[i].x)+
   1.111                                     (path->p[i-1].y-path->p[i].y)*(path->p[i-1].y-path->p[i].y)));
   1.112 -        //printf("d = %f dist = %f/%f\n",d,dist,interval);
   1.113 +        /*printf("d = %f dist = %f/%f\n",d,dist,interval);*/
   1.114          while (dist + d > interval) {
   1.115              points[numPoints].x = path->p[i-1].x +
   1.116                  ((interval-dist)/d)*(path->p[i].x-path->p[i-1].x);
   1.117 @@ -346,15 +347,15 @@
   1.118          SDL_SetError("ERROR: NumPoints = %i\n",numPoints);
   1.119          return 0;
   1.120      }
   1.121 -    //copy the last point
   1.122 +    /*copy the last point*/
   1.123      points[DOLLARNPOINTS-1] = path->p[path->numPoints-1];
   1.124      numPoints = DOLLARNPOINTS;
   1.125  
   1.126      centroid.x /= numPoints;
   1.127      centroid.y /= numPoints;
   1.128  
   1.129 -    //printf("Centroid (%f,%f)",centroid.x,centroid.y);
   1.130 -    //Rotate Points so point 0 is left of centroid and solve for the bounding box
   1.131 +    /*printf("Centroid (%f,%f)",centroid.x,centroid.y);*/
   1.132 +    /*Rotate Points so point 0 is left of centroid and solve for the bounding box*/
   1.133      xmin = centroid.x;
   1.134      xmax = centroid.x;
   1.135      ymin = centroid.y;
   1.136 @@ -378,7 +379,7 @@
   1.137          if (points[i].y > ymax) ymax = points[i].y;
   1.138      }
   1.139  
   1.140 -    //Scale points to DOLLARSIZE, and translate to the origin
   1.141 +    /*Scale points to DOLLARSIZE, and translate to the origin*/
   1.142      w = xmax-xmin;
   1.143      h = ymax-ymin;
   1.144  
   1.145 @@ -399,7 +400,7 @@
   1.146  
   1.147      dollarNormalize(path,points);
   1.148  
   1.149 -    //PrintPath(points);
   1.150 +    /*PrintPath(points);*/
   1.151      *bestTempl = -1;
   1.152      for (i = 0; i < touch->numDollarTemplates; i++) {
   1.153          float diff = bestDollarDifference(points,touch->dollarTemplate[i].path);
   1.154 @@ -435,7 +436,7 @@
   1.155  {
   1.156      int i;
   1.157      for (i = 0; i < SDL_numGestureTouches; i++) {
   1.158 -        //printf("%i ?= %i\n",SDL_gestureTouch[i].id,id);
   1.159 +        /*printf("%i ?= %i\n",SDL_gestureTouch[i].id,id);*/
   1.160          if (SDL_gestureTouch[i].id == id)
   1.161              return &SDL_gestureTouch[i];
   1.162      }
   1.163 @@ -465,7 +466,7 @@
   1.164      event.mgesture.y = touch->centroid.y;
   1.165      event.dgesture.gestureId = gestureId;
   1.166      event.dgesture.error = error;
   1.167 -    //A finger came up to trigger this event.
   1.168 +    /*A finger came up to trigger this event.*/
   1.169      event.dgesture.numFingers = touch->numDownFingers + 1;
   1.170      return SDL_PushEvent(&event) > 0;
   1.171  }
   1.172 @@ -500,13 +501,13 @@
   1.173          event->type == SDL_FINGERUP) {
   1.174          SDL_GestureTouch* inTouch = SDL_GetGestureTouch(event->tfinger.touchId);
   1.175  
   1.176 -        //Shouldn't be possible
   1.177 +        /*Shouldn't be possible*/
   1.178          if (inTouch == NULL) return;
   1.179  
   1.180          x = event->tfinger.x;
   1.181          y = event->tfinger.y;
   1.182  
   1.183 -        //Finger Up
   1.184 +        /*Finger Up*/
   1.185          if (event->type == SDL_FINGERUP) {
   1.186              inTouch->numDownFingers--;
   1.187  
   1.188 @@ -514,7 +515,7 @@
   1.189              if (inTouch->recording) {
   1.190                  inTouch->recording = SDL_FALSE;
   1.191                  dollarNormalize(&inTouch->dollarPath,path);
   1.192 -                //PrintPath(path);
   1.193 +                /*PrintPath(path);*/
   1.194                  if (recordAll) {
   1.195                      index = SDL_AddDollarGesture(NULL,path);
   1.196                      for (i = 0; i < SDL_numGestureTouches; i++)
   1.197 @@ -537,14 +538,14 @@
   1.198                  error = dollarRecognize(&inTouch->dollarPath,
   1.199                                          &bestTempl,inTouch);
   1.200                  if (bestTempl >= 0){
   1.201 -                    //Send Event
   1.202 +                    /*Send Event*/
   1.203                      unsigned long gestureId = inTouch->dollarTemplate[bestTempl].hash;
   1.204                      SDL_SendGestureDollar(inTouch,gestureId,error);
   1.205 -                    //printf ("%s\n",);("Dollar error: %f\n",error);
   1.206 +                    /*printf ("%s\n",);("Dollar error: %f\n",error);*/
   1.207                  }
   1.208              }
   1.209  #endif
   1.210 -            //inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers];
   1.211 +            /*inTouch->gestureLast[j] = inTouch->gestureLast[inTouch->numDownFingers];*/
   1.212              if (inTouch->numDownFingers > 0) {
   1.213                  inTouch->centroid.x = (inTouch->centroid.x*(inTouch->numDownFingers+1)-
   1.214                                         x)/inTouch->numDownFingers;
   1.215 @@ -574,22 +575,22 @@
   1.216  
   1.217              inTouch->centroid.x += dx/inTouch->numDownFingers;
   1.218              inTouch->centroid.y += dy/inTouch->numDownFingers;
   1.219 -            //printf("Centrid : (%f,%f)\n",inTouch->centroid.x,inTouch->centroid.y);
   1.220 +            /*printf("Centrid : (%f,%f)\n",inTouch->centroid.x,inTouch->centroid.y);*/
   1.221              if (inTouch->numDownFingers > 1) {
   1.222 -                SDL_FloatPoint lv; //Vector from centroid to last x,y position
   1.223 -                SDL_FloatPoint v; //Vector from centroid to current x,y position
   1.224 -                //lv = inTouch->gestureLast[j].cv;
   1.225 +                SDL_FloatPoint lv; /*Vector from centroid to last x,y position*/
   1.226 +                SDL_FloatPoint v; /*Vector from centroid to current x,y position*/
   1.227 +                /*lv = inTouch->gestureLast[j].cv;*/
   1.228                  lv.x = lastP.x - lastCentroid.x;
   1.229                  lv.y = lastP.y - lastCentroid.y;
   1.230                  lDist = (float)SDL_sqrt(lv.x*lv.x + lv.y*lv.y);
   1.231 -                //printf("lDist = %f\n",lDist);
   1.232 +                /*printf("lDist = %f\n",lDist);*/
   1.233                  v.x = x - inTouch->centroid.x;
   1.234                  v.y = y - inTouch->centroid.y;
   1.235 -                //inTouch->gestureLast[j].cv = v;
   1.236 +                /*inTouch->gestureLast[j].cv = v;*/
   1.237                  Dist = (float)SDL_sqrt(v.x*v.x+v.y*v.y);
   1.238 -                // SDL_cos(dTheta) = (v . lv)/(|v| * |lv|)
   1.239 +                /* SDL_cos(dTheta) = (v . lv)/(|v| * |lv|)*/
   1.240  
   1.241 -                //Normalize Vectors to simplify angle calculation
   1.242 +                /*Normalize Vectors to simplify angle calculation*/
   1.243                  lv.x/=lDist;
   1.244                  lv.y/=lDist;
   1.245                  v.x/=Dist;
   1.246 @@ -597,30 +598,30 @@
   1.247                  dtheta = (float)SDL_atan2(lv.x*v.y - lv.y*v.x,lv.x*v.x + lv.y*v.y);
   1.248  
   1.249                  dDist = (Dist - lDist);
   1.250 -                if (lDist == 0) {dDist = 0;dtheta = 0;} //To avoid impossible values
   1.251 +                if (lDist == 0) {dDist = 0;dtheta = 0;} /*To avoid impossible values*/
   1.252  
   1.253 -                //inTouch->gestureLast[j].dDist = dDist;
   1.254 -                //inTouch->gestureLast[j].dtheta = dtheta;
   1.255 +                /*inTouch->gestureLast[j].dDist = dDist;
   1.256 +                inTouch->gestureLast[j].dtheta = dtheta;
   1.257  
   1.258 -                //printf("dDist = %f, dTheta = %f\n",dDist,dtheta);
   1.259 -                //gdtheta = gdtheta*.9 + dtheta*.1;
   1.260 -                //gdDist  =  gdDist*.9 +  dDist*.1
   1.261 -                //knob.r += dDist/numDownFingers;
   1.262 -                //knob.ang += dtheta;
   1.263 -                //printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist);
   1.264 -                //printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist);
   1.265 +                printf("dDist = %f, dTheta = %f\n",dDist,dtheta);
   1.266 +                gdtheta = gdtheta*.9 + dtheta*.1;
   1.267 +                gdDist  =  gdDist*.9 +  dDist*.1
   1.268 +                knob.r += dDist/numDownFingers;
   1.269 +                knob.ang += dtheta;
   1.270 +                printf("thetaSum = %f, distSum = %f\n",gdtheta,gdDist);
   1.271 +                printf("id: %i dTheta = %f, dDist = %f\n",j,dtheta,dDist);*/
   1.272                  SDL_SendGestureMulti(inTouch,dtheta,dDist);
   1.273              }
   1.274              else {
   1.275 -                //inTouch->gestureLast[j].dDist = 0;
   1.276 -                //inTouch->gestureLast[j].dtheta = 0;
   1.277 -                //inTouch->gestureLast[j].cv.x = 0;
   1.278 -                //inTouch->gestureLast[j].cv.y = 0;
   1.279 +                /*inTouch->gestureLast[j].dDist = 0;
   1.280 +                inTouch->gestureLast[j].dtheta = 0;
   1.281 +                inTouch->gestureLast[j].cv.x = 0;
   1.282 +                inTouch->gestureLast[j].cv.y = 0;*/
   1.283              }
   1.284 -            //inTouch->gestureLast[j].f.p.x = x;
   1.285 -            //inTouch->gestureLast[j].f.p.y = y;
   1.286 -            //break;
   1.287 -            //pressure?
   1.288 +            /*inTouch->gestureLast[j].f.p.x = x;
   1.289 +            inTouch->gestureLast[j].f.p.y = y;
   1.290 +            break;
   1.291 +            pressure?*/
   1.292          }
   1.293  
   1.294          if (event->type == SDL_FINGERDOWN) {
   1.295 @@ -630,8 +631,8 @@
   1.296                                     x)/inTouch->numDownFingers;
   1.297              inTouch->centroid.y = (inTouch->centroid.y*(inTouch->numDownFingers - 1)+
   1.298                                     y)/inTouch->numDownFingers;
   1.299 -            //printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
   1.300 -            //     inTouch->centroid.x,inTouch->centroid.y);
   1.301 +            /*printf("Finger Down: (%f,%f). Centroid: (%f,%f\n",x,y,
   1.302 +                 inTouch->centroid.x,inTouch->centroid.y);*/
   1.303  
   1.304  #ifdef ENABLE_DOLLAR
   1.305              inTouch->dollarPath.length = 0;
     2.1 --- a/src/joystick/SDL_joystick.c	Tue Aug 20 15:56:08 2013 -0400
     2.2 +++ b/src/joystick/SDL_joystick.c	Tue Aug 20 19:49:24 2013 -0300
     2.3 @@ -488,14 +488,14 @@
     2.4  
     2.5      if (SDL_WasInit(SDL_INIT_VIDEO)) {
     2.6          if (SDL_GetKeyboardFocus() == NULL) {
     2.7 -            // Video is initialized and we don't have focus, ignore the event.
     2.8 +            /* Video is initialized and we don't have focus, ignore the event.*/
     2.9              return SDL_TRUE;
    2.10          } else {
    2.11              return SDL_FALSE;
    2.12          }
    2.13      }
    2.14  
    2.15 -    // Video subsystem wasn't initialized, always allow the event
    2.16 +    /* Video subsystem wasn't initialized, always allow the event*/
    2.17      return SDL_FALSE;
    2.18  }
    2.19  
     3.1 --- a/src/video/SDL_video.c	Tue Aug 20 15:56:08 2013 -0400
     3.2 +++ b/src/video/SDL_video.c	Tue Aug 20 19:49:24 2013 -0300
     3.3 @@ -1761,7 +1761,7 @@
     3.4          return;
     3.5      }
     3.6  
     3.7 -    // !!! FIXME: should this check if the window is resizable?
     3.8 +    /* !!! FIXME: should this check if the window is resizable? */
     3.9  
    3.10      if (_this->MaximizeWindow) {
    3.11          _this->MaximizeWindow(_this, window);