summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2003-04-30 10:36:10 +0000
committerBruno Haible <bruno@clisp.org>2003-04-30 10:36:10 +0000
commitff0be608102a1ccc42211a9a55554cdb57dcde4c (patch)
tree99452052f01d78ecad2c9d6981e67bc9a74de5e0
parent5fbcad1840cbf05be190e073c3c8e97af7b97f53 (diff)
downloadgperf-ff0be608102a1ccc42211a9a55554cdb57dcde4c.tar.gz
New declaration "%define initializer-suffix".
-rw-r--r--ChangeLog10
-rw-r--r--NEWS1
-rw-r--r--doc/gperf.texi13
-rw-r--r--src/input.cc5
-rw-r--r--src/options.cc10
-rw-r--r--src/options.h4
6 files changed, 39 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index bc32815..bd94fc7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* Makefile.msvc: New file.
diff --git a/NEWS b/NEWS
index 9ff7833..7211718 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ New in 2.97:
%ignore-case
%language=LANGUAGE-NAME
%define slot-name NAME
+ %define initializer-suffix INITIALIZERS
%define hash-function-name NAME
%define lookup-function-name NAME
%define class-name NAME
diff --git a/doc/gperf.texi b/doc/gperf.texi
index 6b633ee..5901e23 100644
--- a/doc/gperf.texi
+++ b/doc/gperf.texi
@@ -7,7 +7,7 @@
@c some day we should @include version.texi instead of defining
@c these values at hand.
-@set UPDATED 1 January 2003
+@set UPDATED 1 March 2003
@set EDITION 2.7.2
@set VERSION 2.7.2
@c ---------------------
@@ -472,13 +472,22 @@ The default is C.
@item %define slot-name @var{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.
By default, the program assumes the structure component identifier for
the keyword is @samp{name}. This option allows an arbitrary choice of
identifier for this component, although it still must occur as the first
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}
@cindex @samp{%define hash-function-name}
Allows you to specify the name for the generated hash function. Default
diff --git a/src/input.cc b/src/input.cc
index 903545d..dc9a2c6 100644
--- a/src/input.cc
+++ b/src/input.cc
@@ -487,6 +487,11 @@ Input::read_input ()
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,
"hash-function-name", &arg))
option.set_hash_name (arg);
else
diff --git a/src/options.cc b/src/options.cc
index 82495e7..88ae9fc 100644
--- a/src/options.cc
+++ b/src/options.cc
@@ -593,7 +593,7 @@ Options::set_function_name (const char *name)
_function_name = name;
}
-/* Set the keyword key name, if not already set. */
+/* Sets the keyword key name, if not already set. */
void
Options::set_slot_name (const char *name)
{
@@ -601,6 +601,14 @@ Options::set_slot_name (const char *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. */
void
Options::set_class_name (const char *name)
diff --git a/src/options.h b/src/options.h
index d153436..2507590 100644
--- a/src/options.h
+++ b/src/options.h
@@ -171,11 +171,13 @@ public:
/* Returns the keyword key name. */
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);
/* Returns the struct initializer suffix. */
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. */
const char * get_class_name () const;