DragonFly On-Line Manual Pages
EZ_SSheetSortRegion(3) EZWGL Functions EZ_SSheetSortRegion(3)
NAME
EZ_SSheetSortRegion - sort the specified spread sheet region
SYNOPSIS
#include <EZ.h>
void EZ_SSheetSortRegion( EZ_Widget *ssheet, int r1, int c1, int r2, int c2
int col, int (*cmp)(CONSTvoid*,CONSTvoid*))
void EZ_SSheetSortRegionR( EZ_Widget *ssheet, int r1, int c1, int r2, int c2
int row, int (*cmp)(CONSTvoid*,CONSTvoid*))
void EZ_SSheetSortColumns( EZ_Widget *ssheet, int r1, int c1, int r2, int c2
int (*cmp)(CONSTvoid*,CONSTvoid*))
void EZ_SSheetSortRows( EZ_Widget *ssheet, int r1, int c1, int r2, int c2
int (*cmp)(CONSTvoid*,CONSTvoid*))
ARGUMENTS
ssheet Specifies a spread sheet widget.
r1,c1,r2,c2 Specify the upper left and lower right corner of a
rectangular region.
col Specifies a key column.
row Specifies a key row.
cmp Specify a comparision function.
DESCRIPTION
EZ_SSheetSortRegion uses qsort to sort the specified region using the
cells in the key column. cmp is used to compare two strings. See the
manual page of qsort for details. If cmp is NULL, this function will
use an internal comparision function to sort the contents of the region
in lexical order. The internal comparision is listed below.
EZ_SSheetSortRegionR sort the specified region using the cells in the
key row.
EZ_SSheetSortColumns sort each column individually in the specified
region.
EZ_SSheetSortColumns sort each row individually in the specified
region.
The internal comparision function.
int EZ_CompareStr(CONST void *vaptr, CONST void *vbptr)
{
char **aptr = (char **)vaptr;
char **bptr = (char **)vbptr;
char *a = *aptr, *b = *bptr;
if(a == NULL) return(1);
else if( b == NULL) return(-1);
while(*a && *b && *a == *b) {a++; b++;}
if(*a == 0) return(-1);
else if(*b == 0) return(1);
return( (*a > *b)? 1: -1);
}
SEE ALSO
EZ_SSheetFindCell(3), EZ_SSheetSetTabChar(3)
EZWGL EZ_SSheetSortRegion(3)