diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-06 05:31:12 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 1999-06-06 05:31:12 +0000 |
commit | 04083db794bd12b187bfda4dfcaa009256fd823a (patch) | |
tree | 1ffe7ee6c6ad40b2c91c430489d3de24b2a4bbf8 /apps | |
parent | 083a2168714bdbb769436248370f6f9b607cc17b (diff) | |
download | ATCD-04083db794bd12b187bfda4dfcaa009256fd823a.tar.gz |
.
Diffstat (limited to 'apps')
-rw-r--r-- | apps/gperf/ChangeLog | 131 | ||||
-rw-r--r-- | apps/gperf/src/Bool_Array.cpp | 6 | ||||
-rw-r--r-- | apps/gperf/src/Key_List.cpp | 90 | ||||
-rw-r--r-- | apps/gperf/src/Key_List.h | 8 | ||||
-rw-r--r-- | apps/gperf/src/List_Node.cpp | 6 | ||||
-rw-r--r-- | apps/gperf/src/List_Node.h | 2 |
6 files changed, 116 insertions, 127 deletions
diff --git a/apps/gperf/ChangeLog b/apps/gperf/ChangeLog index 7f0a5220a68..044553257ab 100644 --- a/apps/gperf/ChangeLog +++ b/apps/gperf/ChangeLog @@ -1,30 +1,31 @@ +Sat Jun 5 23:17:39 1999 Douglas C. Schmidt <schmidt@danzon.cs.wustl.edu> + + * Replaced all uses of "index" with "slot" to avoid problems with + broken C++ compilers that define a macro called "index". + Tue May 4 14:24:27 1999 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.cpp (parse_args): Removed %a flag from -v option and - used ACE_OS::exit (0) instead. + used ACE_OS::exit (0) instead. Mon Apr 26 15:42:54 1999 Ossama Othman <othman@cs.wustl.edu> - * tests/test-{1,2,3,4,5}.exp: - - Forgot to update the expected test output to reflect the - version string update listed below. + * tests/test-{1,2,3,4,5}.exp: Forgot to update the expected test + output to reflect the version string update listed below. Mon Apr 26 10:42:08 1999 Ossama Othman <othman@cs.wustl.edu> - * src/Version.cpp (version_string): - - Updated version string to "2.8 (ACE version)" since 2.7 is used - by the old Cygnus maintained gperf. + * src/Version.cpp (version_string): Updated version string to "2.8 + (ACE version)" since 2.7 is used by the old Cygnus maintained + gperf. - * src/*.{h,cpp}: - - Updated copyright/distribution information to GPL v2 style notice. + * src/*.{h,cpp}: Updated copyright/distribution information to GPL + v2 style notice. Sun Apr 25 16:16:12 1999 Ossama Othman <othman@cs.wustl.edu> * mdate-sh: Added this file to the CVS repository. It will be - used once the auto{conf,make} integrations are in place. + used once the auto{conf,make} integrations are in place. Sun Apr 25 16:13:40 1999 Ossama Othman <othman@cs.wustl.edu> @@ -34,49 +35,42 @@ Sat Apr 24 18:18:35 1999 Ossama Othman <othman@cs.wustl.edu> * gperf.1: * gperf.info: - * gperf.texi: - - Added missing quote, cosmetic fix, regenerated gperf.info. + * gperf.texi: Added missing quote, cosmetic fix, regenerated + gperf.info. * src/Key_List.cpp * src/Options.h: - * src/Options.cpp: - - Merged Cygnus patch that allows the user to specify a default - fill expression/value in the keyword table. Updated help - message with new `-F' option. Made some cosmetic fixes to the - help message, too. + * src/Options.cpp: Merged Cygnus patch that allows the user to + specify a default fill expression/value in the keyword table. + Updated help message with new `-F' option. Made some cosmetic + fixes to the help message, too. - * tests/test.cpp: + * tests/test.cpp: Minor spelling correction in comment - Minor spelling correction in comment - - * tests/test-6.exp: - - Updated with new expected gperf output. + * tests/test-6.exp: Updated with new expected gperf output. Mon Nov 9 23:37:09 1998 Vishal Kachroo <vishal@cs.wustl.edu> * src/Key_List.cpp: Fixed the problem with Binary and Linear - Search code. + Search code. Sat Oct 10 18:40:56 1998 Vishal Kachroo <vishal@merengue.cs.wustl.edu> * tests/test-6.exp (Usage): copied the output of gperf -h option - into test-6.exp. This test was failing because it didn't have - the -b option previously. Thanks to David for reporting the failure - of tests. + into test-6.exp. This test was failing because it didn't have + the -b option previously. Thanks to David for reporting the + failure of tests. * src/Options.cpp : Changed the option case 'h' to include the - following line " -b/t Code for Linear Search". + following line " -b/t Code for Linear Search". Fri Oct 9 01:06:56 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.cpp : - * src/Key_List.cpp (output_linear_search_function): - Changed option -z to -b for generating linear search. Removed - <len> parameter from the lookup code. We dont need <len> in the - generated code in the case of linear/binary search options. + * src/Key_List.cpp (output_linear_search_function): Changed option + -z to -b for generating linear search. Removed <len> parameter + from the lookup code. We dont need <len> in the generated code + in the case of linear/binary search options. Thu Oct 8 17:40:19 1998 Vishal Kachroo <vishal@merengue.cs.wustl.edu> @@ -94,7 +88,6 @@ Wed Oct 7 01:20:35 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> Updated thif file to the current help message. Thanks to Hans for reporting this. - Tue Oct 6 11:51:47 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Key_List.cpp (Key_List): Fixed g++ warnings. @@ -105,18 +98,19 @@ Tue Oct 6 02:48:37 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> Search code generated from GPERF. * src/Options.cpp (parse_args): Added the -B option for the binary - search. + search. * src/Options.h (enum Option_Type): Added the BINARYSEARCH in the - enumeration. + enumeration. - * src/Key_List.cpp : Added the function output_binary_search_function - (void). Changed the output function to include the Binary Search option. - Used option[BINARYSEARCH] to distinguish the binary search case from the - hashing case. + * src/Key_List.cpp : Added the function + output_binary_search_function(void). Changed the output function + to include the Binary Search option. Used option[BINARYSEARCH] + to distinguish the binary search case from the hashing case. - * src/Key_List.h : Added the prototype for output_binary_search_function. - Also added the key_sort variable to enable sorting based on key values. + * src/Key_List.h : Added the prototype for + output_binary_search_function. Also added the key_sort variable + to enable sorting based on key values. Mon Oct 5 18:24:15 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> @@ -139,51 +133,50 @@ Sat Oct 3 19:36:52 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.h: * src/Options.cpp: * src/Key_List.h: - * src/Key_List.cpp: - Reverted all the changes done for Binary Search. + * src/Key_List.cpp: Reverted all the changes done for Binary + Search. Sat Oct 3 17:51:10 1998 Carlos O'Ryan <coryan@cs.wustl.edu> - * tests/test-6.exp: - Added the new -B option. + * tests/test-6.exp: Added the new -B option. Sat Oct 3 13:47:40 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Key_List.cpp (output_binary_search_function): Added a new - line after binary search code. + line after binary search code. Sat Oct 3 10:11:15 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.cpp (parse_args): Changed the option for binary - search to '-B' + search to '-B' Fri Oct 2 21:38:54 1998 Vishal Kachroo <vishal@merengue.cs.wustl.edu> * src/Options.cpp (parse_args): Added the -b option for the binary - search. + search. * src/Options.h (enum Option_Type): Added the BINARYSEARCH in the - enumeration. - - * src/Key_List.cpp : Added the function output_binary_search_function - (void). Changed the output function to include the Binary Search option. - Used option[BINARYSEARCH] to distinguish the binary search case from the - hashing case. + enumeration. - * src/Key_List.h : Added the prototype for output_binary_search_function. - Also added the key_sort variable to enable sorting based on key values. + * src/Key_List.cpp : Added the function + output_binary_search_function (void). Changed the output + function to include the Binary Search option. Used + option[BINARYSEARCH] to distinguish the binary search case from + the hashing case. + * src/Key_List.h : Added the prototype for + output_binary_search_function. Also added the key_sort variable + to enable sorting based on key values. Thu Oct 1 12:40:59 1998 Alexander Babu Arulanthu <alex@cs.wustl.edu> * src/Options.cpp (parse_args): Comments for Vishal to incorporate - Binary Seach on to GPERF. + Binary Seach on to GPERF. Wed Sep 30 16:55:53 1998 Carlos O'Ryan <coryan@cs.wustl.edu> - * tests/Makefile: - Updated dependencies, added a realclean target to remove the - output from the tests. + * tests/Makefile: Updated dependencies, added a realclean target + to remove the output from the tests. Wed Sep 30 12:41:29 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> @@ -192,15 +185,15 @@ Wed Sep 30 12:41:29 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> Mon Sep 28 13:18:05 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> - * tests: Updated all the test-*.exp files to reflect the - latest "unsigned" changes. + * tests: Updated all the test-*.exp files to reflect the latest + "unsigned" changes. * src/Key_List.cpp (output_hash_function): Fixed another use of int to be unsigned int. * tests/test.cpp: Fixed the signature of in_word_set() to be - consistent with the new gperf. Thanks to David Levine and - Carlos O'Ryan for this fix. + consistent with the new gperf. Thanks to David Levine and + Carlos O'Ryan for this fix. Sun Sep 27 00:04:18 1998 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu> diff --git a/apps/gperf/src/Bool_Array.cpp b/apps/gperf/src/Bool_Array.cpp index baf74e31a2e..926c9bc2ecd 100644 --- a/apps/gperf/src/Bool_Array.cpp +++ b/apps/gperf/src/Bool_Array.cpp @@ -72,13 +72,13 @@ Bool_Array::open (u_long s) } int -Bool_Array::find (u_long index) +Bool_Array::find (u_long slot) { - if (storage_array_[index] == generation_number_) + if (storage_array_[slot] == generation_number_) return 1; else { - storage_array_[index] = generation_number_; + storage_array_[slot] = generation_number_; return 0; } } diff --git a/apps/gperf/src/Key_List.cpp b/apps/gperf/src/Key_List.cpp index a17a01491f9..9bbf0607d16 100644 --- a/apps/gperf/src/Key_List.cpp +++ b/apps/gperf/src/Key_List.cpp @@ -641,9 +641,9 @@ Key_List::output_switch (int use_keyword_table) temp->hash_value, links->key); if (pointer_and_type_enabled) - ACE_OS::printf (" resword = &wordlist[%d];\n", links->index); + ACE_OS::printf (" resword = &wordlist[%d];\n", links->slot); else if (use_keyword_table) - ACE_OS::printf (" resword = wordlist[%d];\n", links->index); + ACE_OS::printf (" resword = wordlist[%d];\n", links->slot); else ACE_OS::printf (" resword = \"%s\";\n", links->key); ACE_OS::printf (" if (%s) return resword;\n", comp_buffer); @@ -660,17 +660,17 @@ Key_List::output_switch (int use_keyword_table) temp = temp->next) { if (pointer_and_type_enabled) - ACE_OS::printf (" resword = &wordlist[%d];\n", temp->index); + ACE_OS::printf (" resword = &wordlist[%d];\n", temp->slot); else if (use_keyword_table) - ACE_OS::printf (" resword = wordlist[%d];", temp->index); + ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";\n", temp->key); ACE_OS::printf (" if (%s) return resword;\n", comp_buffer); } if (pointer_and_type_enabled) - ACE_OS::printf (" resword = &wordlist[%d];\n", temp->index); + ACE_OS::printf (" resword = &wordlist[%d];\n", temp->slot); else if (use_keyword_table) - ACE_OS::printf (" resword = wordlist[%d];", temp->index); + ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";\n", temp->key); ACE_OS::printf (" return %s ? resword : 0;\n", comp_buffer); @@ -680,9 +680,9 @@ Key_List::output_switch (int use_keyword_table) else { if (pointer_and_type_enabled) - ACE_OS::printf (" resword = &wordlist[%d];", temp->index); + ACE_OS::printf (" resword = &wordlist[%d];", temp->slot); else if (use_keyword_table) - ACE_OS::printf (" resword = wordlist[%d];", temp->index); + ACE_OS::printf (" resword = wordlist[%d];", temp->slot); else ACE_OS::printf (" resword = \"%s\";", temp->key); if (option[LENTABLE] && !option[DUP]) @@ -744,7 +744,7 @@ void Key_List::output_keylength_table (void) { const int max_column = 15; - int index = 0; + int slot = 0; int column = 0; char *indent = option[GLOBAL] ? "" : " "; List_Node *temp; @@ -756,11 +756,11 @@ Key_List::output_keylength_table (void) max_key_len <= UCHAR_MAX ? "char" : (max_key_len <= USHRT_MAX ? "short" : "long"), indent, indent); - for (temp = head; temp; temp = temp->next, index++) + for (temp = head; temp; temp = temp->next, slot++) { - if (index < temp->hash_value) - for ( ; index < temp->hash_value; index++) + if (slot < temp->hash_value) + for ( ; slot < temp->hash_value; slot++) ACE_OS::printf ("%3d,%s", 0, ++column % (max_column - 1) ? "" : "\n "); ACE_OS::printf ("%3d,%s", temp->length, ++column % (max_column - 1 ) ? "" : "\n "); @@ -779,7 +779,7 @@ Key_List::output_keyword_table (void) char *l_brace = *head->rest ? "{" : ""; char *r_brace = *head->rest ? "}," : ""; char *indent = option[GLOBAL] ? "" : " "; - int index = 0; + int slot = 0; List_Node *temp; ACE_OS::printf ("%sstatic %s%swordlist[] =\n%s%s{\n", @@ -797,14 +797,14 @@ Key_List::output_keyword_table (void) int column; - for (column = 1; index < head->hash_value; column++) + for (column = 1; slot < head->hash_value; column++) { ACE_OS::printf ("%s\"\"%s,%s %s", l_brace, option.fill_default (), r_brace, column % 9 ? "" : "\n "); - index++; + slot++; } if (0 < head->hash_value && column % 10) @@ -812,17 +812,17 @@ Key_List::output_keyword_table (void) // Generate an array of reserved words at appropriate locations. - for (temp = head ; temp; temp = temp->next, index++) + for (temp = head ; temp; temp = temp->next, slot++) { - temp->index = index; + temp->slot = slot; - if (!option[SWITCH] && (total_duplicates == 0 || !option[DUP]) && index < temp->hash_value) + if (!option[SWITCH] && (total_duplicates == 0 || !option[DUP]) && slot < temp->hash_value) { int column; ACE_OS::printf (" "); - for (column = 1; index < temp->hash_value; index++, column++) + for (column = 1; slot < temp->hash_value; slot++, column++) ACE_OS::printf ("%s\"\",%s %s", l_brace, r_brace, column % 9 ? "" : "\n "); if (column % 10) @@ -831,9 +831,9 @@ Key_List::output_keyword_table (void) { ACE_OS::printf ("%s\"%s\", %s%s", l_brace, temp->key, temp->rest, r_brace); if (option[DEBUG]) - ACE_OS::printf (" /* hash value = %d, index = %d */", + ACE_OS::printf (" /* hash value = %d, slot = %d */", temp->hash_value, - temp->index); + temp->slot); putchar ('\n'); continue; } @@ -841,21 +841,21 @@ Key_List::output_keyword_table (void) ACE_OS::printf (" %s\"%s\", %s%s", l_brace, temp->key, temp->rest, r_brace); if (option[DEBUG]) - ACE_OS::printf (" /* hash value = %d, index = %d */", + ACE_OS::printf (" /* hash value = %d, slot = %d */", temp->hash_value, - temp->index); + temp->slot); putchar ('\n'); // Deal with links specially. if (temp->link) for (List_Node *links = temp->link; links; links = links->link) { - links->index = ++index; + links->slot = ++slot; ACE_OS::printf (" %s\"%s\", %s%s", l_brace, links->key, links->rest, r_brace); if (option[DEBUG]) - ACE_OS::printf (" /* hash value = %d, index = %d */", + ACE_OS::printf (" /* hash value = %d, slot = %d */", links->hash_value, - links->index); + links->slot); putchar ('\n'); } @@ -1189,10 +1189,10 @@ Key_List::count_duplicates (List_Node *link, if (option[DEBUG]) ACE_DEBUG ((LM_DEBUG, - "%s linked keyword = %s, index = %d, hash_value = %d\n", + "%s linked keyword = %s, slot = %d, hash_value = %d\n", type, ptr->key, - ptr->index, + ptr->slot, ptr->hash_value)); } @@ -1206,7 +1206,7 @@ Key_List::update_lookup_array (int lookup_array[], Duplicate_Entry *dup_ptr, int value) { - lookup_array[i1] = -dup_ptr->index; + lookup_array[i1] = -dup_ptr->slot; lookup_array[i2] = -dup_ptr->count; lookup_array[dup_ptr->hash_value] = value; } @@ -1243,17 +1243,17 @@ Key_List::output_lookup_array (void) for (List_Node *temp = head; temp; temp = temp->next) { int hash_value = temp->hash_value; - // Store the keyword's index location into the + // Store the keyword's slot location into the // <lookup_array> at the <hash_value>. If this is a // non-duplicate, then this value will point directly to the // keyword. - lookup_array[hash_value] = temp->index; + lookup_array[hash_value] = temp->slot; if (option[DEBUG]) ACE_DEBUG ((LM_DEBUG, - "keyword = %s, index = %d, hash_value = %d, lookup_array[hash_value] = %d\n", + "keyword = %s, slot = %d, hash_value = %d, lookup_array[hash_value] = %d\n", temp->key, - temp->index, + temp->slot, temp->hash_value, lookup_array[temp->hash_value])); @@ -1266,7 +1266,7 @@ Key_List::output_lookup_array (void) { // We'll handle the duplicates here. dup_ptr->hash_value = hash_value; - dup_ptr->index = temp->index; + dup_ptr->slot = temp->slot; dup_ptr->count = 1; // Count the number of "static" duplicates, i.e., @@ -1292,10 +1292,10 @@ Key_List::output_lookup_array (void) { if (option[DEBUG]) ACE_DEBUG ((LM_DEBUG, - "dup_ptr[%d]: hash_value = %d, index = %d, count = %d\n", + "dup_ptr[%d]: hash_value = %d, slot = %d, count = %d\n", dup_ptr - duplicates, dup_ptr->hash_value, - dup_ptr->index, + dup_ptr->slot, dup_ptr->count)); int i; @@ -1397,14 +1397,14 @@ Key_List::output_lookup_function (void) if (option[DUP] && total_duplicates > 0) { - ACE_OS::printf (" int index = lookup[key];\n\n" - " if (index >= 0 && index < MAX_HASH_VALUE)\n"); + ACE_OS::printf (" int slot = lookup[key];\n\n" + " if (slot >= 0 && slot < MAX_HASH_VALUE)\n"); if (option[OPTIMIZE]) - ACE_OS::printf (" return %swordlist[index];\n", option[TYPE] && option[POINTER] ? "&" : ""); + ACE_OS::printf (" return %swordlist[slot];\n", option[TYPE] && option[POINTER] ? "&" : ""); else { ACE_OS::printf (" {\n" - " %schar *s = wordlist[index]", option[CONSTANT] ? "const " : ""); + " %schar *s = wordlist[slot]", option[CONSTANT] ? "const " : ""); if (array_type_ != Key_List::default_array_type) ACE_OS::printf (".%s", option.key_name ()); @@ -1413,12 +1413,12 @@ Key_List::output_lookup_function (void) option[STRCASECMP] ? "charmap[*str]" : "*str", option[COMP] ? (option[STRCASECMP] ? "strncasecmp (str + 1, s + 1, len - 1)" : "strncmp (str + 1, s + 1, len - 1)") : (option[STRCASECMP] ? "strcasecmp (str + 1, s + 1)" : "strcmp (str + 1, s + 1)"), - option[TYPE] && option[POINTER] ? "&wordlist[index]" : "s"); - ACE_OS::printf (" else if (index < 0 && index >= -MAX_HASH_VALUE)\n" + option[TYPE] && option[POINTER] ? "&wordlist[slot]" : "s"); + ACE_OS::printf (" else if (slot < 0 && slot >= -MAX_HASH_VALUE)\n" " return 0;\n"); } ACE_OS::printf (" else\n {\n" - " unsigned int offset = key + index + (index > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);\n" + " unsigned int offset = key + slot + (slot > 0 ? -MAX_HASH_VALUE : MAX_HASH_VALUE);\n" " %s%s*base = &wordlist[-lookup[offset]];\n" " %s%s*ptr = base + -lookup[offset + 1];\n\n" " while (--ptr >= base)\n ", @@ -1755,7 +1755,7 @@ Key_List::dump (void) : ACE_OS::strlen ("keysig"); ACE_DEBUG ((LM_DEBUG, - "\nList contents are:\n(hash value, key length, index, %*s, %*s, duplicates):\n", + "\nList contents are:\n(hash value, key length, slot, %*s, %*s, duplicates):\n", keysig_width, "keysig", keyword_width, @@ -1767,7 +1767,7 @@ Key_List::dump (void) "%11d,%11d,%6d, %*s, %*s", ptr->hash_value, ptr->length, - ptr->index, + ptr->slot, keysig_width, ptr->keysig, keyword_width, diff --git a/apps/gperf/src/Key_List.h b/apps/gperf/src/Key_List.h index 1fe86eb62b0..0992f8136ec 100644 --- a/apps/gperf/src/Key_List.h +++ b/apps/gperf/src/Key_List.h @@ -41,11 +41,11 @@ public: int hash_value; // Hash value for this particular duplicate set. - int index; - // Index into the main keyword storage array. + int slot; + // Slot into the main keyword storage array. int count; - // Number of consecutive duplicates at this index. + // Number of consecutive duplicates at this slot. }; class Key_List @@ -165,7 +165,7 @@ private: // hash value. static int determined_[Vectors::ALPHA_SIZE]; - // Sets the index location for all keysig characters that are now + // Sets the slot location for all keysig characters that are now // determined. }; diff --git a/apps/gperf/src/List_Node.cpp b/apps/gperf/src/List_Node.cpp index 450831ecb52..0f5fb5052ff 100644 --- a/apps/gperf/src/List_Node.cpp +++ b/apps/gperf/src/List_Node.cpp @@ -29,10 +29,6 @@ ACE_RCSID(src, List_Node, "$Id$") #include "Vectors.h" -// Defined as a macro in string.h on some systems, which causes -// conflicts. -#undef index - // Sorts the key set alphabetically to speed up subsequent operation // Uses insertion sort since the set is probably quite small. @@ -74,7 +70,7 @@ List_Node::List_Node (char *k, int len) key (k), rest (option[TYPE] ? k + len + 1 : ACE_const_cast(char*, "")), length (len), - index (0) + slot (0) { char *ptr = new char[(option[ALLCHARS] ? len : option.max_keysig_size ()) + 1]; keysig = ptr; diff --git a/apps/gperf/src/List_Node.h b/apps/gperf/src/List_Node.h index 8592462ed8c..1665099740d 100644 --- a/apps/gperf/src/List_Node.h +++ b/apps/gperf/src/List_Node.h @@ -72,7 +72,7 @@ public: int occurrence; // A metric for frequency of key set occurrences. - int index; + int slot; // Position of this node relative to other nodes. }; |