Next: Function: remove_spectral_lines()
Up: GRASP Routines: General purpose
Previous: Function: fvalue_cmp()
  Contents
0
int index_cmp(const void *f1, const void *f2)
This is a function which may be used to compare the indexes of two
different objects of type struct removed_lines. It is used for
example as an argument to the standard-C library routine qsort
for sorting lists of removed lines into increasing order in frequency.
This function is supplied with pointers to two stuctures. It returns
-1 if the first structure has the smaller index,
+1 if the first structure has the larger index, and 0 if the
indexes are equal.
The arguments are:
- f1: Input. Pointer to the first structure of type struct removed_lines (cast to void * so that your compiler does not complain).
- f2: Input. Pointer to the second structure of type struct removed_lines (cast to void * so that your compiler does not complain).
As an example, if line_list[0..n-1] is an array of struct removed_lines, then
the function call:
qsort(line_list,n,sizeof(struct significant_values),index_cmp)
will sort that array into increasing index (frequency!) order.
(Note: you may have to cast the arguments to prevent your compiler
from complaining.)
- Author:
Bruce Allen (ballen@dirac.phys.uwm.edu) and Adrian Ottewill
(ottewill@relativity.ucd.ie).
- Comments:
None.
Next: Function: remove_spectral_lines()
Up: GRASP Routines: General purpose
Previous: Function: fvalue_cmp()
  Contents
Bruce Allen
2000-11-19