aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/datconv.c10
-rw-r--r--src/gdbmtool.c2
-rw-r--r--src/gram.y18
3 files changed, 23 insertions, 7 deletions
diff --git a/src/datconv.c b/src/datconv.c
index 95656db..c8f63e0 100644
--- a/src/datconv.c
+++ b/src/datconv.c
@@ -26,6 +26,8 @@ name (FILE *fp, void *ptr, int size) \
}
DEFFMT (f_char, char, "%c")
+DEFFMT (f_short, short, "%hd")
+DEFFMT (f_ushort, unsigned short, "%hu")
DEFFMT (f_int, int, "%d")
DEFFMT (f_uint, unsigned, "%u")
DEFFMT (f_long, long, "%ld")
@@ -100,6 +102,8 @@ name (struct xdatum *xd, char *str) \
return 0; \
}
+DEFNSCAN(s_short, short, long, strtol);
+DEFNSCAN(s_ushort, unsigned short, unsigned long, strtoul);
DEFNSCAN(s_int, int, long, strtol)
DEFNSCAN(s_uint, unsigned, unsigned long, strtol)
DEFNSCAN(s_long, long, long, strtoul)
@@ -150,7 +154,9 @@ s_zstring (struct xdatum *xd, char *str)
}
static struct datadef datatab[] = {
- { "char", sizeof(char), f_char, s_char },
+ { "char", sizeof(char), f_char, s_char },
+ { "short", sizeof(short), f_short, s_short },
+ { "ushort", sizeof(unsigned short), f_ushort, s_ushort },
{ "int", sizeof(int), f_int, s_int },
{ "unsigned", sizeof(unsigned), f_uint, s_uint },
{ "uint", sizeof(unsigned), f_uint, s_uint },
@@ -413,7 +419,7 @@ dsprint (FILE *fp, int what, struct dsegm *ds)
break;
case FDEF_OFF:
- fprintf (fp, "\toff %d,\n", ds->v.n);
+ fprintf (fp, "\toffset %d,\n", ds->v.n);
break;
case FDEF_PAD:
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index 0c75742..66db2ed 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -924,7 +924,7 @@ struct command command_tab[] = {
print_header_begin , print_header_handler, NULL,
{ { NULL } }, N_("print database file header") },
{ S(hash), T_CMD,
- checkdb, hash_handler, NULL,
+ NULL, hash_handler, NULL,
{ { N_("KEY"), ARG_DATUM, DS_KEY },
{ NULL } }, N_("hash value of key") },
{ S(cache), T_CMD,
diff --git a/src/gram.y b/src/gram.y
index fde98a2..f654edb 100644
--- a/src/gram.y
+++ b/src/gram.y
@@ -40,7 +40,7 @@ struct dsegm *dsdef[DS_MAX];
%type <string> string
%type <arg> arg
%type <arglist> arglist arg1list
-%type <dsegm> def
+%type <dsegm> def defbody
%type <dsegmlist> deflist
%type <num> defid
%type <kvpair> kvpair compound value
@@ -183,12 +183,22 @@ string : T_IDENT
| T_WORD
;
-defn : T_DEF defid { begin_def (); } '{' deflist optcomma '}'
+defn : T_DEF defid { begin_def (); } defbody
{
end_def ();
dsegm_free_list (dsdef[$2]);
- dsdef[$2] = $5.head;
- }
+ dsdef[$2] = $4;
+ }
+ ;
+
+defbody : '{' deflist optcomma '}'
+ {
+ $$ = $2.head;
+ }
+ | T_TYPE
+ {
+ $$ = dsegm_new_field ($1, NULL, 1);
+ }
;
optcomma : /* empty */

Return to:

Send suggestions and report system problems to the System administrator.