mirror of
https://git.savannah.gnu.org/git/gperf.git
synced 2025-12-02 21:19:24 +00:00
New option --multiple-iterations.
This commit is contained in:
@@ -25,18 +25,60 @@
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
/* -------------------------- Keyword_List class --------------------------- */
|
||||
|
||||
/* Constructor. */
|
||||
Keyword_List::Keyword_List (Keyword *car)
|
||||
: _cdr (NULL), _car (car)
|
||||
{
|
||||
}
|
||||
|
||||
/* ------------------------- KeywordExt_List class ------------------------- */
|
||||
|
||||
/* Unused constructor. */
|
||||
KeywordExt_List::KeywordExt_List (KeywordExt *car)
|
||||
: Keyword_List (car)
|
||||
{
|
||||
}
|
||||
|
||||
/* ------------------------ Keyword_List functions ------------------------- */
|
||||
|
||||
/* Copies a linear list, sharing the list elements. */
|
||||
Keyword_List *
|
||||
copy_list (Keyword_List *list)
|
||||
{
|
||||
Keyword_List *result;
|
||||
Keyword_List **lastp = &result;
|
||||
while (list != NULL)
|
||||
{
|
||||
Keyword_List *new_cons = new Keyword_List (list->first());
|
||||
*lastp = new_cons;
|
||||
lastp = &new_cons->rest();
|
||||
list = list->rest();
|
||||
}
|
||||
*lastp = NULL;
|
||||
return result;
|
||||
}
|
||||
|
||||
/* Copies a linear list, sharing the list elements. */
|
||||
KeywordExt_List *
|
||||
copy_list (KeywordExt_List *list)
|
||||
{
|
||||
return static_cast<KeywordExt_List *> (copy_list (static_cast<Keyword_List *> (list)));
|
||||
}
|
||||
|
||||
/* Deletes a linear list, keeping the list elements in memory. */
|
||||
void
|
||||
delete_list (Keyword_List *list)
|
||||
{
|
||||
while (list != NULL)
|
||||
{
|
||||
Keyword_List *rest = list->rest();
|
||||
delete list;
|
||||
list = rest;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
|
||||
Reference in New Issue
Block a user