mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 21:19:24 +00:00
Remove trace facility. Use a debugger instead.
This commit is contained in:
17
ChangeLog
17
ChangeLog
@@ -1,5 +1,22 @@
|
|||||||
2002-10-03 Bruno Haible <bruno@clisp.org>
|
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/Makefile.in: Use gperf option -I, to avoid gcc-3.x warnings.
|
||||||
* tests/test.c: Don't use gets(), to avoid warnings.
|
* tests/test.c: Don't use gets(), to avoid warnings.
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# Makefile for gperf/src
|
# 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)
|
# written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
#
|
#
|
||||||
# This file is part of GNU GPERF.
|
# This file is part of GNU GPERF.
|
||||||
@@ -60,7 +60,7 @@ SHELL = /bin/sh
|
|||||||
VPATH = $(srcdir)
|
VPATH = $(srcdir)
|
||||||
|
|
||||||
OBJECTS = new.o options.o iterator.o main.o gen-perf.o key-list.o list-node.o \
|
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@
|
LIBS = ../lib/libgp.a @GPERF_LIBM@
|
||||||
CPPFLAGS = -I. -I$(srcdir)/../lib
|
CPPFLAGS = -I. -I$(srcdir)/../lib
|
||||||
|
|
||||||
@@ -84,38 +84,35 @@ $(TARGETPROG): $(OBJECTS)
|
|||||||
CONFIG_H = config.h
|
CONFIG_H = config.h
|
||||||
VERSION_H = version.h
|
VERSION_H = version.h
|
||||||
VECTORS_H = vectors.h
|
VECTORS_H = vectors.h
|
||||||
TRACE_H = trace.h
|
READ_LINE_H = read-line.h read-line.icc
|
||||||
READ_LINE_H = read-line.h read-line.icc $(TRACE_H)
|
OPTIONS_H = options.h options.icc
|
||||||
OPTIONS_H = options.h options.icc $(TRACE_H)
|
|
||||||
LIST_NODE_H = list-node.h $(VECTORS_H)
|
LIST_NODE_H = list-node.h $(VECTORS_H)
|
||||||
KEY_LIST_H = key-list.h $(LIST_NODE_H) $(VECTORS_H) $(READ_LINE_H)
|
KEY_LIST_H = key-list.h $(LIST_NODE_H) $(VECTORS_H) $(READ_LINE_H)
|
||||||
ITERATOR_H = iterator.h
|
ITERATOR_H = iterator.h
|
||||||
HASH_TABLE_H = hash-table.h $(LIST_NODE_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)
|
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
|
$(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
|
$(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
|
$(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
|
$(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
|
$(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
|
$(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
|
$(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
|
$(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
|
$(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
|
$(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)
|
vectors.o : vectors.cc $(VECTORS_H)
|
||||||
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/vectors.cc
|
$(CXX) $(CXXFLAGS) $(CPPFLAGS) -c $(srcdir)/vectors.cc
|
||||||
version.o : version.cc $(VERSION_H)
|
version.o : version.cc $(VERSION_H)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Fast lookup table abstraction implemented as an Iteration Number Array
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
STORAGE_TYPE * Bool_Array::storage_array;
|
STORAGE_TYPE * Bool_Array::storage_array;
|
||||||
STORAGE_TYPE Bool_Array::iteration_number;
|
STORAGE_TYPE Bool_Array::iteration_number;
|
||||||
@@ -33,7 +32,6 @@ unsigned int Bool_Array::size;
|
|||||||
|
|
||||||
Bool_Array::~Bool_Array (void)
|
Bool_Array::~Bool_Array (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Bool_Array::~Bool_Array");)
|
|
||||||
if (option[DEBUG])
|
if (option[DEBUG])
|
||||||
fprintf (stderr, "\ndumping boolean array information\n"
|
fprintf (stderr, "\ndumping boolean array information\n"
|
||||||
"size = %d\niteration number = %d\nend of array dump\n",
|
"size = %d\niteration number = %d\nend of array dump\n",
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* Simple lookup table abstraction implemented as an Iteration Number Array.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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
|
#ifndef bool_array_h
|
||||||
#define bool_array_h 1
|
#define bool_array_h 1
|
||||||
|
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
#ifdef LO_CAL
|
#ifdef LO_CAL
|
||||||
/* If we are on a memory diet then we'll only make these use a limited
|
/* If we are on a memory diet then we'll only make these use a limited
|
||||||
amount of storage space. */
|
amount of storage space. */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Inline Functions for bool-array.{h,cc}.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 <stdio.h>
|
||||||
//#include <string.h>
|
//#include <string.h>
|
||||||
//#include "options.h"
|
//#include "options.h"
|
||||||
//#include "trace.h"
|
|
||||||
|
|
||||||
INLINE
|
INLINE
|
||||||
Bool_Array::Bool_Array (void)
|
Bool_Array::Bool_Array (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Bool_Array::Bool_Array");)
|
|
||||||
storage_array = 0;
|
storage_array = 0;
|
||||||
iteration_number = size = 0;
|
iteration_number = size = 0;
|
||||||
}
|
}
|
||||||
@@ -36,7 +34,6 @@ Bool_Array::Bool_Array (void)
|
|||||||
INLINE void
|
INLINE void
|
||||||
Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
|
Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
|
||||||
{
|
{
|
||||||
T (Trace t ("Bool_Array::init");)
|
|
||||||
size = s;
|
size = s;
|
||||||
iteration_number = 1;
|
iteration_number = 1;
|
||||||
storage_array = buffer;
|
storage_array = buffer;
|
||||||
@@ -49,7 +46,6 @@ Bool_Array::init (STORAGE_TYPE *buffer, unsigned int s)
|
|||||||
INLINE int
|
INLINE int
|
||||||
Bool_Array::find (int index)
|
Bool_Array::find (int index)
|
||||||
{
|
{
|
||||||
T (Trace t ("Bool_Array::find");)
|
|
||||||
if (storage_array[index] == iteration_number)
|
if (storage_array[index] == iteration_number)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
@@ -62,7 +58,6 @@ Bool_Array::find (int index)
|
|||||||
INLINE void
|
INLINE void
|
||||||
Bool_Array::reset (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
|
/* 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
|
occurs once about every 2^31 or 2^15 iterations, so it should probably
|
||||||
never happen! */
|
never happen! */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Provides high-level routines to manipulate the keywork list
|
/* Provides high-level routines to manipulate the keywork list
|
||||||
structures the code generation output.
|
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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 <time.h> /* declares time() */
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "gen-perf.h"
|
#include "gen-perf.h"
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
/* Efficiently returns the least power of two greater than or equal to X! */
|
/* 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)))
|
#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)
|
Gen_Perf::Gen_Perf (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Gen_Perf::Gen_Perf");)
|
|
||||||
int asso_value_max;
|
int asso_value_max;
|
||||||
int non_linked_length;
|
int non_linked_length;
|
||||||
|
|
||||||
@@ -88,7 +86,6 @@ Gen_Perf::Gen_Perf (void)
|
|||||||
inline int
|
inline int
|
||||||
Gen_Perf::compute_disjoint_union (const char *set_1, int size_1, const char *set_2, int size_2, char *set_3)
|
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;
|
char *base = set_3;
|
||||||
|
|
||||||
while (size_1 > 0 && size_2 > 0)
|
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
|
inline void
|
||||||
Gen_Perf::sort_set (char *union_set, int len)
|
Gen_Perf::sort_set (char *union_set, int len)
|
||||||
{
|
{
|
||||||
T (Trace t ("Gen_Perf::sort_set");)
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0, j = len - 1; i < j; i++)
|
for (i = 0, j = len - 1; i < j; i++)
|
||||||
@@ -153,7 +149,6 @@ Gen_Perf::sort_set (char *union_set, int len)
|
|||||||
inline int
|
inline int
|
||||||
Gen_Perf::hash (List_Node *key_node)
|
Gen_Perf::hash (List_Node *key_node)
|
||||||
{
|
{
|
||||||
T (Trace t ("Gen_Perf::hash");)
|
|
||||||
int sum = option[NOLENGTH] ? 0 : key_node->key_length;
|
int sum = option[NOLENGTH] ? 0 : key_node->key_length;
|
||||||
|
|
||||||
const char *p = key_node->char_set;
|
const char *p = key_node->char_set;
|
||||||
@@ -173,7 +168,6 @@ Gen_Perf::hash (List_Node *key_node)
|
|||||||
inline int
|
inline int
|
||||||
Gen_Perf::affects_prev (char c, List_Node *curr)
|
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 original_char = asso_values[(unsigned char)c];
|
||||||
int total_iterations = !option[FAST]
|
int total_iterations = !option[FAST]
|
||||||
? option.get_asso_max () : option.get_iterations () ? option.get_iterations () : keyword_list_length ();
|
? 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
|
void
|
||||||
Gen_Perf::change (List_Node *prior, List_Node *curr)
|
Gen_Perf::change (List_Node *prior, List_Node *curr)
|
||||||
{
|
{
|
||||||
T (Trace t ("Gen_Perf::change");)
|
|
||||||
static char *union_set;
|
static char *union_set;
|
||||||
int union_set_length;
|
int union_set_length;
|
||||||
|
|
||||||
@@ -281,7 +274,6 @@ Gen_Perf::change (List_Node *prior, List_Node *curr)
|
|||||||
int
|
int
|
||||||
Gen_Perf::operator() (void)
|
Gen_Perf::operator() (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Gen_Perf::operator()");)
|
|
||||||
#if LARGE_STACK_ARRAYS
|
#if LARGE_STACK_ARRAYS
|
||||||
STORAGE_TYPE buffer[max_hash_value + 1];
|
STORAGE_TYPE buffer[max_hash_value + 1];
|
||||||
#else
|
#else
|
||||||
@@ -342,7 +334,6 @@ Gen_Perf::operator() (void)
|
|||||||
|
|
||||||
Gen_Perf::~Gen_Perf (void)
|
Gen_Perf::~Gen_Perf (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Gen_Perf::~Gen_Perf");)
|
|
||||||
if (option[DEBUG])
|
if (option[DEBUG])
|
||||||
{
|
{
|
||||||
fprintf (stderr, "\ndumping occurrence and associated values tables\n");
|
fprintf (stderr, "\ndumping occurrence and associated values tables\n");
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Hash table for checking keyword links. Implemented using double hashing.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 <string.h> /* declares memset(), strcmp() */
|
||||||
#include <hash.h>
|
#include <hash.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
/* The size of the hash table is always the smallest power of 2 >= the size
|
/* The size of the hash table is always the smallest power of 2 >= the size
|
||||||
indicated by the user. This allows several optimizations, including
|
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):
|
Hash_Table::Hash_Table (List_Node **table_ptr, int s, int ignore_len):
|
||||||
table (table_ptr), size (s), collisions (0), ignore_length (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));
|
memset ((char *) table, 0, size * sizeof (*table));
|
||||||
}
|
}
|
||||||
|
|
||||||
Hash_Table::~Hash_Table (void)
|
Hash_Table::~Hash_Table (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Hash_Table::~Hash_Table");)
|
|
||||||
if (option[DEBUG])
|
if (option[DEBUG])
|
||||||
{
|
{
|
||||||
int field_width = option.get_max_keysig_size ();
|
int field_width = option.get_max_keysig_size ();
|
||||||
@@ -74,7 +71,6 @@ Hash_Table::~Hash_Table (void)
|
|||||||
List_Node *
|
List_Node *
|
||||||
Hash_Table::insert (List_Node *item)
|
Hash_Table::insert (List_Node *item)
|
||||||
{
|
{
|
||||||
T (Trace t ("Hash_Table::operator()");)
|
|
||||||
unsigned hash_val = hashpjw (item->char_set, item->char_set_length);
|
unsigned hash_val = hashpjw (item->char_set, item->char_set_length);
|
||||||
int probe = hash_val & (size - 1);
|
int probe = hash_val & (size - 1);
|
||||||
int increment = ((hash_val ^ item->key_length) | 1) & (size - 1);
|
int increment = ((hash_val ^ item->key_length) | 1) & (size - 1);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Provides an Iterator for keyword characters.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 "iterator.h"
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
/* Constructor for Iterator. */
|
/* Constructor for Iterator. */
|
||||||
|
|
||||||
Iterator::Iterator (const char *s, int lo, int hi, int word_end, int bad_val, int key_end)
|
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;
|
end = key_end;
|
||||||
error_value = bad_val;
|
error_value = bad_val;
|
||||||
end_word = word_end;
|
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
|
int
|
||||||
Iterator::operator() (void)
|
Iterator::operator() (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Iterator::operator()");)
|
|
||||||
/* Variables to record the Iterator's status when handling ranges, e.g., 3-12. */
|
/* Variables to record the Iterator's status when handling ranges, e.g., 3-12. */
|
||||||
|
|
||||||
static int size;
|
static int size;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Routines for building, ordering, and printing the keyword list.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 "read-line.h"
|
||||||
#include "hash-table.h"
|
#include "hash-table.h"
|
||||||
#include "key-list.h"
|
#include "key-list.h"
|
||||||
#include "trace.h"
|
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
/* Make the hash table 8 times larger than the number of keyword entries. */
|
/* 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)
|
Key_List::~Key_List (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::~Key_List");)
|
|
||||||
if (option[DEBUG])
|
if (option[DEBUG])
|
||||||
{
|
{
|
||||||
fprintf (stderr, "\nDumping key list information:\ntotal non-static linked keywords = %d"
|
fprintf (stderr, "\nDumping key list information:\ntotal non-static linked keywords = %d"
|
||||||
@@ -71,7 +69,6 @@ Key_List::~Key_List (void)
|
|||||||
const char *
|
const char *
|
||||||
Key_List::get_special_input (char delimiter)
|
Key_List::get_special_input (char delimiter)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::get_special_input");)
|
|
||||||
int size = 80;
|
int size = 80;
|
||||||
char *buf = new char[size];
|
char *buf = new char[size];
|
||||||
int c, i;
|
int c, i;
|
||||||
@@ -119,7 +116,6 @@ Key_List::get_special_input (char delimiter)
|
|||||||
const char *
|
const char *
|
||||||
Key_List::save_include_src (void)
|
Key_List::save_include_src (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::save_include_src");)
|
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
if ((c = getchar ()) != '%')
|
if ((c = getchar ()) != '%')
|
||||||
@@ -141,7 +137,6 @@ Key_List::save_include_src (void)
|
|||||||
const char *
|
const char *
|
||||||
Key_List::get_array_type (void)
|
Key_List::get_array_type (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::get_array_type");)
|
|
||||||
return get_special_input ('%');
|
return get_special_input ('%');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -153,7 +148,6 @@ Key_List::get_array_type (void)
|
|||||||
inline int
|
inline int
|
||||||
Key_List::strcspn (const char *s, const char *reject)
|
Key_List::strcspn (const char *s, const char *reject)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::strcspn");)
|
|
||||||
const char *scan;
|
const char *scan;
|
||||||
const char *rej_scan;
|
const char *rej_scan;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
@@ -178,7 +172,6 @@ Key_List::strcspn (const char *s, const char *reject)
|
|||||||
void
|
void
|
||||||
Key_List::set_output_types (void)
|
Key_List::set_output_types (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::set_output_types");)
|
|
||||||
if (option[TYPE])
|
if (option[TYPE])
|
||||||
{
|
{
|
||||||
array_type = get_array_type ();
|
array_type = get_array_type ();
|
||||||
@@ -355,7 +348,6 @@ parse_line (const char *line, const char *delimiters)
|
|||||||
void
|
void
|
||||||
Key_List::read_keys (void)
|
Key_List::read_keys (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::read_keys");)
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
|
||||||
include_src = save_include_src ();
|
include_src = save_include_src ();
|
||||||
@@ -482,7 +474,6 @@ Key_List::read_keys (void)
|
|||||||
List_Node *
|
List_Node *
|
||||||
Key_List::merge (List_Node *list1, List_Node *list2)
|
Key_List::merge (List_Node *list1, List_Node *list2)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::merge");)
|
|
||||||
List_Node *result;
|
List_Node *result;
|
||||||
List_Node **resultp = &result;
|
List_Node **resultp = &result;
|
||||||
for (;;)
|
for (;;)
|
||||||
@@ -518,7 +509,6 @@ Key_List::merge (List_Node *list1, List_Node *list2)
|
|||||||
List_Node *
|
List_Node *
|
||||||
Key_List::merge_sort (List_Node *head)
|
Key_List::merge_sort (List_Node *head)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::merge_sort");)
|
|
||||||
if (!head || !head->next)
|
if (!head || !head->next)
|
||||||
return head;
|
return head;
|
||||||
else
|
else
|
||||||
@@ -545,7 +535,6 @@ Key_List::merge_sort (List_Node *head)
|
|||||||
inline int
|
inline int
|
||||||
Key_List::get_occurrence (List_Node *ptr)
|
Key_List::get_occurrence (List_Node *ptr)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::get_occurrence");)
|
|
||||||
int value = 0;
|
int value = 0;
|
||||||
|
|
||||||
const char *p = ptr->char_set;
|
const char *p = ptr->char_set;
|
||||||
@@ -562,8 +551,6 @@ Key_List::get_occurrence (List_Node *ptr)
|
|||||||
inline void
|
inline void
|
||||||
Key_List::set_determined (List_Node *ptr)
|
Key_List::set_determined (List_Node *ptr)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::set_determined");)
|
|
||||||
|
|
||||||
const char *p = ptr->char_set;
|
const char *p = ptr->char_set;
|
||||||
unsigned int i = ptr->char_set_length;
|
unsigned int i = ptr->char_set_length;
|
||||||
for (; i > 0; p++, i--)
|
for (; i > 0; p++, i--)
|
||||||
@@ -575,7 +562,6 @@ Key_List::set_determined (List_Node *ptr)
|
|||||||
inline int
|
inline int
|
||||||
Key_List::already_determined (List_Node *ptr)
|
Key_List::already_determined (List_Node *ptr)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::already_determined");)
|
|
||||||
int is_determined = 1;
|
int is_determined = 1;
|
||||||
|
|
||||||
const char *p = ptr->char_set;
|
const char *p = ptr->char_set;
|
||||||
@@ -595,7 +581,6 @@ Key_List::already_determined (List_Node *ptr)
|
|||||||
void
|
void
|
||||||
Key_List::reorder (void)
|
Key_List::reorder (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::reorder");)
|
|
||||||
List_Node *ptr;
|
List_Node *ptr;
|
||||||
for (ptr = head; ptr; ptr = ptr->next)
|
for (ptr = head; ptr; ptr = ptr->next)
|
||||||
ptr->occurrence = get_occurrence (ptr);
|
ptr->occurrence = get_occurrence (ptr);
|
||||||
@@ -675,7 +660,6 @@ static const char *char_to_index;
|
|||||||
void
|
void
|
||||||
Key_List::compute_min_max (void)
|
Key_List::compute_min_max (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::compute_min_max");)
|
|
||||||
List_Node *temp;
|
List_Node *temp;
|
||||||
for (temp = head; temp->next; temp = temp->next)
|
for (temp = head; temp->next; temp = temp->next)
|
||||||
;
|
;
|
||||||
@@ -691,7 +675,6 @@ Key_List::compute_min_max (void)
|
|||||||
int
|
int
|
||||||
Key_List::num_hash_values (void)
|
Key_List::num_hash_values (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::num_hash_values");)
|
|
||||||
int count = 1;
|
int count = 1;
|
||||||
List_Node *temp;
|
List_Node *temp;
|
||||||
int value;
|
int value;
|
||||||
@@ -734,19 +717,16 @@ struct Output_Defines : public Output_Constants
|
|||||||
|
|
||||||
void Output_Defines::output_start ()
|
void Output_Defines::output_start ()
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Defines::output_start");)
|
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Output_Defines::output_item (const char *name, int value)
|
void Output_Defines::output_item (const char *name, int value)
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Defines::output_item");)
|
|
||||||
printf ("#define %s %d\n", name, value);
|
printf ("#define %s %d\n", name, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Output_Defines::output_end ()
|
void Output_Defines::output_end ()
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Defines::output_end");)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This class outputs an enumeration using `enum'. */
|
/* This class outputs an enumeration using `enum'. */
|
||||||
@@ -765,7 +745,6 @@ private:
|
|||||||
|
|
||||||
void Output_Enum::output_start ()
|
void Output_Enum::output_start ()
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Enum::output_start");)
|
|
||||||
printf ("%senum\n"
|
printf ("%senum\n"
|
||||||
"%s {\n",
|
"%s {\n",
|
||||||
indentation, indentation);
|
indentation, indentation);
|
||||||
@@ -774,7 +753,6 @@ void Output_Enum::output_start ()
|
|||||||
|
|
||||||
void Output_Enum::output_item (const char *name, int value)
|
void Output_Enum::output_item (const char *name, int value)
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Enum::output_item");)
|
|
||||||
if (pending_comma)
|
if (pending_comma)
|
||||||
printf (",\n");
|
printf (",\n");
|
||||||
printf ("%s %s = %d", indentation, name, value);
|
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 ()
|
void Output_Enum::output_end ()
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Enum::output_end");)
|
|
||||||
if (pending_comma)
|
if (pending_comma)
|
||||||
printf ("\n");
|
printf ("\n");
|
||||||
printf ("%s };\n\n", indentation);
|
printf ("%s };\n\n", indentation);
|
||||||
@@ -794,8 +771,6 @@ void Output_Enum::output_end ()
|
|||||||
void
|
void
|
||||||
Key_List::output_constants (struct Output_Constants& style)
|
Key_List::output_constants (struct Output_Constants& style)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::output_constants");)
|
|
||||||
|
|
||||||
style.output_start ();
|
style.output_start ();
|
||||||
style.output_item ("TOTAL_KEYWORDS", total_keys);
|
style.output_item ("TOTAL_KEYWORDS", total_keys);
|
||||||
style.output_item ("MIN_WORD_LENGTH", min_key_len);
|
style.output_item ("MIN_WORD_LENGTH", min_key_len);
|
||||||
@@ -813,8 +788,6 @@ Key_List::output_constants (struct Output_Constants& style)
|
|||||||
static void
|
static void
|
||||||
output_string (const char *key, int len)
|
output_string (const char *key, int len)
|
||||||
{
|
{
|
||||||
T (Trace t ("output_string");)
|
|
||||||
|
|
||||||
putchar ('"');
|
putchar ('"');
|
||||||
for (; len > 0; len--)
|
for (; len > 0; len--)
|
||||||
{
|
{
|
||||||
@@ -878,7 +851,6 @@ private:
|
|||||||
|
|
||||||
void Output_Expr1::output_expr () const
|
void Output_Expr1::output_expr () const
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Expr1::output_expr");)
|
|
||||||
printf ("%s", p1);
|
printf ("%s", p1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -900,7 +872,6 @@ private:
|
|||||||
|
|
||||||
void Output_Expr2::output_expr () const
|
void Output_Expr2::output_expr () const
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Expr2::output_expr");)
|
|
||||||
printf ("%s%s", p1, p2);
|
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,
|
void Output_Compare_Strcmp::output_comparison (const Output_Expr& expr1,
|
||||||
const Output_Expr& expr2) const
|
const Output_Expr& expr2) const
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Compare_Strcmp::output_comparison");)
|
|
||||||
printf ("*");
|
printf ("*");
|
||||||
expr1.output_expr ();
|
expr1.output_expr ();
|
||||||
printf (" == *");
|
printf (" == *");
|
||||||
@@ -958,7 +928,6 @@ struct Output_Compare_Strncmp : public Output_Compare
|
|||||||
void Output_Compare_Strncmp::output_comparison (const Output_Expr& expr1,
|
void Output_Compare_Strncmp::output_comparison (const Output_Expr& expr1,
|
||||||
const Output_Expr& expr2) const
|
const Output_Expr& expr2) const
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Compare_Strncmp::output_comparison");)
|
|
||||||
printf ("*");
|
printf ("*");
|
||||||
expr1.output_expr ();
|
expr1.output_expr ();
|
||||||
printf (" == *");
|
printf (" == *");
|
||||||
@@ -988,7 +957,6 @@ struct Output_Compare_Memcmp : public Output_Compare
|
|||||||
void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1,
|
void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1,
|
||||||
const Output_Expr& expr2) const
|
const Output_Expr& expr2) const
|
||||||
{
|
{
|
||||||
T (Trace t ("Output_Compare_Memcmp::output_comparison");)
|
|
||||||
printf ("*");
|
printf ("*");
|
||||||
expr1.output_expr ();
|
expr1.output_expr ();
|
||||||
printf (" == *");
|
printf (" == *");
|
||||||
@@ -1008,7 +976,6 @@ void Output_Compare_Memcmp::output_comparison (const Output_Expr& expr1,
|
|||||||
void
|
void
|
||||||
Key_List::output_hash_function (void)
|
Key_List::output_hash_function (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::output_hash_function");)
|
|
||||||
const int max_column = 10;
|
const int max_column = 10;
|
||||||
int field_width;
|
int field_width;
|
||||||
|
|
||||||
@@ -1177,7 +1144,6 @@ Key_List::output_hash_function (void)
|
|||||||
void
|
void
|
||||||
Key_List::output_keylength_table (void)
|
Key_List::output_keylength_table (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::output_keylength_table");)
|
|
||||||
const int columns = 14;
|
const int columns = 14;
|
||||||
int index;
|
int index;
|
||||||
int column;
|
int column;
|
||||||
@@ -1298,7 +1264,6 @@ output_keyword_blank_entries (int count, const char *indent)
|
|||||||
void
|
void
|
||||||
Key_List::output_keyword_table (void)
|
Key_List::output_keyword_table (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::output_keyword_table");)
|
|
||||||
const char *indent = option[GLOBAL] ? "" : " ";
|
const char *indent = option[GLOBAL] ? "" : " ";
|
||||||
int index;
|
int index;
|
||||||
List_Node *temp;
|
List_Node *temp;
|
||||||
@@ -1360,7 +1325,6 @@ Key_List::output_keyword_table (void)
|
|||||||
void
|
void
|
||||||
Key_List::output_lookup_array (void)
|
Key_List::output_lookup_array (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::output_lookup_array");)
|
|
||||||
if (option[DUP])
|
if (option[DUP])
|
||||||
{
|
{
|
||||||
const int DEFAULT_VALUE = -1;
|
const int DEFAULT_VALUE = -1;
|
||||||
@@ -1536,8 +1500,6 @@ Key_List::output_lookup_array (void)
|
|||||||
void
|
void
|
||||||
Key_List::output_lookup_tables (void)
|
Key_List::output_lookup_tables (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::output_lookup_tables");)
|
|
||||||
|
|
||||||
if (option[SWITCH])
|
if (option[SWITCH])
|
||||||
{
|
{
|
||||||
/* Use the switch in place of lookup table. */
|
/* Use the switch in place of lookup table. */
|
||||||
@@ -1563,8 +1525,6 @@ Key_List::output_lookup_tables (void)
|
|||||||
static List_Node *
|
static List_Node *
|
||||||
output_switch_case (List_Node *list, int indent, int *jumps_away)
|
output_switch_case (List_Node *list, int indent, int *jumps_away)
|
||||||
{
|
{
|
||||||
T (Trace t ("output_switch_case");)
|
|
||||||
|
|
||||||
if (option[DEBUG])
|
if (option[DEBUG])
|
||||||
printf ("%*s/* hash value = %4d, keyword = \"%.*s\" */\n",
|
printf ("%*s/* hash value = %4d, keyword = \"%.*s\" */\n",
|
||||||
indent, "", list->hash_value, list->key_length, list->key);
|
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
|
static void
|
||||||
output_switches (List_Node *list, int num_switches, int size, int min_hash_value, int max_hash_value, int indent)
|
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])
|
if (option[DEBUG])
|
||||||
printf ("%*s/* know %d <= key <= %d, contains %d cases */\n",
|
printf ("%*s/* know %d <= key <= %d, contains %d cases */\n",
|
||||||
indent, "", min_hash_value, max_hash_value, size);
|
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
|
void
|
||||||
Key_List::output_lookup_function_body (const Output_Compare& comparison)
|
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"
|
printf (" if (len <= MAX_WORD_LENGTH && len >= MIN_WORD_LENGTH)\n"
|
||||||
" {\n"
|
" {\n"
|
||||||
" register int key = %s (str, len);\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
|
void
|
||||||
Key_List::output_lookup_function (void)
|
Key_List::output_lookup_function (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::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])
|
||||||
printf ("#ifdef __GNUC__\n"
|
printf ("#ifdef __GNUC__\n"
|
||||||
@@ -2031,8 +1985,6 @@ Key_List::output_lookup_function (void)
|
|||||||
void
|
void
|
||||||
Key_List::output (void)
|
Key_List::output (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::output");)
|
|
||||||
|
|
||||||
compute_min_max ();
|
compute_min_max ();
|
||||||
|
|
||||||
if (option[C] | option[ANSIC] | option[CPLUSPLUS])
|
if (option[C] | option[ANSIC] | option[CPLUSPLUS])
|
||||||
@@ -2123,7 +2075,6 @@ Key_List::output (void)
|
|||||||
void
|
void
|
||||||
Key_List::sort (void)
|
Key_List::sort (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::sort");)
|
|
||||||
hash_sort = 1;
|
hash_sort = 1;
|
||||||
occurrence_sort = 0;
|
occurrence_sort = 0;
|
||||||
|
|
||||||
@@ -2135,7 +2086,6 @@ Key_List::sort (void)
|
|||||||
void
|
void
|
||||||
Key_List::dump ()
|
Key_List::dump ()
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::dump");)
|
|
||||||
int field_width = option.get_max_keysig_size ();
|
int field_width = option.get_max_keysig_size ();
|
||||||
|
|
||||||
fprintf (stderr, "\nList contents are:\n(hash value, key length, index, %*s, keyword):\n",
|
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)
|
Key_List::Key_List (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::Key_List");)
|
|
||||||
total_keys = 1;
|
total_keys = 1;
|
||||||
max_key_len = INT_MIN;
|
max_key_len = INT_MIN;
|
||||||
min_key_len = INT_MAX;
|
min_key_len = INT_MAX;
|
||||||
@@ -2169,7 +2118,6 @@ Key_List::Key_List (void)
|
|||||||
int
|
int
|
||||||
Key_List::keyword_list_length (void)
|
Key_List::keyword_list_length (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::keyword_list_length");)
|
|
||||||
return list_len;
|
return list_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2178,7 +2126,6 @@ Key_List::keyword_list_length (void)
|
|||||||
int
|
int
|
||||||
Key_List::max_key_length (void)
|
Key_List::max_key_length (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Key_List::max_key_length");)
|
|
||||||
return max_key_len;
|
return max_key_len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Creates and initializes a new list node.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 <stdio.h>
|
||||||
#include <stdlib.h> /* declares exit() */
|
#include <stdlib.h> /* declares exit() */
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
/* Sorts the key set alphabetically to speed up subsequent operations.
|
/* Sorts the key set alphabetically to speed up subsequent operations.
|
||||||
Uses insertion sort since the set is probably quite small. */
|
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
|
inline void
|
||||||
List_Node::set_sort (char *base, int len)
|
List_Node::set_sort (char *base, int len)
|
||||||
{
|
{
|
||||||
T (Trace t ("List_Node::set_sort");)
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0, j = len - 1; i < j; i++)
|
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):
|
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)
|
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 *key_set = new char[(option[ALLCHARS] ? len : option.get_max_keysig_size ())];
|
||||||
char *ptr = key_set;
|
char *ptr = key_set;
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Driver program for the Gen_Perf hash function generator
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 <stdio.h>
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "gen-perf.h"
|
#include "gen-perf.h"
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main (int argc, char *argv[])
|
main (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
T (Trace t ("main");)
|
|
||||||
|
|
||||||
#if LARGE_STACK_ARRAYS && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK)
|
#if LARGE_STACK_ARRAYS && defined(HAVE_GETRLIMIT) && defined(HAVE_SETRLIMIT) && defined(RLIMIT_STACK)
|
||||||
/* Get rid of any avoidable limit on stack size. */
|
/* Get rid of any avoidable limit on stack size. */
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Defines a buffered memory allocation abstraction that reduces calls to
|
/* Defines a buffered memory allocation abstraction that reduces calls to
|
||||||
malloc.
|
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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 "config.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h> /* declares malloc(), exit() */
|
#include <stdlib.h> /* declares malloc(), exit() */
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
/* Determine default alignment. If your C++ compiler does not
|
/* Determine default alignment. If your C++ compiler does not
|
||||||
like this then try something like #define DEFAULT_ALIGNMENT 8. */
|
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 *
|
void *
|
||||||
operator new (size_t size)
|
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_start = 0; /* Large array used to reduce calls to NEW. */
|
||||||
static char *buf_end = 0; /* Indicates end of BUF_START. */
|
static char *buf_end = 0; /* Indicates end of BUF_START. */
|
||||||
static size_t buf_size = 4096; /* Size of buffer pointed to by 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()
|
throw()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
T (Trace t ("operator delete");)
|
|
||||||
// We cannot call free here, as it doesn't match the mallocs.
|
// We cannot call free here, as it doesn't match the mallocs.
|
||||||
// free ((char *) ptr);
|
// free ((char *) ptr);
|
||||||
(void) ptr;
|
(void) ptr;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/* Handles parsing the Options provided to the user.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 "getopt.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "iterator.h"
|
#include "iterator.h"
|
||||||
#include "trace.h"
|
|
||||||
#include "vectors.h"
|
#include "vectors.h"
|
||||||
#include "version.h"
|
#include "version.h"
|
||||||
|
|
||||||
@@ -82,7 +81,6 @@ char Options::key_positions[MAX_KEY_POS];
|
|||||||
void
|
void
|
||||||
Options::short_usage (FILE * strm)
|
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"
|
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",
|
"Try `%s --help' for more information.\n",
|
||||||
program_name, program_name);
|
program_name, program_name);
|
||||||
@@ -91,7 +89,6 @@ Options::short_usage (FILE * strm)
|
|||||||
void
|
void
|
||||||
Options::long_usage (FILE * strm)
|
Options::long_usage (FILE * strm)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::long_usage");)
|
|
||||||
fprintf (strm,
|
fprintf (strm,
|
||||||
"GNU `gperf' generates perfect hash functions.\n"
|
"GNU `gperf' generates perfect hash functions.\n"
|
||||||
"\n"
|
"\n"
|
||||||
@@ -223,7 +220,6 @@ Options::long_usage (FILE * strm)
|
|||||||
void
|
void
|
||||||
Options::print_options (void)
|
Options::print_options (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::print_options");)
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
printf ("/* Command-line: ");
|
printf ("/* Command-line: ");
|
||||||
@@ -285,7 +281,6 @@ Options::print_options (void)
|
|||||||
inline int
|
inline int
|
||||||
Options::key_sort (char *base, int len)
|
Options::key_sort (char *base, int len)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::key_sort");)
|
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0, j = len - 1; i < j; i++)
|
for (i = 0, j = len - 1; i < j; i++)
|
||||||
@@ -306,7 +301,6 @@ Options::key_sort (char *base, int len)
|
|||||||
|
|
||||||
Options::Options (void)
|
Options::Options (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::Options");)
|
|
||||||
key_positions[0] = WORD_START;
|
key_positions[0] = WORD_START;
|
||||||
key_positions[1] = WORD_END;
|
key_positions[1] = WORD_END;
|
||||||
key_positions[2] = EOS;
|
key_positions[2] = EOS;
|
||||||
@@ -328,7 +322,6 @@ Options::Options (void)
|
|||||||
|
|
||||||
Options::~Options (void)
|
Options::~Options (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::~Options");)
|
|
||||||
if (option_word & DEBUG)
|
if (option_word & DEBUG)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
@@ -448,7 +441,6 @@ static const struct option long_options[] =
|
|||||||
void
|
void
|
||||||
Options::operator() (int argc, char *argv[])
|
Options::operator() (int argc, char *argv[])
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::operator()");)
|
|
||||||
int option_char;
|
int option_char;
|
||||||
|
|
||||||
program_name = argv[0];
|
program_name = argv[0];
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
/* Handles parsing the Options provided to the user.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
This file is part of GNU GPERF.
|
||||||
@@ -149,7 +149,6 @@ extern Options option;
|
|||||||
|
|
||||||
#ifdef __OPTIMIZE__
|
#ifdef __OPTIMIZE__
|
||||||
|
|
||||||
#include "trace.h"
|
|
||||||
#define INLINE inline
|
#define INLINE inline
|
||||||
#include "options.icc"
|
#include "options.icc"
|
||||||
#undef INLINE
|
#undef INLINE
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Inline Functions for options.{h,cc}.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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
|
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. */
|
Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
||||||
|
|
||||||
// This needs:
|
|
||||||
//#include "trace.h"
|
|
||||||
|
|
||||||
/* TRUE if option enable, else FALSE. */
|
/* TRUE if option enable, else FALSE. */
|
||||||
INLINE int
|
INLINE int
|
||||||
Options::operator[] (Option_Type option)
|
Options::operator[] (Option_Type option)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::operator[]");)
|
|
||||||
return option_word & option;
|
return option_word & option;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -34,7 +30,6 @@ Options::operator[] (Option_Type option)
|
|||||||
INLINE void
|
INLINE void
|
||||||
Options::operator = (enum Option_Type opt)
|
Options::operator = (enum Option_Type opt)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::operator=");)
|
|
||||||
option_word |= opt;
|
option_word |= opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,7 +37,6 @@ Options::operator = (enum Option_Type opt)
|
|||||||
INLINE void
|
INLINE void
|
||||||
Options::operator != (enum Option_Type opt)
|
Options::operator != (enum Option_Type opt)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::operator!=");)
|
|
||||||
option_word &= ~opt;
|
option_word &= ~opt;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,7 +44,6 @@ Options::operator != (enum Option_Type opt)
|
|||||||
INLINE void
|
INLINE void
|
||||||
Options::reset (void)
|
Options::reset (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::reset");)
|
|
||||||
key_pos = 0;
|
key_pos = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +51,6 @@ Options::reset (void)
|
|||||||
INLINE int
|
INLINE int
|
||||||
Options::get (void)
|
Options::get (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get");)
|
|
||||||
return key_positions[key_pos++];
|
return key_positions[key_pos++];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,7 +58,6 @@ Options::get (void)
|
|||||||
INLINE void
|
INLINE void
|
||||||
Options::set_asso_max (int r)
|
Options::set_asso_max (int r)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::set_asso_max");)
|
|
||||||
size = r;
|
size = r;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +65,6 @@ Options::set_asso_max (int r)
|
|||||||
INLINE int
|
INLINE int
|
||||||
Options::get_asso_max (void)
|
Options::get_asso_max (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_asso_max");)
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +72,6 @@ Options::get_asso_max (void)
|
|||||||
INLINE int
|
INLINE int
|
||||||
Options::get_max_keysig_size (void)
|
Options::get_max_keysig_size (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_max_keysig_size");)
|
|
||||||
return total_keysig_size;
|
return total_keysig_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -90,7 +79,6 @@ Options::get_max_keysig_size (void)
|
|||||||
INLINE void
|
INLINE void
|
||||||
Options::set_keysig_size (int size)
|
Options::set_keysig_size (int size)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::set_keysig_size");)
|
|
||||||
total_keysig_size = size;
|
total_keysig_size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +86,6 @@ Options::set_keysig_size (int size)
|
|||||||
INLINE int
|
INLINE int
|
||||||
Options::get_jump (void)
|
Options::get_jump (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_jump");)
|
|
||||||
return jump;
|
return jump;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +93,6 @@ Options::get_jump (void)
|
|||||||
INLINE const char *
|
INLINE const char *
|
||||||
Options::get_function_name (void)
|
Options::get_function_name (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_function_name");)
|
|
||||||
return function_name;
|
return function_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +100,6 @@ Options::get_function_name (void)
|
|||||||
INLINE const char *
|
INLINE const char *
|
||||||
Options::get_key_name (void)
|
Options::get_key_name (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_key_name");)
|
|
||||||
return key_name;
|
return key_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -122,7 +107,6 @@ Options::get_key_name (void)
|
|||||||
INLINE const char *
|
INLINE const char *
|
||||||
Options::get_initializer_suffix (void)
|
Options::get_initializer_suffix (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_initializer_suffix");)
|
|
||||||
return initializer_suffix;
|
return initializer_suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,7 +114,6 @@ Options::get_initializer_suffix (void)
|
|||||||
INLINE const char *
|
INLINE const char *
|
||||||
Options::get_hash_name (void)
|
Options::get_hash_name (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_hash_name");)
|
|
||||||
return hash_name;
|
return hash_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -138,7 +121,6 @@ Options::get_hash_name (void)
|
|||||||
INLINE const char *
|
INLINE const char *
|
||||||
Options::get_wordlist_name (void)
|
Options::get_wordlist_name (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_wordlist_name");)
|
|
||||||
return wordlist_name;
|
return wordlist_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,7 +128,6 @@ Options::get_wordlist_name (void)
|
|||||||
INLINE const char *
|
INLINE const char *
|
||||||
Options::get_class_name (void)
|
Options::get_class_name (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_class_name");)
|
|
||||||
return class_name;
|
return class_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +135,6 @@ Options::get_class_name (void)
|
|||||||
INLINE int
|
INLINE int
|
||||||
Options::initial_value (void)
|
Options::initial_value (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::initial_value");)
|
|
||||||
return initial_asso_value;
|
return initial_asso_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,7 +142,6 @@ Options::initial_value (void)
|
|||||||
INLINE int
|
INLINE int
|
||||||
Options::get_iterations (void)
|
Options::get_iterations (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_iterations");)
|
|
||||||
return iterations;
|
return iterations;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +149,6 @@ Options::get_iterations (void)
|
|||||||
INLINE const char *
|
INLINE const char *
|
||||||
Options::get_delimiter ()
|
Options::get_delimiter ()
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_delimiter");)
|
|
||||||
return delimiters;
|
return delimiters;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -178,6 +156,5 @@ Options::get_delimiter ()
|
|||||||
INLINE int
|
INLINE int
|
||||||
Options::get_total_switches ()
|
Options::get_total_switches ()
|
||||||
{
|
{
|
||||||
T (Trace t ("Options::get_total_switches");)
|
|
||||||
return total_switches;
|
return total_switches;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Correctly reads an arbitrarily size string.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
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 <stdlib.h>
|
||||||
#include <string.h> /* declares memcpy() */
|
#include <string.h> /* declares memcpy() */
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "trace.h"
|
|
||||||
|
|
||||||
/* Recursively fills up the buffer. */
|
/* Recursively fills up the buffer. */
|
||||||
|
|
||||||
@@ -39,7 +38,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
|||||||
char *
|
char *
|
||||||
Read_Line::readln_aux (int chunks)
|
Read_Line::readln_aux (int chunks)
|
||||||
{
|
{
|
||||||
T (Trace t ("Read_Line::readln_aux");)
|
|
||||||
#if LARGE_STACK
|
#if LARGE_STACK
|
||||||
char buf[CHUNK_SIZE];
|
char buf[CHUNK_SIZE];
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
/* Reads arbitrarily long string from input file, returning it as a
|
/* Reads arbitrarily long string from input file, returning it as a
|
||||||
dynamically allocated buffer.
|
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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
This file is part of GNU GPERF.
|
||||||
@@ -43,7 +43,6 @@ public:
|
|||||||
|
|
||||||
#ifdef __OPTIMIZE__
|
#ifdef __OPTIMIZE__
|
||||||
|
|
||||||
#include "trace.h"
|
|
||||||
#define INLINE inline
|
#define INLINE inline
|
||||||
#include "read-line.icc"
|
#include "read-line.icc"
|
||||||
#undef INLINE
|
#undef INLINE
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
/* Inline Functions for read-line.{h,cc}.
|
/* 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)
|
written by Douglas C. Schmidt (schmidt@ics.uci.edu)
|
||||||
|
|
||||||
This file is part of GNU GPERF.
|
This file is part of GNU GPERF.
|
||||||
@@ -21,13 +21,11 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
|
|||||||
|
|
||||||
// This needs:
|
// This needs:
|
||||||
//#include <stdio.h>
|
//#include <stdio.h>
|
||||||
//#include "trace.h"
|
|
||||||
|
|
||||||
/* Returns the ``next'' line, ignoring comments beginning with '#'. */
|
/* Returns the ``next'' line, ignoring comments beginning with '#'. */
|
||||||
INLINE char *
|
INLINE char *
|
||||||
Read_Line::get_line (void)
|
Read_Line::get_line (void)
|
||||||
{
|
{
|
||||||
T (Trace t ("Read_Line::get_line");)
|
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
while ((c = getc (fp)) == '#')
|
while ((c = getc (fp)) == '#')
|
||||||
|
|||||||
35
src/trace.cc
35
src/trace.cc
@@ -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);
|
|
||||||
}
|
|
||||||
40
src/trace.h
40
src/trace.h
@@ -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
|
|
||||||
Reference in New Issue
Block a user