/[pspp]/pspp/src/get.c
ViewVC logotype

Diff of /pspp/src/get.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.33 by blp, Mon Jul 4 05:48:04 2005 UTC revision 1.34 by blp, Thu Jul 7 03:46:04 2005 UTC
# Line 1222  mtf_processing (struct ccase *c, void *m Line 1222  mtf_processing (struct ccase *c, void *m
1222        min_head = min_tail = mtf->head;        min_head = min_tail = mtf->head;
1223        max_head = max_tail = NULL;        max_head = max_tail = NULL;
1224        for (iter = mtf->head->next; iter && iter->type == MTF_FILE;        for (iter = mtf->head->next; iter && iter->type == MTF_FILE;
1225             iter = iter->next)             iter = iter->next)
1226          switch (mtf_compare_BY_values (mtf, min_head, iter, c))          {
1227            {            int cmp = mtf_compare_BY_values (mtf, min_head, iter, c);
1228            case -1:            if (cmp < 0)
1229              if (max_head)              {
1230                max_tail = max_tail->next_min = iter;                if (max_head)
1231              else                  max_tail = max_tail->next_min = iter;
1232                max_head = max_tail = iter;                else
1233              break;                  max_head = max_tail = iter;
1234                }
1235            case 0:            else if (cmp == 0)
1236              min_tail = min_tail->next_min = iter;              min_tail = min_tail->next_min = iter;
1237              break;            else /* cmp > 0 */
1238                {
1239            case 1:                if (max_head)
1240              if (max_head)                  {
1241                {                    max_tail->next_min = min_head;
1242                  max_tail->next_min = min_head;                    max_tail = min_tail;
1243                  max_tail = min_tail;                  }
1244                }                else
1245              else                  {
1246                {                    max_head = min_head;
1247                  max_head = min_head;                    max_tail = min_tail;
1248                  max_tail = min_tail;                  }
1249                }                min_head = min_tail = iter;
1250              min_head = min_tail = iter;              }
1251              break;          }
1252          
           default:  
             assert (0);  
           }  
   
1253        /* 4. For every TABLE, read another record as long as the BY        /* 4. For every TABLE, read another record as long as the BY
1254           values on the TABLE's input record are less than the FILEs'           values on the TABLE's input record are less than the FILEs'
1255           BY values.  If an exact match is found, store all the values           BY values.  If an exact match is found, store all the values
# Line 1263  mtf_processing (struct ccase *c, void *m Line 1259  mtf_processing (struct ccase *c, void *m
1259            assert (iter->type == MTF_TABLE);            assert (iter->type == MTF_TABLE);
1260                
1261            next = iter->next;            next = iter->next;
1262              for (;;)
1263          again:              {
1264            switch (mtf_compare_BY_values (mtf, min_head, iter, c))                int cmp = mtf_compare_BY_values (mtf, min_head, iter, c);
1265              {                if (cmp < 0)
1266              case -1:                  {
1267                if (max_head)                    if (max_head)
1268                  max_tail = max_tail->next_min = iter;                      max_tail = max_tail->next_min = iter;
1269                else                    else
1270                  max_head = max_tail = iter;                      max_head = max_tail = iter;
1271                break;                  }
1272                  else if (cmp == 0)
1273              case 0:                  min_tail = min_tail->next_min = iter;
1274                min_tail = min_tail->next_min = iter;                else /* cmp > 0 */
1275                break;                  {
1276                      if (iter->handle == NULL)
1277              case 1:                      return 1;
1278                if (iter->handle == NULL)                    if (sfm_read_case (iter->reader, &iter->input))
1279                  return 1;                      continue;
1280                if (sfm_read_case (iter->reader, &iter->input))                    mtf_delete_file_in_place (mtf, &iter);
1281                  goto again;                  }
1282                mtf_delete_file_in_place (mtf, &iter);                break;
1283                break;              }
   
             default:  
               assert (0);  
             }  
1284          }          }
1285    
1286        /* Next sequence number. */        /* Next sequence number. */

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.34

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26