1 /* This may look like C code, but it is really -*- C++ -*- */
5 Copyright (C) 2002 Free Software Foundation, Inc.
6 Written by Bruno Haible <bruno@clisp.org>.
8 This file is part of GNU GPERF.
10 GNU GPERF is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2, or (at your option)
15 GNU GPERF is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
20 You should have received a copy of the GNU General Public License
21 along with this program; see the file COPYING.
22 If not, write to the Free Software Foundation, Inc.,
23 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
25 #ifndef keyword_list_h
26 #define keyword_list_h 1
30 /* List node of a linear list of Keyword. */
35 Keyword_List (Keyword *car);
37 /* Access to first element of list. */
38 Keyword * first () const;
39 /* Access to next element of list. */
40 Keyword_List *& rest ();
47 /* List node of a linear list of KeywordExt. */
48 class KeywordExt_List : public Keyword_List
52 KeywordExt_List (KeywordExt *car);
54 /* Access to first element of list. */
55 KeywordExt * first () const;
56 /* Access to next element of list. */
57 KeywordExt_List *& rest ();
60 /* Copies a linear list, sharing the list elements. */
61 extern Keyword_List * copy_list (Keyword_List *list);
62 extern KeywordExt_List * copy_list (KeywordExt_List *list);
64 /* Deletes a linear list, keeping the list elements in memory. */
65 extern void delete_list (Keyword_List *list);
67 /* Sorts a linear list, given a comparison function.
68 Note: This uses a variant of mergesort that is *not* a stable sorting
70 extern Keyword_List * mergesort_list (Keyword_List *list,
71 bool (*less) (Keyword *keyword1,
73 extern KeywordExt_List * mergesort_list (KeywordExt_List *list,
74 bool (*less) (KeywordExt *keyword1,
75 KeywordExt *keyword2));
80 #include "keyword-list.icc"