From 218f1b2fac6a699de9d6c9bc2ccec8c74c492d89 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 6 Dec 2002 16:45:17 +0000 Subject: [PATCH] Removed. --- src/list-node.cc | 99 ------------------------------------------------ src/list-node.h | 38 ------------------- 2 files changed, 137 deletions(-) delete mode 100644 src/list-node.cc delete mode 100644 src/list-node.h diff --git a/src/list-node.cc b/src/list-node.cc deleted file mode 100644 index 7cf9c7f..0000000 --- a/src/list-node.cc +++ /dev/null @@ -1,99 +0,0 @@ -/* Creates and initializes a new list node. - 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. - -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 "list-node.h" - -#include -#include /* declares exit() */ -#include "options.h" - -/* Sorts the key set alphabetically to speed up subsequent operations. - Uses insertion sort since the set is probably quite small. */ - -inline void -List_Node::set_sort (char *base, int len) -{ - int i, j; - - for (i = 0, j = len - 1; i < j; i++) - { - char curr, tmp; - - for (curr = i + 1, tmp = base[curr]; curr > 0 && tmp < base[curr-1]; curr--) - base[curr] = base[curr - 1]; - - base[curr] = tmp; - - } -} - -/* Initializes a List_Node. This requires obtaining memory for the CHAR_SET - initializing them using the information stored in the KEY_POSITIONS array in Options, - and checking for simple errors. It's important to note that KEY and REST are - both pointers to the different offsets into the same block of dynamic memory pointed - to by parameter K. The data member REST is used to store any additional fields - of the input file (it is set to the "" string if Option[TYPE] is not enabled). - This is useful if the user wishes to incorporate a lookup structure, - rather than just an array of keys. Finally, KEY_NUMBER contains a count - of the total number of keys seen so far. This is used to initialize - the INDEX field to some useful value. */ - -List_Node::List_Node (const char *k, int len, const char *r): - KeywordExt (k, len, r), next (NULL) -{ - char *key_set = new char[(option[ALLCHARS] ? len : option.get_max_keysig_size ())]; - char *ptr = key_set; - int i; - - if (option[ALLCHARS]) /* Use all the character positions in the KEY. */ - for (i = len; i > 0; k++, ptr++, i--) - ++occurrences[(unsigned char)(*ptr = *k)]; - else /* Only use those character positions specified by the user. */ - { - /* Iterate through the list of key_positions, initializing occurrences table - and selchars (via char * pointer ptr). */ - - for (option.reset (); (i = option.get ()) != EOS; ) - { - if (i == WORD_END) /* Special notation for last KEY position, i.e. '$'. */ - *ptr = allchars[len - 1]; - else if (i <= len) /* Within range of KEY length, so we'll keep it. */ - *ptr = allchars[i - 1]; - else /* Out of range of KEY length, so we'll just skip it. */ - continue; - ++occurrences[(unsigned char)(*ptr++)]; - } - - /* Didn't get any hits and user doesn't want to consider the - keylength, so there are essentially no usable hash positions! */ - if (ptr == selchars && option[NOLENGTH]) - { - fprintf (stderr, "Can't hash keyword %.*s with chosen key positions.\n", - allchars_length, allchars); - exit (1); - } - } - - /* Sort the KEY_SET items alphabetically. */ - set_sort (key_set, ptr - key_set); - - selchars = key_set; - selchars_length = ptr - key_set; -} diff --git a/src/list-node.h b/src/list-node.h deleted file mode 100644 index 375cc2e..0000000 --- a/src/list-node.h +++ /dev/null @@ -1,38 +0,0 @@ -/* This may look like C code, but it is really -*- C++ -*- */ - -/* Data and function members for defining values and operations of a list node. - - 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. - -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 list_node_h -#define list_node_h 1 - -#include "vectors.h" -#include "keyword.h" - -struct List_Node : public KeywordExt, private Vectors -{ - List_Node *next; /* Points to next element on the list. */ - - List_Node (const char *key, int len, const char *rest); - static void set_sort (char *base, int len); -}; - -#endif