1
0
mirror of https://git.savannah.gnu.org/git/gperf.git synced 2025-12-02 21:19:24 +00:00

Separate the KeywordExt from the list node that points to it.

This commit is contained in:
Bruno Haible
2002-11-20 12:58:14 +00:00
parent 2cd11405ed
commit befb3d467e
4 changed files with 17 additions and 8 deletions

View File

@@ -1,5 +1,13 @@
2002-11-02 Bruno Haible <bruno@clisp.org> 2002-11-02 Bruno Haible <bruno@clisp.org>
* src/keyword-list.h (KeywordExt_List): Don't inherit from KeywordExt.
(KeywordExt_List::KeywordExt_List): Take a KeywordExt* as argument.
(KeywordExt_List::_car): New field.
(KeywordExt_List::first): Use it.
* src/keyword-list.cc (KeywordExt_List::KeywordExt_List): Take a
KeywordExt* as argument.
* src/input.cc (parse_line): Create the KeywordExt separately.
Start using bool. Start using bool.
* src/bool-array.h (Bool_Array::set_bit): Change return type to bool. * src/bool-array.h (Bool_Array::set_bit): Change return type to bool.
* src/bool-array.icc (Bool_Array::set_bit): Likewise. * src/bool-array.icc (Bool_Array::set_bit): Likewise.

View File

@@ -299,7 +299,7 @@ parse_line (const char *line, const char *delimiters)
} }
lp++; lp++;
} }
return new KeywordExt_List (key, kp - key, option[TYPE] ? lp : ""); return new KeywordExt_List (new KeywordExt (key, kp - key, option[TYPE] ? lp : ""));
} }
else else
{ {
@@ -312,7 +312,7 @@ parse_line (const char *line, const char *delimiters)
else else
/* Skip the first delimiter. */ /* Skip the first delimiter. */
rest = &line[len + 1]; rest = &line[len + 1];
return new KeywordExt_List (line, len, option[TYPE] ? rest : ""); return new KeywordExt_List (new KeywordExt (line, len, option[TYPE] ? rest : ""));
} }
} }

View File

@@ -23,7 +23,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "keyword-list.h" #include "keyword-list.h"
/* Constructor. */ /* Constructor. */
KeywordExt_List::KeywordExt_List (const char *s, int s_len, const char *r) KeywordExt_List::KeywordExt_List (KeywordExt *car)
: KeywordExt (s, s_len, r), _cdr (NULL) : _cdr (NULL), _car (car)
{ {
} }

View File

@@ -26,19 +26,20 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111, USA. */
#include "keyword.h" #include "keyword.h"
/* List node of a linear list. */ /* List node of a linear list of Keyword. */
class KeywordExt_List : private KeywordExt { class KeywordExt_List {
public: public:
/* Constructor. */ /* Constructor. */
KeywordExt_List (const char *allchars, int allchars_length, const char *rest); KeywordExt_List (KeywordExt *car);
/* Access to first element of list. */ /* Access to first element of list. */
KeywordExt * first () { return this; } KeywordExt * first () { return _car; }
/* Access to next element of list. */ /* Access to next element of list. */
KeywordExt_List *& rest () { return _cdr; } KeywordExt_List *& rest () { return _cdr; }
private: private:
KeywordExt_List * _cdr; KeywordExt_List * _cdr;
KeywordExt * const _car;
}; };
#endif #endif