xref: /csrg-svn/usr.bin/f77/libU77/qsort_.c (revision 47944)
1*47944Sbostic /*-
2*47944Sbostic  * Copyright (c) 1980 The Regents of the University of California.
3*47944Sbostic  * All rights reserved.
42521Sdlw  *
5*47944Sbostic  * %sccs.include.proprietary.c%
623044Skre  */
723044Skre 
8*47944Sbostic #ifndef lint
9*47944Sbostic static char sccsid[] = "@(#)qsort_.c	5.2 (Berkeley) 04/12/91";
10*47944Sbostic #endif /* not lint */
11*47944Sbostic 
1223044Skre /*
132521Sdlw  * quick sort interface
142521Sdlw  *
152521Sdlw  * calling sequence:
162521Sdlw  *	external compar
172521Sdlw  *	call qsort (array, len, isize, compar)
182521Sdlw  *	----
192521Sdlw  *	integer*2 function compar (obj1, obj2)
202521Sdlw  * where:
212521Sdlw  *	array contains the elements to be sorted
222521Sdlw  *	len is the number of elements in the array
232521Sdlw  *	isize is the size of an element, typically -
242521Sdlw  *		4 for integer, float
252521Sdlw  *		8 for double precision
262521Sdlw  *		(length of character object) for character arrays
272521Sdlw  *	compar is the name of an integer*2 function that will return -
282521Sdlw  *		<0 if object 1 is logically less than object 2
292521Sdlw  *		=0 if object 1 is logically equal to object 2
302521Sdlw  *		>0 if object 1 is logically greater than object 2
312521Sdlw  */
322521Sdlw 
qsort_(array,len,isize,compar)332521Sdlw qsort_(array, len, isize, compar)
342521Sdlw long *len, *isize;
352521Sdlw long *array;
362521Sdlw int (*compar)(); /* may be problematical */
372521Sdlw {
382521Sdlw 	qsort(array, (int)*len, (int)*isize, compar);
392521Sdlw }
40