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

New declaration "%define initializer-suffix".

This commit is contained in:
Bruno Haible
2003-04-30 10:36:10 +00:00
parent 5fbcad1840
commit ff0be60810
6 changed files with 39 additions and 4 deletions

View File

@@ -1,3 +1,13 @@
2003-03-01 Bruno Haible <bruno@clisp.org>
* src/options.h (Options::set_initializer_suffix): New declaration.
* src/options.cc (Options::set_initializer_suffix): New method.
* src/input.cc (Input::read_input): Recognize %define
initializer-suffix.
* doc/gperf.texi (Gperf Declarations): Document %define
initializer-suffix.
* NEWS: Update.
2003-02-26 Bruno Haible <bruno@clisp.org> 2003-02-26 Bruno Haible <bruno@clisp.org>
* Makefile.msvc: New file. * Makefile.msvc: New file.

1
NEWS
View File

@@ -13,6 +13,7 @@ New in 2.97:
%ignore-case %ignore-case
%language=LANGUAGE-NAME %language=LANGUAGE-NAME
%define slot-name NAME %define slot-name NAME
%define initializer-suffix INITIALIZERS
%define hash-function-name NAME %define hash-function-name NAME
%define lookup-function-name NAME %define lookup-function-name NAME
%define class-name NAME %define class-name NAME

View File

@@ -7,7 +7,7 @@
@c some day we should @include version.texi instead of defining @c some day we should @include version.texi instead of defining
@c these values at hand. @c these values at hand.
@set UPDATED 1 January 2003 @set UPDATED 1 March 2003
@set EDITION 2.7.2 @set EDITION 2.7.2
@set VERSION 2.7.2 @set VERSION 2.7.2
@c --------------------- @c ---------------------
@@ -472,13 +472,22 @@ The default is C.
@item %define slot-name @var{name} @item %define slot-name @var{name}
@cindex @samp{%define slot-name} @cindex @samp{%define slot-name}
This option is only useful when option @samp{-t} (or, equivalently, the This declaration is only useful when option @samp{-t} (or, equivalently, the
@samp{%struct-type} declaration) has been given. @samp{%struct-type} declaration) has been given.
By default, the program assumes the structure component identifier for By default, the program assumes the structure component identifier for
the keyword is @samp{name}. This option allows an arbitrary choice of the keyword is @samp{name}. This option allows an arbitrary choice of
identifier for this component, although it still must occur as the first identifier for this component, although it still must occur as the first
field in your supplied @code{struct}. field in your supplied @code{struct}.
@item %define initializer-suffix @var{initializers}
@cindex @samp{%define initializer-suffix}
This declaration is only useful when option @samp{-t} (or, equivalently, the
@samp{%struct-type} declaration) has been given.
It permits to specify initializers for the structure members following
@var{slot-name} in empty hash table entries. The list of initializers
should start with a comma. By default, the emitted code will
zero-initialize structure members following @var{slot-name}.
@item %define hash-function-name @var{name} @item %define hash-function-name @var{name}
@cindex @samp{%define hash-function-name} @cindex @samp{%define hash-function-name}
Allows you to specify the name for the generated hash function. Default Allows you to specify the name for the generated hash function. Default

View File

@@ -486,6 +486,11 @@ Input::read_input ()
option.set_slot_name (arg); option.set_slot_name (arg);
else else
if (is_define_declaration (line, line_end, lineno,
"initializer-suffix", &arg))
option.set_initializer_suffix (arg);
else
if (is_define_declaration (line, line_end, lineno, if (is_define_declaration (line, line_end, lineno,
"hash-function-name", &arg)) "hash-function-name", &arg))
option.set_hash_name (arg); option.set_hash_name (arg);

View File

@@ -593,7 +593,7 @@ Options::set_function_name (const char *name)
_function_name = name; _function_name = name;
} }
/* Set the keyword key name, if not already set. */ /* Sets the keyword key name, if not already set. */
void void
Options::set_slot_name (const char *name) Options::set_slot_name (const char *name)
{ {
@@ -601,6 +601,14 @@ Options::set_slot_name (const char *name)
_slot_name = name; _slot_name = name;
} }
/* Sets the struct initializer suffix, if not already set. */
void
Options::set_initializer_suffix (const char *initializers)
{
if (_initializer_suffix == DEFAULT_INITIALIZER_SUFFIX)
_initializer_suffix = initializers;
}
/* Sets the generated class name, if not already set. */ /* Sets the generated class name, if not already set. */
void void
Options::set_class_name (const char *name) Options::set_class_name (const char *name)

View File

@@ -171,11 +171,13 @@ public:
/* Returns the keyword key name. */ /* Returns the keyword key name. */
const char * get_slot_name () const; const char * get_slot_name () const;
/* Set the keyword key name, if not already set. */ /* Sets the keyword key name, if not already set. */
void set_slot_name (const char *name); void set_slot_name (const char *name);
/* Returns the struct initializer suffix. */ /* Returns the struct initializer suffix. */
const char * get_initializer_suffix () const; const char * get_initializer_suffix () const;
/* Sets the struct initializer suffix, if not already set. */
void set_initializer_suffix (const char *initializers);
/* Returns the generated class name. */ /* Returns the generated class name. */
const char * get_class_name () const; const char * get_class_name () const;