diff options
author | Bruno Haible <bruno@clisp.org> | 2002-11-07 12:05:44 +0000 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2002-11-07 12:05:44 +0000 |
commit | 0378cf3b0067f156501dcfcc98f94f67a2b092bd (patch) | |
tree | 441cf0ad253ca0c64113112bc00f978671d76f32 /src/output.h | |
parent | 4c0ed264beea9ce2a85fc59a96de2c5dc4598829 (diff) | |
download | gperf-0378cf3b0067f156501dcfcc98f94f67a2b092bd.tar.gz |
Move the output routines to output.h and output.cc.
Diffstat (limited to 'src/output.h')
-rw-r--r-- | src/output.h | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/src/output.h b/src/output.h new file mode 100644 index 0000000..ce98a8d --- /dev/null +++ b/src/output.h @@ -0,0 +1,79 @@ +/* This may look like C code, but it is really -*- C++ -*- */ + +/* Output routines. + + Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc. + Written by Bruno Haible <bruno@clisp.org>. + +This file is part of GNU GPERF. + +GNU GPERF is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 1, or (at your option) +any later version. + +GNU GPERF is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU GPERF; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ + +#ifndef output_h +#define output_h 1 + +#include "keyword-list.h" +#include "vectors.h" + +/* OSF/1 cxx needs these forward declarations. */ +struct Output_Constants; +struct Output_Compare; + +class Output +{ +public: + Output (KeywordExt_List *head, const char *array_type, const char *return_type, const char *struct_tag, int additional_code, const char *include_src, int total_keys, int total_duplicates, int max_key_len, int min_key_len, Vectors *v); + void output (void); +private: + void compute_min_max (void); + int num_hash_values (void); + void output_constants (struct Output_Constants&); + void output_hash_function (void); + void output_keylength_table (void); + void output_keyword_table (void); + void output_lookup_array (void); + void output_lookup_tables (void); + void output_lookup_function_body (const struct Output_Compare&); + void output_lookup_function (void); + + /* Linked list of keywords. */ + KeywordExt_List *head; + + /* Pointer to the type for word list. */ + const char *array_type; + /* Pointer to return type for lookup function. */ + const char *return_type; + /* Shorthand for user-defined struct tag type. */ + const char *struct_tag; + /* True if any additional C code is included. */ + int additional_code; + /* C source code to be included verbatim. */ + const char *include_src; + /* Total number of keys, counting duplicates. */ + int total_keys; + /* Total number of duplicate hash values. */ + int total_duplicates; + /* Maximum length of the longest keyword. */ + int max_key_len; + /* Minimum length of the shortest keyword. */ + int min_key_len; + /* Minimum hash value for all keywords. */ + int min_hash_value; + /* Maximum hash value for all keywords. */ + int max_hash_value; + Vectors * v; +}; + +#endif |