1 /* Data and function member declarations for the keyword list class.
2 
3    Copyright (C) 1989 Free Software Foundation, Inc.
4    written by Douglas C. Schmidt (schmidt@ics.uci.edu)
5 
6 This file is part of GNU GPERF.
7 
8 GNU GPERF is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 1, or (at your option)
11 any later version.
12 
13 GNU GPERF is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 GNU General Public License for more details.
17 
18 You should have received a copy of the GNU General Public License
19 along with GNU GPERF; see the file COPYING.  If not, write to
20 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
21 
22 /* The key word list is a useful abstraction that keeps track of
23    various pieces of information that enable that fast generation
24    of the Perfect.hash function.  A Key_List is a singly-linked
25    list of List_Nodes. */
26 
27 #ifndef _keylist_h
28 #define _keylist_h
29 #include <stdio.h>
30 #include "listnode.h"
31 
32 typedef struct key_list
33 {
34   LIST_NODE *head;                  /* Points to the head of the linked list. */
35   char      *array_type;            /* Pointer to the type for word list. */
36   char      *return_type;           /* Pointer to return type for lookup function. */
37   char      *struct_tag;            /* Shorthand for user-defined struct tag type. */
38   char      *include_src;           /* C source code to be included verbatim. */
39   int        list_len;              /* Length of head's Key_List, not counting duplicates. */
40   int        total_keys;            /* Total number of keys, counting duplicates. */
41   int        max_key_len;           /* Maximum length of the longest keyword. */
42   int        min_key_len;           /* Minimum length of the shortest keyword. */
43   bool       occurrence_sort;       /* True if sorting by occurrence. */
44   bool       hash_sort;             /* True if sorting by hash value. */
45   bool       additional_code;       /* True if any additional C code is included. */
46 } KEY_LIST;
47 
48 extern void       key_list_init P ((void));
49 extern void       key_list_destroy P ((void));
50 extern void       print_output P ((void));
51 extern int        keyword_list_length P ((void));
52 extern int        max_key_length P ((void));
53 extern KEY_LIST   key_list;
54 #endif /* _keylist_h */
55