4 * $TOG: Sort.hh /main/6 1998/09/02 18:26:17 mgreess $
6 * RESTRICTED CONFIDENTIAL INFORMATION:
8 * The information in this document is subject to special
9 * restrictions in a confidential disclosure agreement between
10 * HP, IBM, Sun, USL, SCO and Univel. Do not distribute this
11 * document outside HP, IBM, Sun, USL, SCO, or Univel without
12 * Sun's specific written approval. This document and all copies
13 * and derivative works thereof must be returned or destroyed at
16 * Copyright 1993 Sun Microsystems, Inc. All rights reserved.
24 #include <DtMail/DtMail.hh>
25 #include "FindDialog.h"
26 #include "MsgScrollingList.hh"
29 // What method to use to sort the message list.
41 // Used for sorting the mailbox.
49 // Sorts the array of message handles.
51 int sortMessages(MsgScrollingList *display_list,
52 DtMail::MailBox *mbox,
58 // This is the message record that is sorted (not returned). It
59 // is for internal use only and is never passed up to the calling
60 // public member functions.
62 // The variable 'link' is used to sort the array in place. After
63 // msort() (below) is called, the 'link' variable is set to the
64 // link-order (1,2,...,N). Un-like qsort(), msort() sorts in place
65 // and does not do memcpy(), msort() - updates the 'link' variable.
68 struct messageRecord {
69 int link; // Needed by msort(). (see source).
70 char *primary_key_str;
72 int secondary_key_int;
73 MsgStruct *msg_struct;
77 // Similar to qsort().
79 int _msort(char * base, // Base of array.
80 int nel, // Number of elements in array.
81 int width, // Size of each element.
82 int offset, // Offset to'link'(see source).
85 int (*compar)(char ** one, char ** two));
88 // This is the function that msort() calls to compare two records.
90 static int _sortCmp(char **one, char **two);