Revision: 64344
          http://sourceforge.net/p/brlcad/code/64344
Author:   carlmoore
Date:     2015-03-06 21:05:44 +0000 (Fri, 06 Mar 2015)
Log Message:
-----------
implement NUMERIC sorting for columns 1,2,3; those columns are stored as 
CHARACTERS

Modified Paths:
--------------
    brlcad/trunk/src/libged/lc.c

Modified: brlcad/trunk/src/libged/lc.c
===================================================================
--- brlcad/trunk/src/libged/lc.c        2015-03-06 20:44:09 UTC (rev 64343)
+++ brlcad/trunk/src/libged/lc.c        2015-03-06 21:05:44 UTC (rev 64344)
@@ -76,14 +76,33 @@
     struct region_record *r1 = (struct region_record *)a;
     struct region_record *r2 = (struct region_record *)b;
     int *sort_type = (int *)arg;
+    int temp1,temp2;
 
     switch (*sort_type) {
        case 1:
-           return bu_strcmp(r1->region_id, r2->region_id);
+           temp1=atoi(r1->region_id);
+           temp2=atoi(r2->region_id);
+           if ( temp1 > temp2 )
+               return 1;
+           if ( temp1 == temp2 )
+               return 0;
+           return -1;
        case 2:
-           return bu_strcmp(r1->material_id, r2->material_id);
+           temp1=atoi(r1->material_id);
+           temp2=atoi(r2->material_id);
+           if ( temp1 > temp2 )
+               return 1;
+           if ( temp1 == temp2 )
+               return 0;
+           return -1;
        case 3:
-           return bu_strcmp(r1->los, r2->los);
+           temp1=atoi(r1->los);
+           temp2=atoi(r2->los);
+           if ( temp1 > temp2 )
+               return 1;
+           if ( temp1 == temp2 )
+               return 0;
+           return -1;
        case 4:
            return bu_strcmp(r1->obj_name, r2->obj_name);
        case 5:

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits

Reply via email to