1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 13:09:22 +00:00

Remove trace facility. Use a debugger instead.

This commit is contained in:
Bruno Haible
2002-10-15 14:25:50 +00:00
parent 7278ae8eda
commit 94f436fe9d
20 changed files with 48 additions and 233 deletions

View File

@@ -1,5 +1,22 @@
2002-10-03 Bruno Haible <bruno@clisp.org>
* src/trace.h: Remove file.
* src/trace.cc: Remove file.
* src/Makefile.in (OBJECTS): Remove trace.o.
(TRACE_H): Remove variable.
(trace.o): Remove rule.
Update all dependencies.
* src/bool-array.h, src/bool-array.cc, src/bool-array.icc: Don't use T.
* src/gen-perf.cc: Likewise.
* src/hash-table.cc: Likewise.
* src/iterator.cc: Likewise.
* src/key-list.cc: Likewise.
* src/list-node.cc: Likewise.
* src/main.cc: Likewise.
* src/new.cc: Likewise.
* src/options.h, src/options.cc, src/options.icc: Likewise.
* src/read-line.h, src/read-line.cc, src/read-line.icc: Likewise.
* tests/Makefile.in: Use gperf option -I, to avoid gcc-3.x warnings.
* tests/test.c: Don't use gets(), to avoid warnings.

View File

