From: Richard Jones Date: Wed, 14 Jan 2009 16:11:25 +0000 (+0000) Subject: Added the float type. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=b92428b2c1588d37e8c1eb42a4548fa3524c6b22;p=portablexdr.git Added the float type. --- diff --git a/rpcgen_codegen.c b/rpcgen_codegen.c index 9677a2a..49a7059 100644 --- a/rpcgen_codegen.c +++ b/rpcgen_codegen.c @@ -119,7 +119,8 @@ gen_prologue (const char *filename) "#endif\n" "\n" "#include \n" - "#include \n" + "#include \n" + "#include \n" "\n" "/* Use the following symbol in your code to detect whether\n" " * PortableXDR's rpcgen was used to compile the source file.\n" @@ -423,6 +424,9 @@ xdr_func_of_simple_type (const struct type *type) case type_hyper: if (type->sgn) r = "quad_t"; else r = "u_quad_t"; break; + case type_float: + r = "float"; + break; case type_double: r = "double"; break; @@ -457,6 +461,9 @@ sizeof_simple_type (const struct type *type) case type_hyper: r = strdup ("8"); break; + case type_float: + r = strdup ("4"); + break; case type_double: r = strdup ("8"); break; @@ -567,6 +574,10 @@ gen_type (const struct type *type) else fputs ("uint64_t", yyout); break; + case type_float: + fputs ("float", yyout); + break; + case type_double: fputs ("double", yyout); break; diff --git a/rpcgen_int.h b/rpcgen_int.h index b551516..024b0c6 100644 --- a/rpcgen_int.h +++ b/rpcgen_int.h @@ -36,7 +36,7 @@ extern enum output_mode output_mode; /* Abstract syntax tree types. */ enum type_enum { type_char, type_short, type_int, type_hyper, - type_double, + type_float, type_double, type_bool, type_ident, }; diff --git a/rpcgen_parse.y b/rpcgen_parse.y index 2923325..652a7f3 100644 --- a/rpcgen_parse.y +++ b/rpcgen_parse.y @@ -59,6 +59,7 @@ extern void yyerror (const char *str); %token SHORT %token INT %token HYPER +%token FLOAT %token DOUBLE %token STRING %token OPAQUE @@ -259,6 +260,8 @@ type_ident { $$ = new_type (type_int, 1, NULL); } | UNSIGNED { $$ = new_type (type_int, 0, NULL); } + | FLOAT + { $$ = new_type (type_float, 0, NULL); } | DOUBLE { $$ = new_type (type_double, 0, NULL); } | BOOL diff --git a/rpcgen_scan.l b/rpcgen_scan.l index 10ed056..1a78235 100644 --- a/rpcgen_scan.l +++ b/rpcgen_scan.l @@ -134,6 +134,7 @@ char return CHAR; short return SHORT; int return INT; hyper return HYPER; +float return FLOAT; double return DOUBLE; string return STRING; opaque return OPAQUE;