1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 21:19:24 +00:00

Simplify function declarations.

This commit is contained in:
Bruno Haible
2002-11-08 13:47:23 +00:00
parent 0378cf3b00
commit 643c2cab82
17 changed files with 91 additions and 87 deletions

View File

@@ -1,3 +1,7 @@
2002-10-13 Bruno Haible <bruno@clisp.org>
* src/*: Simplify declarations of functions without arguments.
2002-10-04 Bruno Haible <bruno@clisp.org> 2002-10-04 Bruno Haible <bruno@clisp.org>
* src/output.h: New file, extracted from key-list.h. * src/output.h: New file, extracted from key-list.h.

View File

@@ -25,7 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "options.h" #include "options.h"
/* Frees this object. */ /* Frees this object. */
Bool_Array::~Bool_Array (void) Bool_Array::~Bool_Array ()
{ {
/* Print out debugging diagnostics. */ /* Print out debugging diagnostics. */
if (option[DEBUG]) if (option[DEBUG])

View File

@@ -39,10 +39,10 @@ public:
Bool_Array (unsigned int s); Bool_Array (unsigned int s);
/* Frees this object. */ /* Frees this object. */
~Bool_Array (void); ~Bool_Array ();
/* Resets all bits to zero. */ /* Resets all bits to zero. */
void clear (void); void clear ();
/* Sets the specified bit to one. Returns its previous value (0 or 1). */ /* Sets the specified bit to one. Returns its previous value (0 or 1). */
int set_bit (unsigned int index); int set_bit (unsigned int index);

View File

@@ -52,7 +52,7 @@ Bool_Array::set_bit (unsigned int index)
/* Resets all bits to zero. */ /* Resets all bits to zero. */
INLINE void INLINE void
Bool_Array::clear (void) Bool_Array::clear ()
{ {
/* If we wrap around it's time to zero things out again! However, this only /* If we wrap around it's time to zero things out again! However, this only
occurs once about every 2^32 iterations, so it will not happen more occurs once about every 2^32 iterations, so it will not happen more

View File

@@ -35,7 +35,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
hash table size. Note: using the random numbers is often helpful, hash table size. Note: using the random numbers is often helpful,
though not as deterministic, of course! */ though not as deterministic, of course! */
Gen_Perf::Gen_Perf (void) Gen_Perf::Gen_Perf ()
{ {
int asso_value_max; int asso_value_max;
int non_linked_length; int non_linked_length;
@@ -283,7 +283,7 @@ Gen_Perf::change (KeywordExt *prior, KeywordExt *curr)
exponential in the number of keys. */ exponential in the number of keys. */
int int
Gen_Perf::doit_all (void) Gen_Perf::doit_all ()
{ {
KeywordExt_List *curr; KeywordExt_List *curr;
for (curr = head; curr != NULL; curr = curr->rest()) for (curr = head; curr != NULL; curr = curr->rest())
@@ -341,7 +341,7 @@ Gen_Perf::doit_all (void)
/* Prints out some diagnostics upon completion. */ /* Prints out some diagnostics upon completion. */
Gen_Perf::~Gen_Perf (void) Gen_Perf::~Gen_Perf ()
{ {
if (option[DEBUG]) if (option[DEBUG])
{ {

View File

@@ -43,9 +43,9 @@ private:
static void sort_set (char *union_set, int len); static void sort_set (char *union_set, int len);
public: public:
Gen_Perf (void); Gen_Perf ();
~Gen_Perf (void); ~Gen_Perf ();
int doit_all (void); int doit_all ();
}; };
#endif #endif

View File

@@ -40,7 +40,7 @@ Hash_Table::Hash_Table (KeywordExt **table_ptr, int s, int ignore_len):
memset ((char *) table, 0, size * sizeof (*table)); memset ((char *) table, 0, size * sizeof (*table));
} }
Hash_Table::~Hash_Table (void) Hash_Table::~Hash_Table ()
{ {
if (option[DEBUG]) if (option[DEBUG])
{ {

View File

@@ -36,7 +36,7 @@ private:
public: public:
Hash_Table (KeywordExt **t, int s, int ignore_len); Hash_Table (KeywordExt **t, int s, int ignore_len);
~Hash_Table (void); ~Hash_Table ();
KeywordExt *insert (KeywordExt *item); KeywordExt *insert (KeywordExt *item);
}; };

View File

@@ -37,7 +37,7 @@ int Key_List::determined[MAX_ALPHA_SIZE];
/* Destructor dumps diagnostics during debugging. */ /* Destructor dumps diagnostics during debugging. */
Key_List::~Key_List (void) Key_List::~Key_List ()
{ {
if (option[DEBUG]) if (option[DEBUG])
{ {
@@ -111,7 +111,7 @@ Key_List::get_special_input (char delimiter)
generated code output. */ generated code output. */
const char * const char *
Key_List::save_include_src (void) Key_List::save_include_src ()
{ {
int c; int c;
@@ -132,7 +132,7 @@ Key_List::save_include_src (void)
use the default array of keys. */ use the default array of keys. */
const char * const char *
Key_List::get_array_type (void) Key_List::get_array_type ()
{ {
return get_special_input ('%'); return get_special_input ('%');
} }
@@ -167,7 +167,7 @@ Key_List::strcspn (const char *s, const char *reject)
based upon various user Options. */ based upon various user Options. */
void void
Key_List::set_output_types (void) Key_List::set_output_types ()
{ {
if (option[TYPE]) if (option[TYPE])
{ {
@@ -344,7 +344,7 @@ parse_line (const char *line, const char *delimiters)
unhashable elements possessing identical key sets and lengths. */ unhashable elements possessing identical key sets and lengths. */
void void
Key_List::read_keys (void) Key_List::read_keys ()
{ {
char *ptr; char *ptr;
@@ -568,7 +568,7 @@ Key_List::already_determined (KeywordExt *ptr)
search process. See Cichelli's paper from Jan 1980 JACM for details.... */ search process. See Cichelli's paper from Jan 1980 JACM for details.... */
void void
Key_List::reorder (void) Key_List::reorder ()
{ {
KeywordExt_List *ptr; KeywordExt_List *ptr;
for (ptr = head; ptr; ptr = ptr->rest()) for (ptr = head; ptr; ptr = ptr->rest())
@@ -611,7 +611,7 @@ Key_List::reorder (void)
/* Sorts the keys by hash value. */ /* Sorts the keys by hash value. */
void void
Key_List::sort (void) Key_List::sort ()
{ {
hash_sort = 1; hash_sort = 1;
occurrence_sort = 0; occurrence_sort = 0;
@@ -638,7 +638,7 @@ Key_List::dump ()
/* Simple-minded constructor action here... */ /* Simple-minded constructor action here... */
Key_List::Key_List (void) Key_List::Key_List ()
{ {
total_keys = 1; total_keys = 1;
max_key_len = INT_MIN; max_key_len = INT_MIN;
@@ -654,7 +654,7 @@ Key_List::Key_List (void)
/* Returns the length of entire key list. */ /* Returns the length of entire key list. */
int int
Key_List::keyword_list_length (void) Key_List::keyword_list_length ()
{ {
return list_len; return list_len;
} }
@@ -662,7 +662,7 @@ Key_List::keyword_list_length (void)
/* Returns length of longest key read. */ /* Returns length of longest key read. */
int int
Key_List::max_key_length (void) Key_List::max_key_length ()
{ {
return max_key_len; return max_key_len;
} }

View File

@@ -59,10 +59,10 @@ private:
#endif #endif
static int already_determined (KeywordExt *ptr); static int already_determined (KeywordExt *ptr);
static void set_determined (KeywordExt *ptr); static void set_determined (KeywordExt *ptr);
void set_output_types (void); void set_output_types ();
void dump (void); void dump ();
const char *get_array_type (void); const char *get_array_type ();
const char *save_include_src (void); const char *save_include_src ();
const char *get_special_input (char delimiter); const char *get_special_input (char delimiter);
KeywordExt_List *merge (KeywordExt_List *list1, KeywordExt_List *list2); KeywordExt_List *merge (KeywordExt_List *list1, KeywordExt_List *list2);
KeywordExt_List *merge_sort (KeywordExt_List *head); KeywordExt_List *merge_sort (KeywordExt_List *head);
@@ -72,13 +72,13 @@ protected:
int total_duplicates; /* Total number of duplicate hash values. */ int total_duplicates; /* Total number of duplicate hash values. */
public: public:
Key_List (void); Key_List ();
~Key_List (void); ~Key_List ();
int keyword_list_length (void); int keyword_list_length ();
int max_key_length (void); int max_key_length ();
void reorder (void); void reorder ();
void sort (void); void sort ();
void read_keys (void); void read_keys ();
}; };
#endif #endif

View File

@@ -218,7 +218,7 @@ Options::long_usage (FILE * strm)
/* Output command-line Options. */ /* Output command-line Options. */
void void
Options::print_options (void) Options::print_options ()
{ {
int i; int i;
@@ -363,7 +363,7 @@ Options::key_sort (char *base, int len)
/* Sets the default Options. */ /* Sets the default Options. */
Options::Options (void) Options::Options ()
{ {
key_positions[0] = WORD_START; key_positions[0] = WORD_START;
key_positions[1] = WORD_END; key_positions[1] = WORD_END;
@@ -384,7 +384,7 @@ Options::Options (void)
/* Dumps option status when debug is set. */ /* Dumps option status when debug is set. */
Options::~Options (void) Options::~Options ()
{ {
if (option_word & DEBUG) if (option_word & DEBUG)
{ {

View File

@@ -79,30 +79,30 @@ enum
class Options class Options
{ {
public: public:
Options (void); Options ();
~Options (void); ~Options ();
int operator[] (Option_Type option); int operator[] (Option_Type option);
void operator() (int argc, char *argv[]); void operator() (int argc, char *argv[]);
void operator= (enum Option_Type); void operator= (enum Option_Type);
void operator!= (enum Option_Type); void operator!= (enum Option_Type);
static void print_options (void); static void print_options ();
static void set_asso_max (int r); static void set_asso_max (int r);
static int get_asso_max (void); static int get_asso_max ();
static void reset (void); static void reset ();
static int get (void); static int get ();
static int get_iterations (void); static int get_iterations ();
static int get_max_keysig_size (void); static int get_max_keysig_size ();
static void set_keysig_size (int); static void set_keysig_size (int);
static int get_jump (void); static int get_jump ();
static int initial_value (void); static int initial_value ();
static int get_total_switches (void); static int get_total_switches ();
static const char *get_function_name (void); static const char *get_function_name ();
static const char *get_key_name (void); static const char *get_key_name ();
static const char *get_initializer_suffix (void); static const char *get_initializer_suffix ();
static const char *get_class_name (void); static const char *get_class_name ();
static const char *get_hash_name (void); static const char *get_hash_name ();
static const char *get_wordlist_name (void); static const char *get_wordlist_name ();
static const char *get_delimiter (void); static const char *get_delimiter ();
private: private:
static int option_word; /* Holds the user-specified Options. */ static int option_word; /* Holds the user-specified Options. */

View File

@@ -42,14 +42,14 @@ Options::operator != (enum Option_Type opt)
/* Initializes the key Iterator. */ /* Initializes the key Iterator. */
INLINE void INLINE void
Options::reset (void) Options::reset ()
{ {
key_pos = 0; key_pos = 0;
} }
/* Returns current key_position and advance index. */ /* Returns current key_position and advance index. */
INLINE int INLINE int
Options::get (void) Options::get ()
{ {
return key_positions[key_pos++]; return key_positions[key_pos++];
} }
@@ -63,14 +63,14 @@ Options::set_asso_max (int r)
/* Returns the size of the table size. */ /* Returns the size of the table size. */
INLINE int INLINE int
Options::get_asso_max (void) Options::get_asso_max ()
{ {
return size; return size;
} }
/* Returns total distinct key positions. */ /* Returns total distinct key positions. */
INLINE int INLINE int
Options::get_max_keysig_size (void) Options::get_max_keysig_size ()
{ {
return total_keysig_size; return total_keysig_size;
} }
@@ -84,63 +84,63 @@ Options::set_keysig_size (int size)
/* Returns the jump value. */ /* Returns the jump value. */
INLINE int INLINE int
Options::get_jump (void) Options::get_jump ()
{ {
return jump; return jump;
} }
/* Returns the generated function name. */ /* Returns the generated function name. */
INLINE const char * INLINE const char *
Options::get_function_name (void) Options::get_function_name ()
{ {
return function_name; return function_name;
} }
/* Returns the keyword key name. */ /* Returns the keyword key name. */
INLINE const char * INLINE const char *
Options::get_key_name (void) Options::get_key_name ()
{ {
return key_name; return key_name;
} }
/* Returns the struct initializer suffix. */ /* Returns the struct initializer suffix. */
INLINE const char * INLINE const char *
Options::get_initializer_suffix (void) Options::get_initializer_suffix ()
{ {
return initializer_suffix; return initializer_suffix;
} }
/* Returns the hash function name. */ /* Returns the hash function name. */
INLINE const char * INLINE const char *
Options::get_hash_name (void) Options::get_hash_name ()
{ {
return hash_name; return hash_name;
} }
/* Returns the hash table array name. */ /* Returns the hash table array name. */
INLINE const char * INLINE const char *
Options::get_wordlist_name (void) Options::get_wordlist_name ()
{ {
return wordlist_name; return wordlist_name;
} }
/* Returns the generated class name. */ /* Returns the generated class name. */
INLINE const char * INLINE const char *
Options::get_class_name (void) Options::get_class_name ()
{ {
return class_name; return class_name;
} }
/* Returns the initial associated character value. */ /* Returns the initial associated character value. */
INLINE int INLINE int
Options::initial_value (void) Options::initial_value ()
{ {
return initial_asso_value; return initial_asso_value;
} }
/* Returns the iterations value. */ /* Returns the iterations value. */
INLINE int INLINE int
Options::get_iterations (void) Options::get_iterations ()
{ {
return iterations; return iterations;
} }

View File

@@ -85,7 +85,7 @@ Output::Output (KeywordExt_List *head_, const char *array_type_,
find the final item! */ find the final item! */
void void
Output::compute_min_max (void) Output::compute_min_max ()
{ {
KeywordExt_List *temp; KeywordExt_List *temp;
for (temp = head; temp->rest(); temp = temp->rest()) for (temp = head; temp->rest(); temp = temp->rest())
@@ -100,7 +100,7 @@ Output::compute_min_max (void)
/* Returns the number of different hash values. */ /* Returns the number of different hash values. */
int int
Output::num_hash_values (void) Output::num_hash_values ()
{ {
int count = 1; int count = 1;
KeywordExt_List *temp; KeywordExt_List *temp;
@@ -400,7 +400,7 @@ void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1,
proper encoding for each key word. */ proper encoding for each key word. */
void void
Output::output_hash_function (void) Output::output_hash_function ()
{ {
const int max_column = 10; const int max_column = 10;
int field_width; int field_width;
@@ -568,7 +568,7 @@ Output::output_hash_function (void)
comparison code in generated function ``in_word_set''. */ comparison code in generated function ``in_word_set''. */
void void
Output::output_keylength_table (void) Output::output_keylength_table ()
{ {
const int columns = 14; const int columns = 14;
int index; int index;
@@ -688,7 +688,7 @@ output_keyword_blank_entries (int count, const char *indent)
/* Prints out the array containing the key words for the hash function. */ /* Prints out the array containing the key words for the hash function. */
void void
Output::output_keyword_table (void) Output::output_keyword_table ()
{ {
const char *indent = option[GLOBAL] ? "" : " "; const char *indent = option[GLOBAL] ? "" : " ";
int index; int index;
@@ -749,7 +749,7 @@ Output::output_keyword_table (void)
the smaller, contiguous range of the keyword table. */ the smaller, contiguous range of the keyword table. */
void void
Output::output_lookup_array (void) Output::output_lookup_array ()
{ {
if (option[DUP]) if (option[DUP])
{ {
@@ -912,7 +912,7 @@ Output::output_lookup_array (void)
/* Generate all the tables needed for the lookup function. */ /* Generate all the tables needed for the lookup function. */
void void
Output::output_lookup_tables (void) Output::output_lookup_tables ()
{ {
if (option[SWITCH]) if (option[SWITCH])
{ {
@@ -1341,7 +1341,7 @@ Output::output_lookup_function_body (const Output_Compare& comparison)
/* Generates C code for the lookup function. */ /* Generates C code for the lookup function. */
void void
Output::output_lookup_function (void) Output::output_lookup_function ()
{ {
/* Output the function's head. */ /* Output the function's head. */
if (option[KRC] | option[C] | option[ANSIC]) if (option[KRC] | option[C] | option[ANSIC])
@@ -1397,7 +1397,7 @@ Output::output_lookup_function (void)
based upon the user's Options. */ based upon the user's Options. */
void void
Output::output (void) Output::output ()
{ {
compute_min_max (); compute_min_max ();

View File

@@ -35,18 +35,18 @@ class Output
{ {
public: 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); 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); void output ();
private: private:
void compute_min_max (void); void compute_min_max ();
int num_hash_values (void); int num_hash_values ();
void output_constants (struct Output_Constants&); void output_constants (struct Output_Constants&);
void output_hash_function (void); void output_hash_function ();
void output_keylength_table (void); void output_keylength_table ();
void output_keyword_table (void); void output_keyword_table ();
void output_lookup_array (void); void output_lookup_array ();
void output_lookup_tables (void); void output_lookup_tables ();
void output_lookup_function_body (const struct Output_Compare&); void output_lookup_function_body (const struct Output_Compare&);
void output_lookup_function (void); void output_lookup_function ();
/* Linked list of keywords. */ /* Linked list of keywords. */
KeywordExt_List *head; KeywordExt_List *head;

View File

@@ -41,7 +41,7 @@ public:
and ignoring lines starting with '#'. Returns NULL on error or EOF. and ignoring lines starting with '#'. Returns NULL on error or EOF.
The storage for the string is dynamically allocated and must be freed The storage for the string is dynamically allocated and must be freed
through delete[]. */ through delete[]. */
char *read_next_line (void); char *read_next_line ();
private: private:
FILE *fp; /* FILE pointer to the input stream. */ FILE *fp; /* FILE pointer to the input stream. */

View File

@@ -28,7 +28,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
The storage for the string is dynamically allocated and must be freed The storage for the string is dynamically allocated and must be freed
through delete[]. */ through delete[]. */
INLINE char * INLINE char *
Read_Line::read_next_line (void) Read_Line::read_next_line ()
{ {
int c; int c;