@@ -1,6 +1,6 @@
# Makefile for gperf/src
# Copyright (C) 1989, 1992, 1993, 1998, 2000 Free Software Foundation, Inc.
# Copyright (C) 1989, 1992, 1993, 1998, 2000, 2002 Free Software Foundation, Inc.
# written by Douglas C. Schmidt (schmidt@ics.uci.edu)
#
# This file is part of GNU GPERF.
@@ -60,7 +60,7 @@ SHELL = /bin/sh
VPATH = $(srcdir)
OBJECTS = new.o options.o iterator.o main.o gen-perf.o key-list.o list-node.o \
hash-table.o bool-array.o read-line.o trace.o vectors.o version.o
hash-table.o bool-array.o read-line.o vectors.o version.o
LIBS = ../lib/libgp.a @GPERF_LIBM@
CPPFLAGS = -I. -I$(srcdir)/../lib
@@ -84,38 +84,35 @@ $(TARGETPROG): $(OBJECTS)
CONFIG_H = config.h
VERSION_H = version.h
VECTORS_H = vectors.h
TRACE_H = trace.h
READ_LINE_H = read-line.h read-line.icc $(TRACE_H)
OPTIONS_H = options.h options.icc $(TRACE_H)
READ_LINE_H = read-line.h read-line.icc
OPTIONS_H = options.h options.icc
LIST_NODE_H = list-node.h $(VECTORS_H)
KEY_LIST_H = key-list.h $(LIST_NODE_H) $(VECTORS_H) $(READ_LINE_H)
ITERATOR_H = iterator.h
HASH_TABLE_H = hash-table.h $(LIST_NODE_H)
BOOL_ARRAY_H = bool-array.h bool-array.icc $(TRACE_H) $(OPTIONS_H)
BOOL_ARRAY_H = bool-array.h bool-array.icc $(OPTIONS_H)
GEN_PERF_H = gen-perf.h $(KEY_LIST_H) $(BOOL_ARRAY_H)
bool-array.o : bool-array.cc $(BOOL_ARRAY_H) $(OPTIONS_H) $(TRACE_H)
bool-array.o : bool-array.cc $(BOOL_ARRAY_H) $(OPTIONS_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/bool-array.cc
gen-perf.o : gen-perf.cc $(GEN_PERF_H) $(OPTIONS_H) $(TRACE_H)
gen-perf.o : gen-perf.cc $(GEN_PERF_H) $(OPTIONS_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/gen-perf.cc
hash-table.o : hash-table.cc $(HASH_TABLE_H) $(OPTIONS_H) $(TRACE_H)
hash-table.o : hash-table.cc $(HASH_TABLE_H) $(OPTIONS_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/hash-table.cc
iterator.o : iterator.cc $(ITERATOR_H) $(TRACE_H)
iterator.o : iterator.cc $(ITERATOR_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/iterator.cc
key-list.o : key-list.cc $(KEY_LIST_H) $(OPTIONS_H) $(READ_LINE_H) $(HASH_TABLE_H) $(TRACE_H) $(VERSION_H)
key-list.o : key-list.cc $(KEY_LIST_H) $(OPTIONS_H) $(READ_LINE_H) $(HASH_TABLE_H) $(VERSION_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/key-list.cc
list-node.o : list-node.cc $(LIST_NODE_H) $(OPTIONS_H) $(TRACE_H)
list-node.o : list-node.cc $(LIST_NODE_H) $(OPTIONS_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/list-node.cc
main.o : main.cc $(OPTIONS_H) $(GEN_PERF_H) $(TRACE_H) $(CONFIG_H)
main.o : main.cc $(OPTIONS_H) $(GEN_PERF_H) $(CONFIG_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/main.cc
new.o : new.cc $(TRACE_H) $(CONFIG_H)
new.o : new.cc $(CONFIG_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/new.cc
options.o : options.cc $(OPTIONS_H) $(ITERATOR_H) $(TRACE_H) $(VECTORS_H) $(VERSION_H)
options.o : options.cc $(OPTIONS_H) $(ITERATOR_H) $(VECTORS_H) $(VERSION_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/options.cc
read-line.o : read-line.cc $(READ_LINE_H) $(OPTIONS_H) $(TRACE_H)
read-line.o : read-line.cc $(READ_LINE_H) $(OPTIONS_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/read-line.cc
trace.o : trace.cc $(TRACE_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/trace.cc
vectors.o : vectors.cc $(VECTORS_H)
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/vectors.cc
version.o : version.cc $(VERSION_H)

View File

@@ -1,5 +1,5 @@
/* Fast lookup table abstraction implemented as an Iteration Number Array
Copyright (C) 1989-1998 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -23,7 +23,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <stdio.h>
#include <string.h>
#include "options.h"
#include "trace.h"
STORAGE_TYPE * Bool_Array::storage_array;
STORAGE_TYPE Bool_Array::iteration_number;
@@ -33,7 +32,6 @@ unsigned int Bool_Array::size;
Bool_Array::~Bool_Array (void)
{
T (Trace t ("Bool_Array::~Bool_Array");)
if (option[DEBUG])
fprintf (stderr, "\ndumping boolean array information\n"
"size = %d\niteration number = %d\nend of array dump\n",

View File

@@ -2,7 +2,7 @@
/* Simple lookup table abstraction implemented as an Iteration Number Array.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -27,8 +27,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifndef bool_array_h
#define bool_array_h 1
#include "trace.h"
#ifdef LO_CAL
/* If we are on a memory diet then we'll only make these use a limited
amount of storage space. */

View File

@@ -1,6 +1,6 @@
/* Inline Functions for bool-array.{h,cc}.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -23,12 +23,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
//#include <stdio.h>
//#include <string.h>
//#include "options.h"
//#include "trace.h"
INLINE
Bool_Array::Bool_Array (void)
{
T (Trace t ("Bool_Array::Bool_Array");)
storage_array = 0;
iteration_number = size = 0;
}
@@ -36,7 +34,6 @@ Bool_Array::Bool_Array (void)
INLINE void
Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
{
T (Trace t ("Bool_Array::init");)
size = s;
iteration_number = 1;
storage_array = buffer;
@@ -49,7 +46,6 @@ Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
INLINE int
Bool_Array::find (int index)
{
T (Trace t ("Bool_Array::find");)
if (storage_array[index] == iteration_number)
return 1;
else
@@ -62,7 +58,6 @@ Bool_Array::find (int index)
INLINE void
Bool_Array::reset (void)
{
T (Trace t ("Bool_Array::reset");)
/* If we wrap around it's time to zero things out again! However, this only
occurs once about every 2^31 or 2^15 iterations, so it should probably
never happen! */

View File

@@ -1,6 +1,6 @@
/* Provides high-level routines to manipulate the keywork list
structures the code generation output.
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -24,7 +24,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <time.h> /* declares time() */
#include "options.h"
#include "gen-perf.h"
#include "trace.h"
/* Efficiently returns the least power of two greater than or equal to X! */
#define POW(X) ((!X)?1:(X-=1,X|=X>>1,X|=X>>2,X|=X>>4,X|=X>>8,X|=X>>16,(++X)))
@@ -37,7 +36,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
Gen_Perf::Gen_Perf (void)
{
T (Trace t ("Gen_Perf::Gen_Perf");)
int asso_value_max;
int non_linked_length;
@@ -88,7 +86,6 @@ Gen_Perf::Gen_Perf (void)
inline int
Gen_Perf::compute_disjoint_union (const char *set_1, int size_1, const char *set_2, int size_2, char *set_3)
{
T (Trace t ("Gen_Perf::compute_disjoint_union");)
char *base = set_3;
while (size_1 > 0 && size_2 > 0)
@@ -131,7 +128,6 @@ Gen_Perf::compute_disjoint_union (const char *set_1, int size_1, const char *se
inline void
Gen_Perf::sort_set (char *union_set, int len)
{
T (Trace t ("Gen_Perf::sort_set");)
int i, j;
for (i = 0, j = len - 1; i < j; i++)
@@ -153,7 +149,6 @@ Gen_Perf::sort_set (char *union_set, int len)
inline int
Gen_Perf::hash (List_Node *key_node)
{
T (Trace t ("Gen_Perf::hash");)
int sum = option[NOLENGTH] ? 0 : key_node->key_length;
const char *p = key_node->char_set;
@@ -173,7 +168,6 @@ Gen_Perf::hash (List_Node *key_node)
inline int
Gen_Perf::affects_prev (char c, List_Node *curr)
{
T (Trace t ("Gen_Perf::affects_prev");)
int original_char = asso_values[(unsigned char)c];
int total_iterations = !option[FAST]
? option.get_asso_max () : option.get_iterations () ? option.get_iterations () : keyword_list_length ();
@@ -217,7 +211,6 @@ Gen_Perf::affects_prev (char c, List_Node *curr)
void
Gen_Perf::change (List_Node *prior, List_Node *curr)
{
T (Trace t ("Gen_Perf::change");)
static char *union_set;
int union_set_length;
@@ -281,7 +274,6 @@ Gen_Perf::change (List_Node *prior, List_Node *curr)
int
Gen_Perf::operator() (void)
{
T (Trace t ("Gen_Perf::operator()");)
#if LARGE_STACK_ARRAYS
STORAGE_TYPE buffer[max_hash_value + 1];
#else
@@ -342,7 +334,6 @@ Gen_Perf::operator() (void)
Gen_Perf::~Gen_Perf (void)
{
T (Trace t ("Gen_Perf::~Gen_Perf");)
if (option[DEBUG])
{
fprintf (stderr, "\ndumping occurrence and associated values tables\n");

View File

@@ -1,5 +1,5 @@
/* Hash table for checking keyword links. Implemented using double hashing.
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -24,7 +24,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <string.h> /* declares memset(), strcmp() */
#include <hash.h>
#include "options.h"
#include "trace.h"
/* The size of the hash table is always the smallest power of 2 >= the size
indicated by the user. This allows several optimizations, including
@@ -38,13 +37,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
Hash_Table::Hash_Table (List_Node **table_ptr, int s, int ignore_len):
table (table_ptr), size (s), collisions (0), ignore_length (ignore_len)
{
T (Trace t ("Hash_Table::Hash_Table");)
memset ((char *) table, 0, size * sizeof (*table));
}
Hash_Table::~Hash_Table (void)
{
T (Trace t ("Hash_Table::~Hash_Table");)
if (option[DEBUG])
{
int field_width = option.get_max_keysig_size ();
@@ -74,7 +71,6 @@ Hash_Table::~Hash_Table (void)
List_Node *
Hash_Table::insert (List_Node *item)
{
T (Trace t ("Hash_Table::operator()");)
unsigned hash_val = hashpjw (item->char_set, item->char_set_length);
int probe = hash_val & (size - 1);
int increment = ((hash_val ^ item->key_length) | 1) & (size - 1);

View File

@@ -1,5 +1,5 @@
/* Provides an Iterator for keyword characters.
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -21,13 +21,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "iterator.h"
#include <ctype.h>
#include "trace.h"
/* Constructor for Iterator. */
Iterator::Iterator (const char *s, int lo, int hi, int word_end, int bad_val, int key_end)
{
T (Trace t ("Iterator::Iterator");)
end = key_end;
error_value = bad_val;
end_word = word_end;
@@ -42,7 +40,6 @@ Iterator::Iterator (const char *s, int lo, int hi, int word_end, int bad_val, in
int
Iterator::operator() (void)
{
T (Trace t ("Iterator::operator()");)
/* Variables to record the Iterator's status when handling ranges, e.g., 3-12. */
static int size;

View File

@@ -1,5 +1,5 @@
/* Routines for building, ordering, and printing the keyword list.
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -28,7 +28,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "read-line.h"
#include "hash-table.h"
#include "key-list.h"
#include "trace.h"
#include "version.h"
/* Make the hash table 8 times larger than the number of keyword entries. */
@@ -43,7 +42,6 @@ int Key_List::determined[MAX_ALPHA_SIZE];
Key_List::~Key_List (void)
{
T (Trace t ("Key_List::~Key_List");)
if (option[DEBUG])
{
fprintf (stderr, "\nDumping key list information:\ntotal non-static linked keywords = %d"
@@ -71,7 +69,6 @@ Key_List::~Key_List (void)
const char *
Key_List::get_special_input (char delimiter)
{
T (Trace t ("Key_List::get_special_input");)
int size = 80;
char *buf = new char[size];
int c, i;
@@ -119,7 +116,6 @@ Key_List::get_special_input (char delimiter)
const char *
Key_List::save_include_src (void)
{
T (Trace t ("Key_List::save_include_src");)
int c;
if ((c = getchar ()) != '%')
@@ -141,7 +137,6 @@ Key_List::save_include_src (void)
const char *
Key_List::get_array_type (void)
{
T (Trace t ("Key_List::get_array_type");)
return get_special_input ('%');
}
@@ -153,7 +148,6 @@ Key_List::get_array_type (void)
inline int
Key_List::strcspn (const char *s, const char *reject)
{
T (Trace t ("Key_List::strcspn");)
const char *scan;
const char *rej_scan;
int count = 0;
@@ -178,7 +172,6 @@ Key_List::strcspn (const char *s, const char *reject)
void
Key_List::set_output_types (void)
{
T (Trace t ("Key_List::set_output_types");)
if (option[TYPE])
{
array_type = get_array_type ();
@@ -355,7 +348,6 @@ parse_line (const char *line, const char *delimiters)
void
Key_List::read_keys (void)
{
T (Trace t ("Key_List::read_keys");)
char *ptr;
include_src = save_include_src ();
@@ -482,7 +474,6 @@ Key_List::read_keys (void)
List_Node *
Key_List::merge (List_Node *list1, List_Node *list2)
{
T (Trace t ("Key_List::merge");)
List_Node *result;
List_Node **resultp = &result;
for (;;)
@@ -518,7 +509,6 @@ Key_List::merge (List_Node *list1, List_Node *list2)
List_Node *
Key_List::merge_sort (List_Node *head)
{
T (Trace t ("Key_List::merge_sort");)
if (!head || !head->next)
return head;
else
@@ -545,7 +535,6 @@ Key_List::merge_sort (List_Node *head)
inline int
Key_List::get_occurrence (List_Node *ptr)
{
T (Trace t ("Key_List::get_occurrence");)
int value = 0;
const char *p = ptr->char_set;
@@ -562,8 +551,6 @@ Key_List::get_occurrence (List_Node *ptr)
inline void
Key_List::set_determined (List_Node *ptr)
{
T (Trace t ("Key_List::set_determined");)
const char *p = ptr->char_set;
unsigned int i = ptr->char_set_length;
for (; i > 0; p++, i--)
@@ -575,7 +562,6 @@ Key_List::set_determined (List_Node *ptr)
inline int
Key_List::already_determined (List_Node *ptr)
{
T (Trace t ("Key_List::already_determined");)
int is_determined = 1;
const char *p = ptr->char_set;
@@ -595,7 +581,6 @@ Key_List::already_determined (List_Node *ptr)
void
Key_List::reorder (void)
{
T (Trace t ("Key_List::reorder");)
List_Node *ptr;
for (ptr = head; ptr; ptr = ptr->next)
ptr->occurrence = get_occurrence (ptr);
@@ -675,7 +660,6 @@ static const char *char_to_index;
void
Key_List::compute_min_max (void)
{
T (Trace t ("Key_List::compute_min_max");)
List_Node *temp;
for (temp = head; temp->next; temp = temp->next)
;
@@ -691,7 +675,6 @@ Key_List::compute_min_max (void)
int
Key_List::num_hash_values (void)
{
T (Trace t ("Key_List::num_hash_values");)
int count = 1;
List_Node *temp;
int value;
@@ -734,19 +717,16 @@ struct Output_Defines : public Output_Constants
void Output_Defines::output_start ()
{
T (Trace t ("Output_Defines::output_start");)
printf ("\n");
}
void Output_Defines::output_item (const char *name, int value)
{
T (Trace t ("Output_Defines::output_item");)
printf ("#define %s %d\n", name, value);
}
void Output_Defines::output_end ()
{
T (Trace t ("Output_Defines::output_end");)
}
/* This class outputs an enumeration using `enum'. */
@@ -765,7 +745,6 @@ private:
void Output_Enum::output_start ()
{
T (Trace t ("Output_Enum::output_start");)
printf ("%senum\n"
"%s {\n",
indentation, indentation);
@@ -774,7 +753,6 @@ void Output_Enum::output_start ()
void Output_Enum::output_item (const char *name, int value)
{
T (Trace t ("Output_Enum::output_item");)
if (pending_comma)
printf (",\n");
printf ("%s %s = %d", indentation, name, value);
@@ -783,7 +761,6 @@ void Output_Enum::output_item (const char *name, int value)
void Output_Enum::output_end ()
{
T (Trace t ("Output_Enum::output_end");)
if (pending_comma)
printf ("\n");
printf ("%s };\n\n", indentation);
@@ -794,8 +771,6 @@ void Output_Enum::output_end ()
void
Key_List::output_constants (struct Output_Constants& style)
{
T (Trace t ("Key_List::output_constants");)
style.output_start ();
style.output_item ("TOTAL_KEYWORDS", total_keys);
style.output_item ("MIN_WORD_LENGTH", min_key_len);
@@ -813,8 +788,6 @@ Key_List::output_constants (struct Output_Constants& style)
static void
output_string (const char *key, int len)
{
T (Trace t ("output_string");)
putchar ('"');
for (; len > 0; len--)
{
@@ -878,7 +851,6 @@ private:
void Output_Expr1::output_expr () const
{
T (Trace t ("Output_Expr1::output_expr");)
printf ("%s", p1);
}
@@ -900,7 +872,6 @@ private:
void Output_Expr2::output_expr () const
{
T (Trace t ("Output_Expr2::output_expr");)
printf ("%s%s", p1, p2);
}
@@ -931,7 +902,6 @@ struct Output_Compare_Strcmp : public Output_Compare
void Output_Compare_Strcmp::output_comparison (const Output_Expr& expr1,
const Output_Expr& expr2) const
{
T (Trace t ("Output_Compare_Strcmp::output_comparison");)
printf ("*");
expr1.output_expr ();
printf (" == *");
@@ -958,7 +928,6 @@ struct Output_Compare_Strncmp : public Output_Compare
void Output_Compare_Strncmp::output_comparison (const Output_Expr& expr1,
const Output_Expr& expr2) const
{
T (Trace t ("Output_Compare_Strncmp::output_comparison");)
printf ("*");
expr1.output_expr ();
printf (" == *");
@@ -988,7 +957,6 @@ struct Output_Compare_Memcmp : public Output_Compare
void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1,
const Output_Expr& expr2) const
{
T (Trace t ("Output_Compare_Memcmp::output_comparison");)
printf ("*");
expr1.output_expr ();
printf (" == *");
@@ -1008,7 +976,6 @@ void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1,
void
Key_List::output_hash_function (void)
{
T (Trace t ("Key_List::output_hash_function");)
const int max_column = 10;
int field_width;
@@ -1177,7 +1144,6 @@ Key_List::output_hash_function (void)
void
Key_List::output_keylength_table (void)
{
T (Trace t ("Key_List::output_keylength_table");)
const int columns = 14;
int index;
int column;
@@ -1298,7 +1264,6 @@ output_keyword_blank_entries (int count, const char *indent)
void
Key_List::output_keyword_table (void)
{
T (Trace t ("Key_List::output_keyword_table");)
const char *indent = option[GLOBAL] ? "" : " ";
int index;
List_Node *temp;
@@ -1360,7 +1325,6 @@ Key_List::output_keyword_table (void)
void
Key_List::output_lookup_array (void)
{
T (Trace t ("Key_List::output_lookup_array");)
if (option[DUP])
{
const int DEFAULT_VALUE = -1;
@@ -1536,8 +1500,6 @@ Key_List::output_lookup_array (void)
void
Key_List::output_lookup_tables (void)
{
T (Trace t ("Key_List::output_lookup_tables");)
if (option[SWITCH])
{
/* Use the switch in place of lookup table. */
@@ -1563,8 +1525,6 @@ Key_List::output_lookup_tables (void)
static List_Node *
output_switch_case (List_Node *list, int indent, int *jumps_away)
{
T (Trace t ("output_switch_case");)
if (option[DEBUG])
printf ("%*s/* hash value = %4d, keyword = \"%.*s\" */\n",
indent, "", list->hash_value, list->key_length, list->key);
@@ -1635,8 +1595,6 @@ output_switch_case (List_Node *list, int indent, int *jumps_away)
static void
output_switches (List_Node *list, int num_switches, int size, int min_hash_value, int max_hash_value, int indent)
{
T (Trace t ("output_switches");)
if (option[DEBUG])
printf ("%*s/* know %d <= key <= %d, contains %d cases */\n",
indent, "", min_hash_value, max_hash_value, size);
@@ -1724,8 +1682,6 @@ output_switches (List_Node *list, int num_switches, int size, int min_hash_value
void
Key_List::output_lookup_function_body (const Output_Compare& comparison)
{
T (Trace t ("Key_List::output_lookup_function_body");)
printf (" if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)\n"
" {\n"
" register int key = %s (str, len);\n\n",
@@ -1973,8 +1929,6 @@ Key_List::output_lookup_function_body (const Output_Compare& comparison)
void
Key_List::output_lookup_function (void)
{
T (Trace t ("Key_List::output_lookup_function");)
/* Output the function's head. */
if (option[KRC] | option[C] | option[ANSIC])
printf ("#ifdef __GNUC__\n"
@@ -2031,8 +1985,6 @@ Key_List::output_lookup_function (void)
void
Key_List::output (void)
{
T (Trace t ("Key_List::output");)
compute_min_max ();
if (option[C] | option[ANSIC] | option[CPLUSPLUS])
@@ -2123,7 +2075,6 @@ Key_List::output (void)
void
Key_List::sort (void)
{
T (Trace t ("Key_List::sort");)
hash_sort = 1;
occurrence_sort = 0;
@@ -2135,7 +2086,6 @@ Key_List::sort (void)
void
Key_List::dump ()
{
T (Trace t ("Key_List::dump");)
int field_width = option.get_max_keysig_size ();
fprintf (stderr, "\nList contents are:\n(hash value, key length, index, %*s, keyword):\n",
@@ -2152,7 +2102,6 @@ Key_List::dump ()
Key_List::Key_List (void)
{
T (Trace t ("Key_List::Key_List");)
total_keys = 1;
max_key_len = INT_MIN;
min_key_len = INT_MAX;
@@ -2169,7 +2118,6 @@ Key_List::Key_List (void)
int
Key_List::keyword_list_length (void)
{
T (Trace t ("Key_List::keyword_list_length");)
return list_len;
}
@@ -2178,7 +2126,6 @@ Key_List::keyword_list_length (void)
int
Key_List::max_key_length (void)
{
T (Trace t ("Key_List::max_key_length");)
return max_key_len;
}

View File

@@ -1,5 +1,5 @@
/* Creates and initializes a new list node.
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -23,7 +23,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <stdio.h>
#include <stdlib.h> /* declares exit() */
#include "options.h"
#include "trace.h"
/* Sorts the key set alphabetically to speed up subsequent operations.
Uses insertion sort since the set is probably quite small. */
@@ -31,7 +30,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
inline void
List_Node::set_sort (char *base, int len)
{
T (Trace t ("List_Node::set_sort");)
int i, j;
for (i = 0, j = len - 1; i < j; i++)
@@ -60,7 +58,6 @@ List_Node::set_sort (char *base, int len)
List_Node::List_Node (const char *k, int len, const char *r):
link (0), next (0), key (k), key_length (len), rest (r), index (0)
{
T (Trace t ("List_Node::List_Node");)
char *key_set = new char[(option[ALLCHARS] ? len : option.get_max_keysig_size ())];
char *ptr = key_set;
int i;

View File

@@ -1,5 +1,5 @@
/* Driver program for the Gen_Perf hash function generator
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -38,13 +38,10 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <stdio.h>
#include "options.h"
#include "gen-perf.h"
#include "trace.h"
int
main (int argc, char *argv[])
{
T (Trace t ("main");)
#if LARGE_STACK_ARRAYS && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK)
/* Get rid of any avoidable limit on stack size. */
{

View File

@@ -1,6 +1,6 @@
/* Defines a buffered memory allocation abstraction that reduces calls to
malloc.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -22,7 +22,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "config.h"
#include <stdio.h>
#include <stdlib.h> /* declares malloc(), exit() */
#include "trace.h"
/* Determine default alignment. If your C++ compiler does not
like this then try something like #define DEFAULT_ALIGNMENT 8. */
@@ -36,7 +35,6 @@ const int ALIGNMENT = ((char *)&((struct fooalign *) 0)->d - (char *)0);
void *
operator new (size_t size)
{
T (Trace t ("operator new");)
static char *buf_start = 0; /* Large array used to reduce calls to NEW. */
static char *buf_end = 0; /* Indicates end of BUF_START. */
static size_t buf_size = 4096; /* Size of buffer pointed to by BUF_START. */
@@ -80,7 +78,6 @@ operator delete (void *ptr)
throw()
#endif
{
T (Trace t ("operator delete");)
// We cannot call free here, as it doesn't match the mallocs.
// free ((char *) ptr);
(void) ptr;

View File

@@ -1,5 +1,5 @@
/* Handles parsing the Options provided to the user.
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -24,7 +24,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "getopt.h"
#include "options.h"
#include "iterator.h"
#include "trace.h"
#include "vectors.h"
#include "version.h"
@@ -82,7 +81,6 @@ char Options::key_positions[MAX_KEY_POS];
void
Options::short_usage (FILE * strm)
{
T (Trace t ("Options::short_usage");)
fprintf (strm, "Usage: %s [-cCdDef[num]F<initializers>GhH<hashname>i<init>Ijk<keys>K<keyname>lL<language>nN<function name>ors<size>S<switches>tTvW<wordlistname>Z<class name>7] [input-file]\n"
"Try `%s --help' for more information.\n",
program_name, program_name);
@@ -91,7 +89,6 @@ Options::short_usage (FILE * strm)
void
Options::long_usage (FILE * strm)
{
T (Trace t ("Options::long_usage");)
fprintf (strm,
"GNU `gperf' generates perfect hash functions.\n"
"\n"
@@ -223,7 +220,6 @@ Options::long_usage (FILE * strm)
void
Options::print_options (void)
{
T (Trace t ("Options::print_options");)
int i;
printf ("/* Command-line: ");
@@ -285,7 +281,6 @@ Options::print_options (void)
inline int
Options::key_sort (char *base, int len)
{
T (Trace t ("Options::key_sort");)
int i, j;
for (i = 0, j = len - 1; i < j; i++)
@@ -306,7 +301,6 @@ Options::key_sort (char *base, int len)
Options::Options (void)
{
T (Trace t ("Options::Options");)
key_positions[0] = WORD_START;
key_positions[1] = WORD_END;
key_positions[2] = EOS;
@@ -328,7 +322,6 @@ Options::Options (void)
Options::~Options (void)
{
T (Trace t ("Options::~Options");)
if (option_word & DEBUG)
{
char *ptr;
@@ -448,7 +441,6 @@ static const struct option long_options[] =
void
Options::operator() (int argc, char *argv[])
{
T (Trace t ("Options::operator()");)
int option_char;
program_name = argv[0];

View File

@@ -2,7 +2,7 @@
/* Handles parsing the Options provided to the user.
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -149,7 +149,6 @@ extern Options option;
#ifdef __OPTIMIZE__
#include "trace.h"
#define INLINE inline
#include "options.icc"
#undef INLINE

View File

@@ -1,6 +1,6 @@
/* Inline Functions for options.{h,cc}.
Copyright (C) 1989-1998, 2000 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2000, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -19,14 +19,10 @@ 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. */
// This needs:
//#include "trace.h"
/* TRUE if option enable, else FALSE. */
INLINE int
Options::operator[] (Option_Type option)
{
T (Trace t ("Options::operator[]");)
return option_word & option;
}
@@ -34,7 +30,6 @@ Options::operator[] (Option_Type option)
INLINE void
Options::operator = (enum Option_Type opt)
{
T (Trace t ("Options::operator=");)
option_word |= opt;
}
@@ -42,7 +37,6 @@ Options::operator = (enum Option_Type opt)
INLINE void
Options::operator != (enum Option_Type opt)
{
T (Trace t ("Options::operator!=");)
option_word &= ~opt;
}
@@ -50,7 +44,6 @@ Options::operator != (enum Option_Type opt)
INLINE void
Options::reset (void)
{
T (Trace t ("Options::reset");)
key_pos = 0;
}
@@ -58,7 +51,6 @@ Options::reset (void)
INLINE int
Options::get (void)
{
T (Trace t ("Options::get");)
return key_positions[key_pos++];
}
@@ -66,7 +58,6 @@ Options::get (void)
INLINE void
Options::set_asso_max (int r)
{
T (Trace t ("Options::set_asso_max");)
size = r;
}
@@ -74,7 +65,6 @@ Options::set_asso_max (int r)
INLINE int
Options::get_asso_max (void)
{
T (Trace t ("Options::get_asso_max");)
return size;
}
@@ -82,7 +72,6 @@ Options::get_asso_max (void)
INLINE int
Options::get_max_keysig_size (void)
{
T (Trace t ("Options::get_max_keysig_size");)
return total_keysig_size;
}
@@ -90,7 +79,6 @@ Options::get_max_keysig_size (void)
INLINE void
Options::set_keysig_size (int size)
{
T (Trace t ("Options::set_keysig_size");)
total_keysig_size = size;
}
@@ -98,7 +86,6 @@ Options::set_keysig_size (int size)
INLINE int
Options::get_jump (void)
{
T (Trace t ("Options::get_jump");)
return jump;
}
@@ -106,7 +93,6 @@ Options::get_jump (void)
INLINE const char *
Options::get_function_name (void)
{
T (Trace t ("Options::get_function_name");)
return function_name;
}
@@ -114,7 +100,6 @@ Options::get_function_name (void)
INLINE const char *
Options::get_key_name (void)
{
T (Trace t ("Options::get_key_name");)
return key_name;
}
@@ -122,7 +107,6 @@ Options::get_key_name (void)
INLINE const char *
Options::get_initializer_suffix (void)
{
T (Trace t ("Options::get_initializer_suffix");)
return initializer_suffix;
}
@@ -130,7 +114,6 @@ Options::get_initializer_suffix (void)
INLINE const char *
Options::get_hash_name (void)
{
T (Trace t ("Options::get_hash_name");)
return hash_name;
}
@@ -138,7 +121,6 @@ Options::get_hash_name (void)
INLINE const char *
Options::get_wordlist_name (void)
{
T (Trace t ("Options::get_wordlist_name");)
return wordlist_name;
}
@@ -146,7 +128,6 @@ Options::get_wordlist_name (void)
INLINE const char *
Options::get_class_name (void)
{
T (Trace t ("Options::get_class_name");)
return class_name;
}
@@ -154,7 +135,6 @@ Options::get_class_name (void)
INLINE int
Options::initial_value (void)
{
T (Trace t ("Options::initial_value");)
return initial_asso_value;
}
@@ -162,7 +142,6 @@ Options::initial_value (void)
INLINE int
Options::get_iterations (void)
{
T (Trace t ("Options::get_iterations");)
return iterations;
}
@@ -170,7 +149,6 @@ Options::get_iterations (void)
INLINE const char *
Options::get_delimiter ()
{
T (Trace t ("Options::get_delimiter");)
return delimiters;
}
@@ -178,6 +156,5 @@ Options::get_delimiter ()
INLINE int
Options::get_total_switches ()
{
T (Trace t ("Options::get_total_switches");)
return total_switches;
}

View File

@@ -1,6 +1,6 @@
/* Correctly reads an arbitrarily size string.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -24,7 +24,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include <stdlib.h>
#include <string.h> /* declares memcpy() */
#include "options.h"
#include "trace.h"
/* Recursively fills up the buffer. */
@@ -39,7 +38,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
char *
Read_Line::readln_aux (int chunks)
{
T (Trace t ("Read_Line::readln_aux");)
#if LARGE_STACK
char buf[CHUNK_SIZE];
#else

View File

@@ -3,7 +3,7 @@
/* Reads arbitrarily long string from input file, returning it as a
dynamically allocated buffer.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -43,7 +43,6 @@ public:
#ifdef __OPTIMIZE__
#include "trace.h"
#define INLINE inline
#include "read-line.icc"
#undef INLINE

View File

@@ -1,6 +1,6 @@
/* Inline Functions for read-line.{h,cc}.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
Copyright (C) 1989-1998, 2002 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
This file is part of GNU GPERF.
@@ -21,13 +21,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
// This needs:
//#include <stdio.h>
//#include "trace.h"
/* Returns the ``next'' line, ignoring comments beginning with '#'. */
INLINE char *
Read_Line::get_line (void)
{
T (Trace t ("Read_Line::get_line");)
int c;
while ((c = getc (fp)) == '#')

View File

@@ -1,35 +0,0 @@
/* Tracing function calls.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
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. */
#include "trace.h"
#include <stdio.h>
int Trace::nesting = 0;
Trace::Trace (const char *n)
{
fprintf (stderr, "%*scalling %s\n", 3 * nesting++, "", name = n);
}
Trace::~Trace (void)
{
fprintf (stderr, "%*sleaving %s\n", 3 * --nesting, "", name);
}

View File

@@ -1,40 +0,0 @@
/* Tracing function calls.
Copyright (C) 1989-1998 Free Software Foundation, Inc.
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
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 trace_h
#define trace_h 1
#ifdef TRACE
#define T(X) X
#else
#define T(X)
#endif
class Trace
{
private:
static int nesting;
const char *name;
public:
Trace (const char *n);
~Trace (void);
};
#endif