Revert "Use a variable on the stack to not have a temporary in the call"
[ACE_TAO.git] / ACE / apps / gperf / src / Gen_Perf.h
blobc0ab64559282648fa5a76593f42f9f21bec5e18e
1 // -*- C++ -*-
3 /**
4 * Copyright (C) 1989 Free Software Foundation, Inc.
5 * written by Douglas C. Schmidt (d.schmidt@vanderbilt.edu)
7 * This file is part of GNU GPERF.
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #ifndef GEN_PERF_H
25 #define GEN_PERF_H
27 #include "Options.h"
28 #include "Key_List.h"
29 #include "Bool_Array.h"
30 #include "ace/Copy_Disabled.h"
33 * Provides high-level routines to manipulate the keyword list
34 * structures the code generation output.
36 class Gen_Perf : private ACE_Copy_Disabled
38 public:
39 /// Constructor.
40 Gen_Perf ();
42 /// Destructor
43 ~Gen_Perf ();
45 /// Attempt to generate a perfect hash function.
46 int run ();
48 private:
49 int open ();
50 int change (List_Node *prior, List_Node *curr);
51 int affects_prev (char c, List_Node *curr);
52 int compute_perfect_hash ();
53 int compute_binary_search ();
54 int compute_linear_search ();
55 static int hash (List_Node *key_node);
56 static int compute_disjoint_union (char *s1, char *s2, char *s3);
57 static void sort_set (char *union_set, int len);
59 /// Maximum possible hash value.
60 int max_hash_value;
62 /// Records fewest # of collisions for asso value.
63 int fewest_collisions;
65 /// Number of keywords processed without a collision.
66 int num_done;
68 /// Disjoint union.
69 char *union_set;
71 /// List of the keys we're trying to map into a perfect hash
72 /// function.
73 Key_List key_list;
75 /// Table that keeps track of key collisions.
76 Bool_Array char_search;
79 #endif /* GEN_PERF_H */