.\" $Id: reverse.3,v 1.1 2002/03/08 13:51:04 fred Exp $ .\" @(#)reverse.2 2.11 91/08/22 ; Labo masi cao-vlsi; Author : Frederic Petrot .if t \{\ .XS \n% .ti 0.2i reverse .XE .XS4 \n% .ti 0.2i reverse .XE4 \} .TH REVERSE 3 "October 1, 1997" "ASIM/LIP6" "MBK UTILITY FUNCTIONS" .SH NAME reverse \- reverse a list of \fBchain\fPed elements .so buster/alliance/alc_origin.1.en.gz .SH SYNOPSYS .nf .if n \{\ .ft B \} .if t \{\ .ft CR \} #include "mut.h" chain_list \(**reverse(ptold) chain_list \(**ptold; .ft R .fi .SH PARAMETER .TP 20 \fIptold\fP Pointer to a \fBchain_list\fP to be reversed .SH DESCRIPTION The \fBreverse\fP function allows to reverse the order of the elements of a \fIchain_list\fP. It means that the last element becomes the first one, the one before the last one the second one, and so on. .TP remark : all mbk structures have for first field the \fINEXT\fP field, so, with appropriate cast, one can reverse any mbk list. Let's notice that nothing in the C language description demands a structure to be defined in memory the same way its members are defined in C. But all compiler do it this way now a day. Let's hope it will continue! .SH RETURN VALUE \fBreverse\fP returns a pointer to the head of the reversed list. .SH EXAMPLE .ta 3n 6n 9n 12n 15n 18n 21n .nf .if n \{\ .ft B \} .if t \{\ .ft CR \} #include "mut.h" void reverse_con(p) lofig_list \(**p; { p\->LOCON = (locon_list \(**)reverse((chain_list \(**)p\->LOCON); } .ft R .fi .SH SEE ALSO .BR mbk (1), .BR chain (3). .so buster/alliance/alc_bug_report.1.en.gz