mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 13:09:22 +00:00
Simplify function declarations.
This commit is contained in:
@@ -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>
|
||||
|
||||
* src/output.h: New file, extracted from key-list.h.
|
||||
|
||||
@@ -25,7 +25,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||
#include "options.h"
|
||||
|
||||
/* Frees this object. */
|
||||
Bool_Array::~Bool_Array (void)
|
||||
Bool_Array::~Bool_Array ()
|
||||
{
|
||||
/* Print out debugging diagnostics. */
|
||||
if (option[DEBUG])
|
||||
|
||||
@@ -39,10 +39,10 @@ public:
|
||||
Bool_Array (unsigned int s);
|
||||
|
||||
/* Frees this object. */
|
||||
~Bool_Array (void);
|
||||
~Bool_Array ();
|
||||
|
||||
/* Resets all bits to zero. */
|
||||
void clear (void);
|
||||
void clear ();
|
||||
|
||||
/* Sets the specified bit to one. Returns its previous value (0 or 1). */
|
||||
int set_bit (unsigned int index);
|
||||
|
||||
@@ -52,7 +52,7 @@ Bool_Array::set_bit (unsigned int index)
|
||||
|
||||
/* Resets all bits to zero. */
|
||||
INLINE void
|
||||
Bool_Array::clear (void)
|
||||
Bool_Array::clear ()
|
||||
{
|
||||
/* 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
|
||||
|
||||
@@ -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,
|
||||
though not as deterministic, of course! */
|
||||
|
||||
Gen_Perf::Gen_Perf (void)
|
||||
Gen_Perf::Gen_Perf ()
|
||||
{
|
||||
int asso_value_max;
|
||||
int non_linked_length;
|
||||
@@ -283,7 +283,7 @@ Gen_Perf::change (KeywordExt *prior, KeywordExt *curr)
|
||||
exponential in the number of keys. */
|
||||
|
||||
int
|
||||
Gen_Perf::doit_all (void)
|
||||
Gen_Perf::doit_all ()
|
||||
{
|
||||
KeywordExt_List *curr;
|
||||
for (curr = head; curr != NULL; curr = curr->rest())
|
||||
@@ -341,7 +341,7 @@ Gen_Perf::doit_all (void)
|
||||
|
||||
/* Prints out some diagnostics upon completion. */
|
||||
|
||||
Gen_Perf::~Gen_Perf (void)
|
||||
Gen_Perf::~Gen_Perf ()
|
||||
{
|
||||
if (option[DEBUG])
|
||||
{
|
||||
|
||||
@@ -43,9 +43,9 @@ private:
|
||||
static void sort_set (char *union_set, int len);
|
||||
|
||||
public:
|
||||
Gen_Perf (void);
|
||||
~Gen_Perf (void);
|
||||
int doit_all (void);
|
||||
Gen_Perf ();
|
||||
~Gen_Perf ();
|
||||
int doit_all ();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -40,7 +40,7 @@ Hash_Table::Hash_Table (KeywordExt **table_ptr, int s, int ignore_len):
|
||||
memset ((char *) table, 0, size * sizeof (*table));
|
||||
}
|
||||
|
||||
Hash_Table::~Hash_Table (void)
|
||||
Hash_Table::~Hash_Table ()
|
||||
{
|
||||
if (option[DEBUG])
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ private:
|
||||
|
||||
public:
|
||||
Hash_Table (KeywordExt **t, int s, int ignore_len);
|
||||
~Hash_Table (void);
|
||||
~Hash_Table ();
|
||||
KeywordExt *insert (KeywordExt *item);
|
||||
};
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ int Key_List::determined[MAX_ALPHA_SIZE];
|
||||
|
||||
/* Destructor dumps diagnostics during debugging. */
|
||||
|
||||
Key_List::~Key_List (void)
|
||||
Key_List::~Key_List ()
|
||||
{
|
||||
if (option[DEBUG])
|
||||
{
|
||||
@@ -111,7 +111,7 @@ Key_List::get_special_input (char delimiter)
|
||||
generated code output. */
|
||||
|
||||
const char *
|
||||
Key_List::save_include_src (void)
|
||||
Key_List::save_include_src ()
|
||||
{
|
||||
int c;
|
||||
|
||||
@@ -132,7 +132,7 @@ Key_List::save_include_src (void)
|
||||
use the default array of keys. */
|
||||
|
||||
const char *
|
||||
Key_List::get_array_type (void)
|
||||
Key_List::get_array_type ()
|
||||
{
|
||||
return get_special_input ('%');
|
||||
}
|
||||
@@ -167,7 +167,7 @@ Key_List::strcspn (const char *s, const char *reject)
|
||||
based upon various user Options. */
|
||||
|
||||
void
|
||||
Key_List::set_output_types (void)
|
||||
Key_List::set_output_types ()
|
||||
{
|
||||
if (option[TYPE])
|
||||
{
|
||||
@@ -344,7 +344,7 @@ parse_line (const char *line, const char *delimiters)
|
||||
unhashable elements possessing identical key sets and lengths. */
|
||||
|
||||
void
|
||||
Key_List::read_keys (void)
|
||||
Key_List::read_keys ()
|
||||
{
|
||||
char *ptr;
|
||||
|
||||
@@ -568,7 +568,7 @@ Key_List::already_determined (KeywordExt *ptr)
|
||||
search process. See Cichelli's paper from Jan 1980 JACM for details.... */
|
||||
|
||||
void
|
||||
Key_List::reorder (void)
|
||||
Key_List::reorder ()
|
||||
{
|
||||
KeywordExt_List *ptr;
|
||||
for (ptr = head; ptr; ptr = ptr->rest())
|
||||
@@ -611,7 +611,7 @@ Key_List::reorder (void)
|
||||
/* Sorts the keys by hash value. */
|
||||
|
||||
void
|
||||
Key_List::sort (void)
|
||||
Key_List::sort ()
|
||||
{
|
||||
hash_sort = 1;
|
||||
occurrence_sort = 0;
|
||||
@@ -638,7 +638,7 @@ Key_List::dump ()
|
||||
|
||||
/* Simple-minded constructor action here... */
|
||||
|
||||
Key_List::Key_List (void)
|
||||
Key_List::Key_List ()
|
||||
{
|
||||
total_keys = 1;
|
||||
max_key_len = INT_MIN;
|
||||
@@ -654,7 +654,7 @@ Key_List::Key_List (void)
|
||||
/* Returns the length of entire key list. */
|
||||
|
||||
int
|
||||
Key_List::keyword_list_length (void)
|
||||
Key_List::keyword_list_length ()
|
||||
{
|
||||
return list_len;
|
||||
}
|
||||
@@ -662,7 +662,7 @@ Key_List::keyword_list_length (void)
|
||||
/* Returns length of longest key read. */
|
||||
|
||||
int
|
||||
Key_List::max_key_length (void)
|
||||
Key_List::max_key_length ()
|
||||
{
|
||||
return max_key_len;
|
||||
}
|
||||
|
||||
@@ -59,10 +59,10 @@ private:
|
||||
#endif
|
||||
static int already_determined (KeywordExt *ptr);
|
||||
static void set_determined (KeywordExt *ptr);
|
||||
void set_output_types (void);
|
||||
void dump (void);
|
||||
const char *get_array_type (void);
|
||||
const char *save_include_src (void);
|
||||
void set_output_types ();
|
||||
void dump ();
|
||||
const char *get_array_type ();
|
||||
const char *save_include_src ();
|
||||
const char *get_special_input (char delimiter);
|
||||
KeywordExt_List *merge (KeywordExt_List *list1, KeywordExt_List *list2);
|
||||
KeywordExt_List *merge_sort (KeywordExt_List *head);
|
||||
@@ -72,13 +72,13 @@ protected:
|
||||
int total_duplicates; /* Total number of duplicate hash values. */
|
||||
|
||||
public:
|
||||
Key_List (void);
|
||||
~Key_List (void);
|
||||
int keyword_list_length (void);
|
||||
int max_key_length (void);
|
||||
void reorder (void);
|
||||
void sort (void);
|
||||
void read_keys (void);
|
||||
Key_List ();
|
||||
~Key_List ();
|
||||
int keyword_list_length ();
|
||||
int max_key_length ();
|
||||
void reorder ();
|
||||
void sort ();
|
||||
void read_keys ();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -218,7 +218,7 @@ Options::long_usage (FILE * strm)
|
||||
/* Output command-line Options. */
|
||||
|
||||
void
|
||||
Options::print_options (void)
|
||||
Options::print_options ()
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -363,7 +363,7 @@ Options::key_sort (char *base, int len)
|
||||
|
||||
/* Sets the default Options. */
|
||||
|
||||
Options::Options (void)
|
||||
Options::Options ()
|
||||
{
|
||||
key_positions[0] = WORD_START;
|
||||
key_positions[1] = WORD_END;
|
||||
@@ -384,7 +384,7 @@ Options::Options (void)
|
||||
|
||||
/* Dumps option status when debug is set. */
|
||||
|
||||
Options::~Options (void)
|
||||
Options::~Options ()
|
||||
{
|
||||
if (option_word & DEBUG)
|
||||
{
|
||||
|
||||
@@ -79,30 +79,30 @@ enum
|
||||
class Options
|
||||
{
|
||||
public:
|
||||
Options (void);
|
||||
~Options (void);
|
||||
Options ();
|
||||
~Options ();
|
||||
int operator[] (Option_Type option);
|
||||
void operator() (int argc, char *argv[]);
|
||||
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 int get_asso_max (void);
|
||||
static void reset (void);
|
||||
static int get (void);
|
||||
static int get_iterations (void);
|
||||
static int get_max_keysig_size (void);
|
||||
static int get_asso_max ();
|
||||
static void reset ();
|
||||
static int get ();
|
||||
static int get_iterations ();
|
||||
static int get_max_keysig_size ();
|
||||
static void set_keysig_size (int);
|
||||
static int get_jump (void);
|
||||
static int initial_value (void);
|
||||
static int get_total_switches (void);
|
||||
static const char *get_function_name (void);
|
||||
static const char *get_key_name (void);
|
||||
static const char *get_initializer_suffix (void);
|
||||
static const char *get_class_name (void);
|
||||
static const char *get_hash_name (void);
|
||||
static const char *get_wordlist_name (void);
|
||||
static const char *get_delimiter (void);
|
||||
static int get_jump ();
|
||||
static int initial_value ();
|
||||
static int get_total_switches ();
|
||||
static const char *get_function_name ();
|
||||
static const char *get_key_name ();
|
||||
static const char *get_initializer_suffix ();
|
||||
static const char *get_class_name ();
|
||||
static const char *get_hash_name ();
|
||||
static const char *get_wordlist_name ();
|
||||
static const char *get_delimiter ();
|
||||
|
||||
private:
|
||||
static int option_word; /* Holds the user-specified Options. */
|
||||
|
||||
@@ -42,14 +42,14 @@ Options::operator != (enum Option_Type opt)
|
||||
|
||||
/* Initializes the key Iterator. */
|
||||
INLINE void
|
||||
Options::reset (void)
|
||||
Options::reset ()
|
||||
{
|
||||
key_pos = 0;
|
||||
}
|
||||
|
||||
/* Returns current key_position and advance index. */
|
||||
INLINE int
|
||||
Options::get (void)
|
||||
Options::get ()
|
||||
{
|
||||
return key_positions[key_pos++];
|
||||
}
|
||||
@@ -63,14 +63,14 @@ Options::set_asso_max (int r)
|
||||
|
||||
/* Returns the size of the table size. */
|
||||
INLINE int
|
||||
Options::get_asso_max (void)
|
||||
Options::get_asso_max ()
|
||||
{
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Returns total distinct key positions. */
|
||||
INLINE int
|
||||
Options::get_max_keysig_size (void)
|
||||
Options::get_max_keysig_size ()
|
||||
{
|
||||
return total_keysig_size;
|
||||
}
|
||||
@@ -84,63 +84,63 @@ Options::set_keysig_size (int size)
|
||||
|
||||
/* Returns the jump value. */
|
||||
INLINE int
|
||||
Options::get_jump (void)
|
||||
Options::get_jump ()
|
||||
{
|
||||
return jump;
|
||||
}
|
||||
|
||||
/* Returns the generated function name. */
|
||||
INLINE const char *
|
||||
Options::get_function_name (void)
|
||||
Options::get_function_name ()
|
||||
{
|
||||
return function_name;
|
||||
}
|
||||
|
||||
/* Returns the keyword key name. */
|
||||
INLINE const char *
|
||||
Options::get_key_name (void)
|
||||
Options::get_key_name ()
|
||||
{
|
||||
return key_name;
|
||||
}
|
||||
|
||||
/* Returns the struct initializer suffix. */
|
||||
INLINE const char *
|
||||
Options::get_initializer_suffix (void)
|
||||
Options::get_initializer_suffix ()
|
||||
{
|
||||
return initializer_suffix;
|
||||
}
|
||||
|
||||
/* Returns the hash function name. */
|
||||
INLINE const char *
|
||||
Options::get_hash_name (void)
|
||||
Options::get_hash_name ()
|
||||
{
|
||||
return hash_name;
|
||||
}
|
||||
|
||||
/* Returns the hash table array name. */
|
||||
INLINE const char *
|
||||
Options::get_wordlist_name (void)
|
||||
Options::get_wordlist_name ()
|
||||
{
|
||||
return wordlist_name;
|
||||
}
|
||||
|
||||
/* Returns the generated class name. */
|
||||
INLINE const char *
|
||||
Options::get_class_name (void)
|
||||
Options::get_class_name ()
|
||||
{
|
||||
return class_name;
|
||||
}
|
||||
|
||||
/* Returns the initial associated character value. */
|
||||
INLINE int
|
||||
Options::initial_value (void)
|
||||
Options::initial_value ()
|
||||
{
|
||||
return initial_asso_value;
|
||||
}
|
||||
|
||||
/* Returns the iterations value. */
|
||||
INLINE int
|
||||
Options::get_iterations (void)
|
||||
Options::get_iterations ()
|
||||
{
|
||||
return iterations;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ Output::Output (KeywordExt_List *head_, const char *array_type_,
|
||||
find the final item! */
|
||||
|
||||
void
|
||||
Output::compute_min_max (void)
|
||||
Output::compute_min_max ()
|
||||
{
|
||||
KeywordExt_List *temp;
|
||||
for (temp = head; temp->rest(); temp = temp->rest())
|
||||
@@ -100,7 +100,7 @@ Output::compute_min_max (void)
|
||||
/* Returns the number of different hash values. */
|
||||
|
||||
int
|
||||
Output::num_hash_values (void)
|
||||
Output::num_hash_values ()
|
||||
{
|
||||
int count = 1;
|
||||
KeywordExt_List *temp;
|
||||
@@ -400,7 +400,7 @@ void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1,
|
||||
proper encoding for each key word. */
|
||||
|
||||
void
|
||||
Output::output_hash_function (void)
|
||||
Output::output_hash_function ()
|
||||
{
|
||||
const int max_column = 10;
|
||||
int field_width;
|
||||
@@ -568,7 +568,7 @@ Output::output_hash_function (void)
|
||||
comparison code in generated function ``in_word_set''. */
|
||||
|
||||
void
|
||||
Output::output_keylength_table (void)
|
||||
Output::output_keylength_table ()
|
||||
{
|
||||
const int columns = 14;
|
||||
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. */
|
||||
|
||||
void
|
||||
Output::output_keyword_table (void)
|
||||
Output::output_keyword_table ()
|
||||
{
|
||||
const char *indent = option[GLOBAL] ? "" : " ";
|
||||
int index;
|
||||
@@ -749,7 +749,7 @@ Output::output_keyword_table (void)
|
||||
the smaller, contiguous range of the keyword table. */
|
||||
|
||||
void
|
||||
Output::output_lookup_array (void)
|
||||
Output::output_lookup_array ()
|
||||
{
|
||||
if (option[DUP])
|
||||
{
|
||||
@@ -912,7 +912,7 @@ Output::output_lookup_array (void)
|
||||
/* Generate all the tables needed for the lookup function. */
|
||||
|
||||
void
|
||||
Output::output_lookup_tables (void)
|
||||
Output::output_lookup_tables ()
|
||||
{
|
||||
if (option[SWITCH])
|
||||
{
|
||||
@@ -1341,7 +1341,7 @@ Output::output_lookup_function_body (const Output_Compare& comparison)
|
||||
/* Generates C code for the lookup function. */
|
||||
|
||||
void
|
||||
Output::output_lookup_function (void)
|
||||
Output::output_lookup_function ()
|
||||
{
|
||||
/* Output the function's head. */
|
||||
if (option[KRC] | option[C] | option[ANSIC])
|
||||
@@ -1397,7 +1397,7 @@ Output::output_lookup_function (void)
|
||||
based upon the user's Options. */
|
||||
|
||||
void
|
||||
Output::output (void)
|
||||
Output::output ()
|
||||
{
|
||||
compute_min_max ();
|
||||
|
||||
|
||||
18
src/output.h
18
src/output.h
@@ -35,18 +35,18 @@ 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);
|
||||
void output ();
|
||||
private:
|
||||
void compute_min_max (void);
|
||||
int num_hash_values (void);
|
||||
void compute_min_max ();
|
||||
int num_hash_values ();
|
||||
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_hash_function ();
|
||||
void output_keylength_table ();
|
||||
void output_keyword_table ();
|
||||
void output_lookup_array ();
|
||||
void output_lookup_tables ();
|
||||
void output_lookup_function_body (const struct Output_Compare&);
|
||||
void output_lookup_function (void);
|
||||
void output_lookup_function ();
|
||||
|
||||
/* Linked list of keywords. */
|
||||
KeywordExt_List *head;
|
||||
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
and ignoring lines starting with '#'. Returns NULL on error or EOF.
|
||||
The storage for the string is dynamically allocated and must be freed
|
||||
through delete[]. */
|
||||
char *read_next_line (void);
|
||||
char *read_next_line ();
|
||||
|
||||
private:
|
||||
FILE *fp; /* FILE pointer to the input stream. */
|
||||
|
||||
@@ -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
|
||||
through delete[]. */
|
||||
INLINE char *
|
||||
Read_Line::read_next_line (void)
|
||||
Read_Line::read_next_line ()
|
||||
{
|
||||
int c;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user