1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
.\" placed in the public domain by Will Naylor -*- nroff -*-
.\" 1998-08-21 formatting added by Jim Van Zandt <jrv@vanzandt.mv.com>
.TH WNCMP 3 "August 23, 1998" "WNLIB" ""
.SH NAME
wn_intcmp, wn_ptrcmp, cmp, wn_boolcmp, wn_doublecmp, wn_pdoublecmp, wn_numstrcmp \- comparison functions for sorting and sorted trees.
.SH SYNOPSIS
.nf
.B #include <wn/wncmp.h>
.sp
.B int wn_intcmp(int \fIi1\fP,int \fIi2\fP)
.sp
.B int wn_ptrcmp(ptr \fIp1\fP,ptr \fIp2\fP)
.sp
.B int wn_ptrNULLcmp(bool *\fIsuccess\fP,ptr \fIp1\fP,ptr \fIp2\fP)
.sp
.B int wn_boolcmp(bool \fIb1\fP,bool \fIb2\fP)
.sp
.B int wn_doublecmp(double \fId1\fP,double \fId2\fP)
.sp
.B int wn_pdoublecmp(double *\fIpd1\fP,double *\fIpd2\fP)
.sp
.B int wn_numstrcmp(char \fIs1\fP[],\fIs2\fP[])
.sp
.SH DESCRIPTION
These routines are designed to assist in sorting (see wn_sort_sll(3)) and in
building sorted trees (see wn_mkbtree(3)). They return an int
>, ==, or < than zero, according to whether arg 1 is >, ==, or <
than arg 2.
\fBwn_numstrcmp\fP compares strings \fBs1\fP that \fIs2\fP so that the intuitively
correct notion of numerical order is respected. Thus, the
string "var9" is < "var10", according to \fBwn_numstrcmp\fP.
Similarly, "var99" < "var100", "x99y" < "x200y", etc.
\fBwn_ptrNULLcmp\fP sets \fIsuccess\fP to \fBTRUE\fP iff \fIp1\fP or \fIp2\fP is \fBNULL\fP.
If \fIp1\fP and \fIp2\fP are \fBNULL\fP, it returns 0. If \fIp1\fP is \fBNULL\fP but
\fIp2\fP is not \fBNULL\fP, it returns a number < 0. If \fIp1\fP is not \fBNULL\fP but
\fIp2\fP is \fBNULL\fP, it returns a number > 0. This function is useful for
constructing complicated linked structure compares where it is possible
for some pointers to be \fBNULL\fP.
.\".SH DIAGNOSTICS
.\".SH BUGS
.SH "SEE ALSO"
wnsort "(3), " wnbtr "(3), " wnbtrl "(3), " wnhtbl "(3), " wncpy (3)
.SH AUTHOR
Will Naylor
|