summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2001-07-29 21:38:54 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2001-07-29 21:38:54 +0000
commit3a36323cbed11597a66f0a6b73ff6f474364ec13 (patch)
treef165fe324bcfd3351d5a8440e4e77073fea1168a /apps
parent4aaa543327589201c083136c3b875a712e444c8d (diff)
downloadATCD-3a36323cbed11597a66f0a6b73ff6f474364ec13.tar.gz
ChangeLogTag:Sun Jul 29 10:50:45 2001 Ossama Othman <ossama@uci.edu>
Diffstat (limited to 'apps')
-rw-r--r--apps/gperf/ChangeLog29
-rw-r--r--apps/gperf/src/Key_List.cpp57
-rw-r--r--apps/gperf/src/Options.cpp2
-rw-r--r--apps/gperf/tests/tao.exp31
-rw-r--r--apps/gperf/tests/tao.gperf31
-rw-r--r--apps/gperf/tests/test-1.exp1
-rw-r--r--apps/gperf/tests/test-2.exp1
-rw-r--r--apps/gperf/tests/test-3.exp1
-rw-r--r--apps/gperf/tests/test-4.exp3
-rw-r--r--apps/gperf/tests/test-5.exp1
10 files changed, 105 insertions, 52 deletions
diff --git a/apps/gperf/ChangeLog b/apps/gperf/ChangeLog
index 736e09a5bb2..62b4cca8a20 100644
--- a/apps/gperf/ChangeLog
+++ b/apps/gperf/ChangeLog
@@ -1,3 +1,32 @@
+Sun Jul 29 12:17:55 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
+
+ * The following changes fix a bug reported by Karl Proese
+ <karl.proese@mchp.siemens.de> and Jeff Parsons.
+
+ * tests: Patched the *.exp files to include the new WORDLIST_SIZE
+ macro.
+
+ * src/Key_List.cpp: Generate a new const/enum that defines the
+ size of the wordlist array. This is now used to fix a nasty bug
+ where MAX_HASH_VALUE was used instead of WORDLIST_SIZE.
+
+ * src/Key_List.cpp (output_lookup_array): Reformatted the
+ debugging output to make it easier to tell what's going on.
+
+ * tests/tao.exp: Updated this file based on the expected output of
+ the new test example.
+
+ * tests/tao.gperf: Updated this to use a different set of keys since
+ they exercise the range of screwy inputs better than the earlier
+ contents of this file. In particular, this should detect
+ certain nasty bugs that were plaguing GPERF earlier for keyword
+ sets with a large number of duplicates.
+
+ * src/Key_List.cpp (read_keys): Clarified the debugging message
+ to indicate the key links are *static*.
+
+ * src/Options.cpp (parse_args): Fixed a stupid typo...
+
Sun Jul 1 08:33:56 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu>
* tests/Makefile: For some strange reason there was a BIN2 macro
diff --git a/apps/gperf/src/Key_List.cpp b/apps/gperf/src/Key_List.cpp
index 4f2d0b2ef91..73517232eb0 100644
--- a/apps/gperf/src/Key_List.cpp
+++ b/apps/gperf/src/Key_List.cpp
@@ -285,11 +285,12 @@ Key_List::read_keys (void)
{
List_Node *ptr = table.find (temp, option[NOLENGTH]);
- // Check for links. We deal with these by building an
- // equivalence class of all duplicate values (i.e.,
- // links) so that only 1 keyword is representative of
- // the entire collection. This *greatly* simplifies
- // processing during later stages of the program.
+ // Check for static key links. We deal with these by
+ // building an equivalence class of all duplicate values
+ // (i.e., links) so that only 1 keyword is
+ // representative of the entire collection. This
+ // *greatly* simplifies processing during later stages
+ // of the program.
if (ptr == 0)
trail = temp;
@@ -305,7 +306,7 @@ Key_List::read_keys (void)
// option.
if (!option[DUP] || option[DEBUGGING])
ACE_ERROR ((LM_ERROR,
- "Key link: \"%s\" = \"%s\", with key set \"%s\".\n",
+ "Static key link: \"%s\" = \"%s\", with key set \"%s\".\n",
temp->key,
ptr->key,
temp->keysig));
@@ -498,10 +499,10 @@ Key_List::output_min_max (void)
ACE_OS::printf ("\n#define TOTAL_KEYWORDS %d\n#define MIN_WORD_LENGTH %d"
"\n#define MAX_WORD_LENGTH %d\n#define MIN_HASH_VALUE %d"
"\n#define MAX_HASH_VALUE %d\n#define HASH_VALUE_RANGE %d"
- "\n#define DUPLICATES %d\n\n",
+ "\n#define DUPLICATES %d\n#define WORDLIST_SIZE %d\n\n",
total_keys, min_key_len, max_key_len, min_hash_value,
max_hash_value, max_hash_value - min_hash_value + 1,
- total_duplicates ? total_duplicates + 1 : 0);
+ total_duplicates ? total_duplicates + 1 : 0, total_keys + min_hash_value);
else if (option[GLOBAL])
ACE_OS::printf ("enum\n{\n"
" TOTAL_KEYWORDS = %d,\n"
@@ -510,10 +511,11 @@ Key_List::output_min_max (void)
" MIN_HASH_VALUE = %d,\n"
" MAX_HASH_VALUE = %d,\n"
" HASH_VALUE_RANGE = %d,\n"
- " DUPLICATES = %d\n};\n\n",
+ " DUPLICATES = %d\n"
+ " WORDLIST_SIZE = %d};\n\n",
total_keys, min_key_len, max_key_len, min_hash_value,
max_hash_value, max_hash_value - min_hash_value + 1,
- total_duplicates ? total_duplicates + 1 : 0);
+ total_duplicates ? total_duplicates + 1 : 0, total_keys + min_hash_value);
}
// Generates the output using a C switch. This trades increased
@@ -1436,8 +1438,8 @@ Key_List::output_lookup_array (void)
}
}
- int max = INT_MIN;
lookup_ptr = lookup_array + max_hash_value + 1;
+ int max = INT_MIN;
while (lookup_ptr > lookup_array)
{
@@ -1448,14 +1450,13 @@ Key_List::output_lookup_array (void)
const char *indent = option[GLOBAL] ? "" : " ";
- ACE_OS::printf ("%sstatic %ssigned %s lookup[] =\n%s%s{\n ", indent, option[CONSTANT] ? "const " : "",
+ ACE_OS::printf ("%sstatic %ssigned %s lookup[] =\n%s%s{\n%s", indent, option[CONSTANT] ? "const " : "",
max <= SCHAR_MAX ? "char" : (max <= SHRT_MAX ? "short" : "int"),
- indent, indent);
+ indent, indent, option[DEBUGGING] ? "" : " ");
int count = max;
- // Calculate maximum number of digits required for
- // MAX_HASH_VALUE.
+ // Calculate maximum number of digits required for LOOKUP_ARRAY_SIZE.
for (Key_List::field_width = 2; (count /= 10) > 0; Key_List::field_width++)
continue;
@@ -1466,12 +1467,19 @@ Key_List::output_lookup_array (void)
for (lookup_ptr = lookup_array;
lookup_ptr < lookup_array + max_hash_value + 1;
lookup_ptr++)
- ACE_OS::printf ("%*d, %s",
- Key_List::field_width,
- *lookup_ptr,
- ++column % (max_column - 1) ? "" : "\n ");
-
- ACE_OS::printf ("\n%s%s};\n\n", indent, indent);
+ {
+ if (option[DEBUGGING])
+ ACE_OS::printf (" %*d, /* slot = %d */\n",
+ Key_List::field_width,
+ *lookup_ptr,
+ lookup_ptr - lookup_array);
+ else
+ ACE_OS::printf ("%*d, %s",
+ Key_List::field_width,
+ *lookup_ptr,
+ ++column % (max_column - 1) ? "" : "\n ");
+ }
+ ACE_OS::printf ("%s%s%s};\n\n", option[DEBUGGING] ? "" : "\n", indent, indent);
delete [] duplicates;
delete [] lookup_array;
@@ -1496,7 +1504,7 @@ Key_List::output_lookup_function (void)
int pointer_and_type_enabled = option[POINTER] && option[TYPE];
ACE_OS::printf (" int slot = lookup[key];\n\n"
- " if (slot >= 0 && slot <= MAX_HASH_VALUE)\n");
+ " if (slot >= 0 && slot < WORDLIST_SIZE)\n");
if (option[OPTIMIZE])
ACE_OS::printf (" return %swordlist[slot];\n", option[TYPE] && option[POINTER] ? "&" : "");
else
@@ -1718,10 +1726,11 @@ Key_List::output (void)
" MIN_HASH_VALUE = %d,\n"
" MAX_HASH_VALUE = %d,\n"
" HASH_VALUE_RANGE = %d,\n"
- " DUPLICATES = %d\n };\n\n",
+ " DUPLICATES = %d,\n"
+ " WORDLIST_SIZE = %d\n };\n\n",
total_keys, min_key_len, max_key_len, min_hash_value,
max_hash_value, max_hash_value - min_hash_value + 1,
- total_duplicates ? total_duplicates + 1 : 0);
+ total_duplicates ? total_duplicates + 1 : 0, total_keys + min_hash_value);
// Use the switch in place of lookup table.
if (option[SWITCH])
output_switch ();
diff --git a/apps/gperf/src/Options.cpp b/apps/gperf/src/Options.cpp
index 9ca3d74f9bf..962248febc2 100644
--- a/apps/gperf/src/Options.cpp
+++ b/apps/gperf/src/Options.cpp
@@ -303,7 +303,7 @@ Options::parse_args (int argc, char *argv[])
{
ACE_SET_BITS (option_word_, DEBUGGING);
ACE_ERROR ((LM_ERROR,
- "Starting program %n, version %s, with debuggin on.\n",
+ "Starting program %n, version %s, with debugging on.\n",
version_string));
break;
}
diff --git a/apps/gperf/tests/tao.exp b/apps/gperf/tests/tao.exp
index 565d47e5b88..e3d52c74ed0 100644
--- a/apps/gperf/tests/tao.exp
+++ b/apps/gperf/tests/tao.exp
@@ -1,16 +1,21 @@
in word set _is_a
-in word set _get_stest
-in word set _set_ctest
-in word set _get_ctest
-in word set _set_ltest
-in word set _get_ltest
-in word set _set_wtest
-in word set _get_wtest
-in word set _set_stest
-in word set _get_ldtest
-in word set _set_shtest
-in word set _get_shtest
-in word set _set_ldtest
in word set _non_existent
in word set _interface
-in word set foobarsnaf
+in word set ackConfBasData
+in word set ackConfMosData
+in word set ackConfTwmData
+in word set ackConfArchData
+in word set ackConfVonData
+in word set ackConfFftData
+in word set ackConfSosData
+in word set ackConfSscData
+in word set ackConfCsData
+in word set ackConfR10Data
+in word set ackConfR11Data
+in word set ackConfR12Data
+in word set ackConfR13Data
+in word set ackConfR14Data
+in word set ackConfR15Data
+in word set shutdown
+in word set transferTriggerDb
+in word set transferTriggerTdc
diff --git a/apps/gperf/tests/tao.gperf b/apps/gperf/tests/tao.gperf
index 4756e4db4f4..40058ccba0b 100644
--- a/apps/gperf/tests/tao.gperf
+++ b/apps/gperf/tests/tao.gperf
@@ -1,16 +1,21 @@
_is_a
-_get_stest
-_set_ctest
-_get_ctest
-_set_ltest
-_get_ltest
-_set_wtest
-_get_wtest
-_set_stest
-_get_ldtest
-_set_shtest
-_get_shtest
-_set_ldtest
_non_existent
_interface
-foobarsnaf
+ackConfBasData
+ackConfMosData
+ackConfTwmData
+ackConfArchData
+ackConfVonData
+ackConfFftData
+ackConfSosData
+ackConfSscData
+ackConfCsData
+ackConfR10Data
+ackConfR11Data
+ackConfR12Data
+ackConfR13Data
+ackConfR14Data
+ackConfR15Data
+shutdown
+transferTriggerDb
+transferTriggerTdc
diff --git a/apps/gperf/tests/test-1.exp b/apps/gperf/tests/test-1.exp
index 46fcc4e57d0..b0d815f52f0 100644
--- a/apps/gperf/tests/test-1.exp
+++ b/apps/gperf/tests/test-1.exp
@@ -11,6 +11,7 @@ struct resword { const char *name; short token; enum rid rid; };
#define MAX_HASH_VALUE 82
#define HASH_VALUE_RANGE 75
#define DUPLICATES 0
+#define WORDLIST_SIZE 59
static unsigned int
hash (str, len)
diff --git a/apps/gperf/tests/test-2.exp b/apps/gperf/tests/test-2.exp
index d4e765f1c6d..52ed9e9fbf4 100644
--- a/apps/gperf/tests/test-2.exp
+++ b/apps/gperf/tests/test-2.exp
@@ -9,6 +9,7 @@
#define MAX_HASH_VALUE 256
#define HASH_VALUE_RANGE 256
#define DUPLICATES 0
+#define WORDLIST_SIZE 41
static unsigned int
hash (str, len)
diff --git a/apps/gperf/tests/test-3.exp b/apps/gperf/tests/test-3.exp
index 9ad750df816..7762cd131ba 100644
--- a/apps/gperf/tests/test-3.exp
+++ b/apps/gperf/tests/test-3.exp
@@ -11,6 +11,7 @@ struct resword { const char *name; short token; enum rid rid;};
#define MAX_HASH_VALUE 147
#define HASH_VALUE_RANGE 144
#define DUPLICATES 0
+#define WORDLIST_SIZE 75
inline
static unsigned int
diff --git a/apps/gperf/tests/test-4.exp b/apps/gperf/tests/test-4.exp
index bc4854f86ea..1ba3701042f 100644
--- a/apps/gperf/tests/test-4.exp
+++ b/apps/gperf/tests/test-4.exp
@@ -11,6 +11,7 @@ struct resword { const char *name; short token; enum rid rid; };
#define MAX_HASH_VALUE 82
#define HASH_VALUE_RANGE 79
#define DUPLICATES 3
+#define WORDLIST_SIZE 55
static unsigned int
hash (str, len)
@@ -144,7 +145,7 @@ in_word_set (str, len)
{
int slot = lookup[key];
- if (slot >= 0 && slot <= MAX_HASH_VALUE)
+ if (slot >= 0 && slot < WORDLIST_SIZE)
{
char *s = wordlist[slot].name;
diff --git a/apps/gperf/tests/test-5.exp b/apps/gperf/tests/test-5.exp
index 5e7156350bb..3b8103dbc68 100644
--- a/apps/gperf/tests/test-5.exp
+++ b/apps/gperf/tests/test-5.exp
@@ -19,6 +19,7 @@ struct resword { const char *name; short token; short iclass;};
#define MAX_HASH_VALUE 43
#define HASH_VALUE_RANGE 42
#define DUPLICATES 0
+#define WORDLIST_SIZE 37
inline
static unsigned int