diff options
author | Raymond Lu <songyulu@hdfgroup.org> | 2007-08-23 19:28:40 (GMT) |
---|---|---|
committer | Raymond Lu <songyulu@hdfgroup.org> | 2007-08-23 19:28:40 (GMT) |
commit | 3183d38231c3d2de3dd9e18abac1e753ca727013 (patch) | |
tree | ca614809cf9cd1a5188480ff021a7eb8707e65a9 | |
parent | f7db09fb3d01fec4a8576b80069bee66e3403d2e (diff) | |
download | hdf5-3183d38231c3d2de3dd9e18abac1e753ca727013.zip hdf5-3183d38231c3d2de3dd9e18abac1e753ca727013.tar.gz hdf5-3183d38231c3d2de3dd9e18abac1e753ca727013.tar.bz2 |
[svn-r14103] A user reported that the files generated from Lex and Yacc in the library conflict with his application with Lex and Yacc. To solve the problem of multiple definitions of Lex or Yacc functions or variables, use the -P or -p command option to change the prefix of these functions and variables from yy to H5LTyy.
Tested on kagiso, linew, smirom.
-rw-r--r-- | hl/src/H5LT.c | 4 | ||||
-rw-r--r-- | hl/src/H5LTanalyze.c | 204 | ||||
-rw-r--r-- | hl/src/H5LTanalyze.l | 6 | ||||
-rw-r--r-- | hl/src/H5LTparse.c | 252 | ||||
-rw-r--r-- | hl/src/H5LTparse.h | 21 |
5 files changed, 257 insertions, 230 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index e44a4f6..8ee7fd0 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -1994,7 +1994,7 @@ out: */ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) { - extern int yyparse(void); + extern int H5LTyyparse(void); hid_t type_id; if(lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG) @@ -2008,7 +2008,7 @@ hid_t H5LTtext_to_dtype(const char *text, H5LT_lang_t lang_type) input_len = strlen(text); myinput = strdup(text); - if((type_id = yyparse())<0) + if((type_id = H5LTyyparse())<0) goto out; free(myinput); diff --git a/hl/src/H5LTanalyze.c b/hl/src/H5LTanalyze.c index fd9c145..f46b9ea 100644 --- a/hl/src/H5LTanalyze.c +++ b/hl/src/H5LTanalyze.c @@ -14,16 +14,34 @@ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ /* - * This file was generated by Lex with the command "lex -oH5LTanalyze.c H5LTanalyze.l". - * Do NOT modify it by hand, but in line 33, "#ifndef _WIN32" should be added because + * This file was generated by Lex with the command "lex -PH5LTyy -oH5LTanalyze.c H5LTanalyze.l". + * Do NOT modify it by hand, but in line 52, "#ifndef _WIN32" should be added because * Windows doesn't have unistd.h header file. */ -#line 2 "H5LTanalyze.c" +#define yy_create_buffer H5LTyy_create_buffer +#define yy_delete_buffer H5LTyy_delete_buffer +#define yy_scan_buffer H5LTyy_scan_buffer +#define yy_scan_string H5LTyy_scan_string +#define yy_scan_bytes H5LTyy_scan_bytes +#define yy_flex_debug H5LTyy_flex_debug +#define yy_init_buffer H5LTyy_init_buffer +#define yy_flush_buffer H5LTyy_flush_buffer +#define yy_load_buffer_state H5LTyy_load_buffer_state +#define yy_switch_to_buffer H5LTyy_switch_to_buffer +#define yyin H5LTyyin +#define yyleng H5LTyyleng +#define yylex H5LTyylex +#define yyout H5LTyyout +#define yyrestart H5LTyyrestart +#define yytext H5LTyytext +#define yywrap H5LTyywrap + +#line 20 "H5LTanalyze.c" /* A lexical scanner generated by flex */ /* Scanner skeleton version: - * $Header$ + * $Header: /home/daffy/u0/vern/flex/RCS/flex.skl,v 2.91 96/09/10 16:58:48 vern Exp $ */ #define FLEX_SCANNER @@ -763,6 +781,7 @@ char *yytext; #line 1 "H5LTanalyze.l" #define INITIAL 0 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * * Copyright by the Board of Trustees of the University of Illinois. * * All rights reserved. * * * @@ -772,10 +791,10 @@ char *yytext; * of the source code distribution tree; Copyright.html can be found at the * * root level of an installed copy of the electronic HDF5 document set and * * is linked from the top-level documents page. It can also be found at * - * http://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#line 16 "H5LTanalyze.l" +#line 17 "H5LTanalyze.l" #include <stdlib.h> #include <string.h> #include<hdf5.h> @@ -830,10 +849,10 @@ hbool_t first_quote = 1; /* For Lex and Yacc */ /*int input_len; char *myinput;*/ - + #define TAG_STRING 1 -#line 815 "H5LTanalyze.c" +#line 834 "H5LTanalyze.c" /* Macros after this point can all be overridden by user definitions in * section 1. @@ -984,10 +1003,10 @@ YY_DECL register char *yy_cp = NULL, *yy_bp = NULL; register int yy_act; -#line 75 "H5LTanalyze.l" +#line 76 "H5LTanalyze.l" -#line 969 "H5LTanalyze.c" +#line 988 "H5LTanalyze.c" if ( yy_init ) { @@ -1073,293 +1092,293 @@ do_action: /* This label is used only to access EOF actions. */ { /* beginning of action switch */ case 1: YY_RULE_SETUP -#line 77 "H5LTanalyze.l" +#line 78 "H5LTanalyze.l" {return token(H5T_STD_I8BE_TOKEN);} YY_BREAK case 2: YY_RULE_SETUP -#line 78 "H5LTanalyze.l" +#line 79 "H5LTanalyze.l" {return token(H5T_STD_I8LE_TOKEN);} YY_BREAK case 3: YY_RULE_SETUP -#line 79 "H5LTanalyze.l" +#line 80 "H5LTanalyze.l" {return token(H5T_STD_I16BE_TOKEN);} YY_BREAK case 4: YY_RULE_SETUP -#line 80 "H5LTanalyze.l" +#line 81 "H5LTanalyze.l" {return token(H5T_STD_I16LE_TOKEN);} YY_BREAK case 5: YY_RULE_SETUP -#line 81 "H5LTanalyze.l" +#line 82 "H5LTanalyze.l" {return token(H5T_STD_I32BE_TOKEN);} YY_BREAK case 6: YY_RULE_SETUP -#line 82 "H5LTanalyze.l" +#line 83 "H5LTanalyze.l" {return token(H5T_STD_I32LE_TOKEN);} YY_BREAK case 7: YY_RULE_SETUP -#line 83 "H5LTanalyze.l" +#line 84 "H5LTanalyze.l" {return token(H5T_STD_I64BE_TOKEN);} YY_BREAK case 8: YY_RULE_SETUP -#line 84 "H5LTanalyze.l" +#line 85 "H5LTanalyze.l" {return token(H5T_STD_I64LE_TOKEN);} YY_BREAK case 9: YY_RULE_SETUP -#line 86 "H5LTanalyze.l" +#line 87 "H5LTanalyze.l" {return token(H5T_STD_U8BE_TOKEN);} YY_BREAK case 10: YY_RULE_SETUP -#line 87 "H5LTanalyze.l" +#line 88 "H5LTanalyze.l" {return token(H5T_STD_U8LE_TOKEN);} YY_BREAK case 11: YY_RULE_SETUP -#line 88 "H5LTanalyze.l" +#line 89 "H5LTanalyze.l" {return token(H5T_STD_U16BE_TOKEN);} YY_BREAK case 12: YY_RULE_SETUP -#line 89 "H5LTanalyze.l" +#line 90 "H5LTanalyze.l" {return token(H5T_STD_U16LE_TOKEN);} YY_BREAK case 13: YY_RULE_SETUP -#line 90 "H5LTanalyze.l" +#line 91 "H5LTanalyze.l" {return token(H5T_STD_U32BE_TOKEN);} YY_BREAK case 14: YY_RULE_SETUP -#line 91 "H5LTanalyze.l" +#line 92 "H5LTanalyze.l" {return token(H5T_STD_U32LE_TOKEN);} YY_BREAK case 15: YY_RULE_SETUP -#line 92 "H5LTanalyze.l" +#line 93 "H5LTanalyze.l" {return token(H5T_STD_U64BE_TOKEN);} YY_BREAK case 16: YY_RULE_SETUP -#line 93 "H5LTanalyze.l" +#line 94 "H5LTanalyze.l" {return token(H5T_STD_U64LE_TOKEN);} YY_BREAK case 17: YY_RULE_SETUP -#line 95 "H5LTanalyze.l" +#line 96 "H5LTanalyze.l" {return token(H5T_NATIVE_CHAR_TOKEN);} YY_BREAK case 18: YY_RULE_SETUP -#line 96 "H5LTanalyze.l" +#line 97 "H5LTanalyze.l" {return token(H5T_NATIVE_SCHAR_TOKEN);} YY_BREAK case 19: YY_RULE_SETUP -#line 97 "H5LTanalyze.l" +#line 98 "H5LTanalyze.l" {return token(H5T_NATIVE_UCHAR_TOKEN);} YY_BREAK case 20: YY_RULE_SETUP -#line 98 "H5LTanalyze.l" +#line 99 "H5LTanalyze.l" {return token(H5T_NATIVE_SHORT_TOKEN);} YY_BREAK case 21: YY_RULE_SETUP -#line 99 "H5LTanalyze.l" +#line 100 "H5LTanalyze.l" {return token(H5T_NATIVE_USHORT_TOKEN);} YY_BREAK case 22: YY_RULE_SETUP -#line 100 "H5LTanalyze.l" +#line 101 "H5LTanalyze.l" {return token(H5T_NATIVE_INT_TOKEN);} YY_BREAK case 23: YY_RULE_SETUP -#line 101 "H5LTanalyze.l" +#line 102 "H5LTanalyze.l" {return token(H5T_NATIVE_UINT_TOKEN);} YY_BREAK case 24: YY_RULE_SETUP -#line 102 "H5LTanalyze.l" +#line 103 "H5LTanalyze.l" {return token(H5T_NATIVE_LONG_TOKEN);} YY_BREAK case 25: YY_RULE_SETUP -#line 103 "H5LTanalyze.l" +#line 104 "H5LTanalyze.l" {return token(H5T_NATIVE_ULONG_TOKEN);} YY_BREAK case 26: YY_RULE_SETUP -#line 104 "H5LTanalyze.l" +#line 105 "H5LTanalyze.l" {return token(H5T_NATIVE_LLONG_TOKEN);} YY_BREAK case 27: YY_RULE_SETUP -#line 105 "H5LTanalyze.l" +#line 106 "H5LTanalyze.l" {return token(H5T_NATIVE_ULLONG_TOKEN);} YY_BREAK case 28: YY_RULE_SETUP -#line 107 "H5LTanalyze.l" +#line 108 "H5LTanalyze.l" {return token(H5T_IEEE_F32BE_TOKEN);} YY_BREAK case 29: YY_RULE_SETUP -#line 108 "H5LTanalyze.l" +#line 109 "H5LTanalyze.l" {return token(H5T_IEEE_F32LE_TOKEN);} YY_BREAK case 30: YY_RULE_SETUP -#line 109 "H5LTanalyze.l" +#line 110 "H5LTanalyze.l" {return token(H5T_IEEE_F64BE_TOKEN);} YY_BREAK case 31: YY_RULE_SETUP -#line 110 "H5LTanalyze.l" +#line 111 "H5LTanalyze.l" {return token(H5T_IEEE_F64LE_TOKEN);} YY_BREAK case 32: YY_RULE_SETUP -#line 111 "H5LTanalyze.l" +#line 112 "H5LTanalyze.l" {return token(H5T_NATIVE_FLOAT_TOKEN);} YY_BREAK case 33: YY_RULE_SETUP -#line 112 "H5LTanalyze.l" +#line 113 "H5LTanalyze.l" {return token(H5T_NATIVE_DOUBLE_TOKEN);} YY_BREAK case 34: YY_RULE_SETUP -#line 113 "H5LTanalyze.l" +#line 114 "H5LTanalyze.l" {return token(H5T_NATIVE_LDOUBLE_TOKEN);} YY_BREAK case 35: YY_RULE_SETUP -#line 115 "H5LTanalyze.l" +#line 116 "H5LTanalyze.l" {return token(H5T_STRING_TOKEN);} YY_BREAK case 36: YY_RULE_SETUP -#line 116 "H5LTanalyze.l" +#line 117 "H5LTanalyze.l" {return token(STRSIZE_TOKEN);} YY_BREAK case 37: YY_RULE_SETUP -#line 117 "H5LTanalyze.l" +#line 118 "H5LTanalyze.l" {return token(STRPAD_TOKEN);} YY_BREAK case 38: YY_RULE_SETUP -#line 118 "H5LTanalyze.l" +#line 119 "H5LTanalyze.l" {return token(CSET_TOKEN);} YY_BREAK case 39: YY_RULE_SETUP -#line 119 "H5LTanalyze.l" +#line 120 "H5LTanalyze.l" {return token(CTYPE_TOKEN);} YY_BREAK case 40: YY_RULE_SETUP -#line 120 "H5LTanalyze.l" -{return token(H5T_STR_NULLTERM_TOKEN);} +#line 121 "H5LTanalyze.l" +{return token(H5T_STR_NULLTERM_TOKEN);} YY_BREAK case 41: YY_RULE_SETUP -#line 121 "H5LTanalyze.l" -{return token(H5T_STR_NULLPAD_TOKEN);} +#line 122 "H5LTanalyze.l" +{return token(H5T_STR_NULLPAD_TOKEN);} YY_BREAK case 42: YY_RULE_SETUP -#line 122 "H5LTanalyze.l" -{return token(H5T_STR_SPACEPAD_TOKEN);} +#line 123 "H5LTanalyze.l" +{return token(H5T_STR_SPACEPAD_TOKEN);} YY_BREAK case 43: YY_RULE_SETUP -#line 123 "H5LTanalyze.l" +#line 124 "H5LTanalyze.l" {return token(H5T_CSET_ASCII_TOKEN);} YY_BREAK case 44: YY_RULE_SETUP -#line 124 "H5LTanalyze.l" +#line 125 "H5LTanalyze.l" {return token(H5T_CSET_UTF8_TOKEN);} YY_BREAK case 45: YY_RULE_SETUP -#line 125 "H5LTanalyze.l" +#line 126 "H5LTanalyze.l" {return token(H5T_C_S1_TOKEN);} YY_BREAK case 46: YY_RULE_SETUP -#line 126 "H5LTanalyze.l" +#line 127 "H5LTanalyze.l" {return token(H5T_FORTRAN_S1_TOKEN);} YY_BREAK case 47: YY_RULE_SETUP -#line 127 "H5LTanalyze.l" +#line 128 "H5LTanalyze.l" {return token(H5T_VARIABLE_TOKEN);} YY_BREAK case 48: YY_RULE_SETUP -#line 129 "H5LTanalyze.l" +#line 130 "H5LTanalyze.l" {return token(H5T_COMPOUND_TOKEN);} YY_BREAK case 49: YY_RULE_SETUP -#line 130 "H5LTanalyze.l" +#line 131 "H5LTanalyze.l" {return token(H5T_ENUM_TOKEN);} YY_BREAK case 50: YY_RULE_SETUP -#line 131 "H5LTanalyze.l" +#line 132 "H5LTanalyze.l" {return token(H5T_ARRAY_TOKEN);} YY_BREAK case 51: YY_RULE_SETUP -#line 132 "H5LTanalyze.l" +#line 133 "H5LTanalyze.l" {return token(H5T_VLEN_TOKEN);} YY_BREAK case 52: YY_RULE_SETUP -#line 134 "H5LTanalyze.l" +#line 135 "H5LTanalyze.l" {return token(H5T_OPAQUE_TOKEN);} YY_BREAK case 53: YY_RULE_SETUP -#line 135 "H5LTanalyze.l" +#line 136 "H5LTanalyze.l" {return token(OPQ_SIZE_TOKEN);} YY_BREAK case 54: YY_RULE_SETUP -#line 136 "H5LTanalyze.l" +#line 137 "H5LTanalyze.l" {return token(OPQ_TAG_TOKEN);} YY_BREAK case 55: YY_RULE_SETUP -#line 138 "H5LTanalyze.l" -{ - if( is_str_size || (is_enum && is_enum_memb) || +#line 139 "H5LTanalyze.l" +{ + if( is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || (csindex>-1 && cmpd_stack[csindex].is_field) ) { - yylval.ival = atoi(yytext); - return NUMBER; + H5LTyylval.ival = atoi(yytext); + return NUMBER; } else REJECT; } YY_BREAK case 56: YY_RULE_SETUP -#line 148 "H5LTanalyze.l" +#line 149 "H5LTanalyze.l" { /*if it's first quote, and is a compound field name or an enum symbol*/ - if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) + if((is_opq_tag || is_enum || (csindex>-1 && cmpd_stack[csindex].is_field)) && first_quote) { first_quote = 0; BEGIN TAG_STRING; @@ -1370,59 +1389,59 @@ YY_RULE_SETUP YY_BREAK case 57: YY_RULE_SETUP -#line 158 "H5LTanalyze.l" +#line 159 "H5LTanalyze.l" { - yylval.sval = strdup(yytext); + H5LTyylval.sval = strdup(yytext); BEGIN INITIAL; return STRING; } YY_BREAK case 58: YY_RULE_SETUP -#line 164 "H5LTanalyze.l" +#line 165 "H5LTanalyze.l" {return token('{');} YY_BREAK case 59: YY_RULE_SETUP -#line 165 "H5LTanalyze.l" +#line 166 "H5LTanalyze.l" {return token('}');} YY_BREAK case 60: YY_RULE_SETUP -#line 166 "H5LTanalyze.l" +#line 167 "H5LTanalyze.l" {return token('[');} YY_BREAK case 61: YY_RULE_SETUP -#line 167 "H5LTanalyze.l" +#line 168 "H5LTanalyze.l" {return token(']');} YY_BREAK case 62: YY_RULE_SETUP -#line 168 "H5LTanalyze.l" +#line 169 "H5LTanalyze.l" {return token(':');} YY_BREAK case 63: YY_RULE_SETUP -#line 169 "H5LTanalyze.l" +#line 170 "H5LTanalyze.l" {return token(';');} YY_BREAK case 64: YY_RULE_SETUP -#line 170 "H5LTanalyze.l" +#line 171 "H5LTanalyze.l" ; YY_BREAK case 65: YY_RULE_SETUP -#line 171 "H5LTanalyze.l" +#line 172 "H5LTanalyze.l" { return 0; } YY_BREAK case 66: YY_RULE_SETUP -#line 173 "H5LTanalyze.l" +#line 174 "H5LTanalyze.l" ECHO; YY_BREAK -#line 1404 "H5LTanalyze.c" +#line 1423 "H5LTanalyze.c" case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(TAG_STRING): yyterminate(); @@ -1799,6 +1818,7 @@ register char *yy_bp; #endif /* ifndef YY_NO_UNPUT */ +#ifndef YY_NO_INPUT #ifdef __cplusplus static int yyinput() #else @@ -1870,7 +1890,7 @@ static int input() return c; } - +#endif /* YY_NO_INPUT */ #ifdef YY_USE_PROTOS void yyrestart( FILE *input_file ) @@ -2298,18 +2318,18 @@ int main() return 0; } #endif -#line 173 "H5LTanalyze.l" +#line 174 "H5LTanalyze.l" int my_yyinput(char *buf, int max_size) { int ret; - - memcpy(buf, myinput, input_len); + + memcpy(buf, myinput, input_len); ret = input_len; return ret; } -int yyerror(char *msg) +int H5LTyyerror(char *msg) { printf("ERROR: %s before \"%s\".\n", msg, yytext); } diff --git a/hl/src/H5LTanalyze.l b/hl/src/H5LTanalyze.l index 8054807..dbba15a 100644 --- a/hl/src/H5LTanalyze.l +++ b/hl/src/H5LTanalyze.l @@ -140,7 +140,7 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} if( is_str_size || (is_enum && is_enum_memb) || is_opq_size || (asindex>-1 && arr_stack[asindex].is_dim) || (csindex>-1 && cmpd_stack[csindex].is_field) ) { - yylval.ival = atoi(yytext); + H5LTyylval.ival = atoi(yytext); return NUMBER; } else REJECT; @@ -157,7 +157,7 @@ OPQ_TAG {return token(OPQ_TAG_TOKEN);} return token('"'); } <TAG_STRING>[^\"]+ { - yylval.sval = strdup(yytext); + H5LTyylval.sval = strdup(yytext); BEGIN INITIAL; return STRING; } @@ -181,7 +181,7 @@ int my_yyinput(char *buf, int max_size) return ret; } -int yyerror(char *msg) +int H5LTyyerror(char *msg) { printf("ERROR: %s before \"%s\".\n", msg, yytext); } diff --git a/hl/src/H5LTparse.c b/hl/src/H5LTparse.c index 10c6bb2..b146046 100644 --- a/hl/src/H5LTparse.c +++ b/hl/src/H5LTparse.c @@ -13,12 +13,12 @@ * access to either file, you may request a copy from help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -/* This file was generated by Yacc with the command "yacc -o H5LTparse.c -d H5LTparse.y" +/* This file was generated by Yacc with the command "yacc -pH5LTyy -o H5LTparse.c -d H5LTparse.y" * Do NOT modify it by hand. */ #ifndef lint -static char const +static char const yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $"; #endif #include <stdlib.h> @@ -31,8 +31,34 @@ yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bd #define yyerrok (yyerrflag=0) #define YYRECOVERING() (yyerrflag!=0) static int yygrowstack(); -#define YYPREFIX "yy" -#line 16 "H5LTparse.y" +#define yyparse H5LTyyparse +#define yylex H5LTyylex +#define yyerror H5LTyyerror +#define yychar H5LTyychar +#define yyval H5LTyyval +#define yylval H5LTyylval +#define yydebug H5LTyydebug +#define yynerrs H5LTyynerrs +#define yyerrflag H5LTyyerrflag +#define yyss H5LTyyss +#define yyssp H5LTyyssp +#define yyvs H5LTyyvs +#define yyvsp H5LTyyvsp +#define yylhs H5LTyylhs +#define yylen H5LTyylen +#define yydefred H5LTyydefred +#define yydgoto H5LTyydgoto +#define yysindex H5LTyysindex +#define yyrindex H5LTyyrindex +#define yygindex H5LTyygindex +#define yytable H5LTyytable +#define yycheck H5LTyycheck +#define yyname H5LTyyname +#define yyrule H5LTyyrule +#define yysslim H5LTyysslim +#define yystacksize H5LTyystacksize +#define YYPREFIX "H5LTyy" +#line 17 "H5LTparse.y" #include<stdio.h> #include<string.h> #include<hdf5.h> @@ -66,7 +92,7 @@ struct arr_info { }; /*stack for nested array type*/ struct arr_info arr_stack[STACK_SIZE]; -int asindex = -1; /*pointer to the top of array stack*/ +int asindex = -1; /*pointer to the top of array stack*/ hbool_t is_str_size = 0; /*flag to lexer for string size*/ hbool_t is_str_pad = 0; /*flag to lexer for string padding*/ @@ -74,7 +100,7 @@ H5T_pad_t str_pad; /*variable for string padding*/ H5T_cset_t str_cset; /*variable for string character set*/ hbool_t is_variable = 0; /*variable for variable-length string*/ size_t str_size; /*variable for string size*/ - + hid_t enum_id; /*type ID*/ hbool_t is_enum = 0; /*flag to lexer for enum type*/ hbool_t is_enum_memb = 0; /*flag to lexer for enum member*/ @@ -83,12 +109,12 @@ char* enum_memb_symbol; /*enum member symbol string*/ hbool_t is_opq_size = 0; /*flag to lexer for opaque type size*/ hbool_t is_opq_tag = 0; /*flag to lexer for opaque type tag*/ -#line 67 "H5LTparse.y" +#line 68 "H5LTparse.y" typedef union { int ival; /*for integer token*/ char *sval; /*for name string*/ } YYSTYPE; -#line 73 "H5LTparse.c" +#line 99 "H5LTparse.c" #define YYERRCODE 256 #define H5T_STD_I8BE_TOKEN 257 #define H5T_STD_I8LE_TOKEN 258 @@ -146,7 +172,7 @@ typedef union { #define H5T_VLEN_TOKEN 310 #define STRING 311 #define NUMBER 312 -const short yylhs[] = { -1, +const short H5LTyylhs[] = { -1, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 2, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, @@ -158,7 +184,7 @@ const short yylhs[] = { -1, 33, 33, 35, 35, 37, 37, 40, 9, 39, 39, 44, 41, 42, 43, }; -const short yylen[] = { 2, +const short H5LTyylen[] = { 2, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -170,7 +196,7 @@ const short yylen[] = { 2, 1, 1, 1, 1, 1, 1, 0, 7, 0, 2, 0, 6, 1, 1, }; -const short yydefred[] = { 0, +const short H5LTyydefred[] = { 0, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, @@ -187,14 +213,14 @@ const short yydefred[] = { 0, 75, 0, 0, 69, 0, 85, 86, 0, 76, 0, 77, }; -const short yydgoto[] = { 41, +const short H5LTyydgoto[] = { 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 54, 66, 77, 84, 99, 114, 120, 56, 68, 81, 95, 86, 102, 74, 65, 89, 107, 118, 132, 72, 64, 88, 106, 116, 129, 133, 138, 140, 85, 78, 93, 101, 123, 115, }; -const short yysindex[] = { -255, +const short H5LTyysindex[] = { -255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -211,7 +237,7 @@ const short yysindex[] = { -255, 0, -7, -176, 0, -252, 0, 0, 61, 0, -4, 0, }; -const short yyrindex[] = { 122, +const short H5LTyyrindex[] = { 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -228,7 +254,7 @@ const short yyrindex[] = { 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, }; -const short yygindex[] = { 0, +const short H5LTyygindex[] = { 0, -20, 0, 0, 0, 0, 71, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -236,7 +262,7 @@ const short yygindex[] = { 0, 0, 0, 0, 0, }; #define YYTABLESIZE 273 -const short yytable[] = { 79, +const short H5LTyytable[] = { 79, 92, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, @@ -266,7 +292,7 @@ const short yytable[] = { 79, 0, 0, 0, 0, 0, 0, 36, 0, 0, 37, 38, 39, 40, }; -const short yycheck[] = { 91, +const short H5LTyycheck[] = { 91, 34, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, @@ -302,7 +328,7 @@ const short yycheck[] = { 91, #endif #define YYMAXTOKEN 312 #if YYDEBUG -const char * const yyname[] = { +const char * const H5LTyyname[] = { "end-of-file",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, "'\"'",0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"':'","';'",0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"'['",0,"']'",0,0,0,0,0,0,0,0,0, @@ -328,7 +354,7 @@ const char * const yyname[] = { "H5T_OPAQUE_TOKEN","OPQ_SIZE_TOKEN","OPQ_TAG_TOKEN","H5T_COMPOUND_TOKEN", "H5T_ENUM_TOKEN","H5T_ARRAY_TOKEN","H5T_VLEN_TOKEN","STRING","NUMBER", }; -const char * const yyrule[] = { +const char * const H5LTyyrule[] = { "$accept : start", "start :", "start : ddl_type", @@ -648,168 +674,168 @@ yyreduce: switch (yyn) { case 1: -#line 99 "H5LTparse.y" +#line 100 "H5LTparse.y" { memset(arr_stack, 0, STACK_SIZE*sizeof(struct arr_info)); /*initialize here?*/ } break; case 2: -#line 100 "H5LTparse.y" +#line 101 "H5LTparse.y" { return yyval.ival;} break; case 12: -#line 114 "H5LTparse.y" +#line 115 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_I8BE); } break; case 13: -#line 115 "H5LTparse.y" +#line 116 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_I8LE); } break; case 14: -#line 116 "H5LTparse.y" +#line 117 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_I16BE); } break; case 15: -#line 117 "H5LTparse.y" +#line 118 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_I16LE); } break; case 16: -#line 118 "H5LTparse.y" +#line 119 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_I32BE); } break; case 17: -#line 119 "H5LTparse.y" +#line 120 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_I32LE); } break; case 18: -#line 120 "H5LTparse.y" +#line 121 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_I64BE); } break; case 19: -#line 121 "H5LTparse.y" +#line 122 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_I64LE); } break; case 20: -#line 122 "H5LTparse.y" +#line 123 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_U8BE); } break; case 21: -#line 123 "H5LTparse.y" +#line 124 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_U8LE); } break; case 22: -#line 124 "H5LTparse.y" +#line 125 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_U16BE); } break; case 23: -#line 125 "H5LTparse.y" +#line 126 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_U16LE); } break; case 24: -#line 126 "H5LTparse.y" +#line 127 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_U32BE); } break; case 25: -#line 127 "H5LTparse.y" +#line 128 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_U32LE); } break; case 26: -#line 128 "H5LTparse.y" +#line 129 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_U64BE); } break; case 27: -#line 129 "H5LTparse.y" +#line 130 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_STD_U64LE); } break; case 28: -#line 130 "H5LTparse.y" +#line 131 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_CHAR); } break; case 29: -#line 131 "H5LTparse.y" +#line 132 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_SCHAR); } break; case 30: -#line 132 "H5LTparse.y" +#line 133 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_UCHAR); } break; case 31: -#line 133 "H5LTparse.y" +#line 134 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_SHORT); } break; case 32: -#line 134 "H5LTparse.y" +#line 135 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_USHORT); } break; case 33: -#line 135 "H5LTparse.y" +#line 136 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_INT); } break; case 34: -#line 136 "H5LTparse.y" +#line 137 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_UINT); } break; case 35: -#line 137 "H5LTparse.y" +#line 138 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_LONG); } break; case 36: -#line 138 "H5LTparse.y" +#line 139 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_ULONG); } break; case 37: -#line 139 "H5LTparse.y" +#line 140 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_LLONG); } break; case 38: -#line 140 "H5LTparse.y" +#line 141 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_ULLONG); } break; case 39: -#line 143 "H5LTparse.y" +#line 144 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_IEEE_F32BE); } break; case 40: -#line 144 "H5LTparse.y" +#line 145 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_IEEE_F32LE); } break; case 41: -#line 145 "H5LTparse.y" +#line 146 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_IEEE_F64BE); } break; case 42: -#line 146 "H5LTparse.y" +#line 147 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_IEEE_F64LE); } break; case 43: -#line 147 "H5LTparse.y" +#line 148 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_FLOAT); } break; case 44: -#line 148 "H5LTparse.y" +#line 149 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_DOUBLE); } break; case 45: -#line 149 "H5LTparse.y" +#line 150 "H5LTparse.y" { yyval.ival = H5Tcopy(H5T_NATIVE_LDOUBLE); } break; case 46: -#line 153 "H5LTparse.y" +#line 154 "H5LTparse.y" { csindex++; cmpd_stack[csindex].id = H5Tcreate(H5T_COMPOUND, 1); /*temporarily set size to 1*/ } break; case 47: -#line 155 "H5LTparse.y" -{ yyval.ival = cmpd_stack[csindex].id; +#line 156 "H5LTparse.y" +{ yyval.ival = cmpd_stack[csindex].id; cmpd_stack[csindex].id = 0; - cmpd_stack[csindex].first_memb = 1; + cmpd_stack[csindex].first_memb = 1; csindex--; } break; case 50: -#line 164 "H5LTparse.y" +#line 165 "H5LTparse.y" { cmpd_stack[csindex].is_field = 1; /*notify lexer a compound member is parsed*/ } break; case 51: -#line 166 "H5LTparse.y" -{ +#line 167 "H5LTparse.y" +{ size_t origin_size, new_size; hid_t dtype_id = cmpd_stack[csindex].id; @@ -823,7 +849,7 @@ case 51: cmpd_stack[csindex].first_memb = 0; } else { origin_size = H5Tget_size(dtype_id); - + if(yyvsp[-1].ival == 0) { new_size = origin_size + H5Tget_size(yyvsp[-6].ival); H5Tset_size(dtype_id, new_size); @@ -834,34 +860,34 @@ case 51: H5Tinsert(dtype_id, yyvsp[-3].sval, yyvsp[-1].ival, yyvsp[-6].ival); } } - + cmpd_stack[csindex].is_field = 0; H5Tclose(yyvsp[-6].ival); - + new_size = H5Tget_size(dtype_id); } break; case 52: -#line 199 "H5LTparse.y" +#line 200 "H5LTparse.y" { yyval.sval = yylval.sval; } break; case 53: -#line 204 "H5LTparse.y" +#line 205 "H5LTparse.y" { yyval.ival = 0; } break; case 54: -#line 206 "H5LTparse.y" +#line 207 "H5LTparse.y" { yyval.ival = yylval.ival; } break; case 56: -#line 210 "H5LTparse.y" +#line 211 "H5LTparse.y" { asindex++; /*pushd onto the stack*/ } break; case 57: -#line 212 "H5LTparse.y" -{ +#line 213 "H5LTparse.y" +{ yyval.ival = H5Tarray_create(yyvsp[-1].ival, arr_stack[asindex].ndims, arr_stack[asindex].dims, NULL); arr_stack[asindex].ndims = 0; asindex--; @@ -869,64 +895,64 @@ case 57: } break; case 60: -#line 222 "H5LTparse.y" +#line 223 "H5LTparse.y" { arr_stack[asindex].is_dim = 1; /*notice lexer of dimension size*/ } break; case 61: -#line 223 "H5LTparse.y" +#line 224 "H5LTparse.y" { unsigned ndims = arr_stack[asindex].ndims; - arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; + arr_stack[asindex].dims[ndims] = (hsize_t)yylval.ival; arr_stack[asindex].ndims++; - arr_stack[asindex].is_dim = 0; + arr_stack[asindex].is_dim = 0; } break; case 64: -#line 234 "H5LTparse.y" +#line 235 "H5LTparse.y" { yyval.ival = H5Tvlen_create(yyvsp[-1].ival); H5Tclose(yyvsp[-1].ival); } break; case 65: -#line 239 "H5LTparse.y" +#line 240 "H5LTparse.y" { is_opq_size = 1; } break; case 66: -#line 240 "H5LTparse.y" -{ +#line 241 "H5LTparse.y" +{ size_t size = (size_t)yylval.ival; yyval.ival = H5Tcreate(H5T_OPAQUE, size); - is_opq_size = 0; + is_opq_size = 0; } break; case 67: -#line 245 "H5LTparse.y" +#line 246 "H5LTparse.y" { is_opq_tag = 1; } break; case 68: -#line 246 "H5LTparse.y" -{ +#line 247 "H5LTparse.y" +{ H5Tset_tag(yyvsp[-6].ival, yylval.sval); is_opq_tag = 0; } break; case 69: -#line 250 "H5LTparse.y" +#line 251 "H5LTparse.y" { yyval.ival = yyvsp[-8].ival; } break; case 72: -#line 258 "H5LTparse.y" +#line 259 "H5LTparse.y" { is_str_size = 1; } break; case 73: -#line 259 "H5LTparse.y" -{ +#line 260 "H5LTparse.y" +{ if(yyvsp[-1].ival == H5T_VARIABLE_TOKEN) is_variable = 1; - else + else str_size = yylval.ival; - is_str_size = 0; + is_str_size = 0; } break; case 74: -#line 267 "H5LTparse.y" +#line 268 "H5LTparse.y" { if(yyvsp[-1].ival == H5T_STR_NULLTERM_TOKEN) str_pad = H5T_STR_NULLTERM; @@ -937,8 +963,8 @@ case 74: } break; case 75: -#line 276 "H5LTparse.y" -{ +#line 277 "H5LTparse.y" +{ if(yyvsp[-1].ival == H5T_CSET_ASCII_TOKEN) str_cset = H5T_CSET_ASCII; else if(yyvsp[-1].ival == H5T_CSET_UTF8_TOKEN) @@ -946,7 +972,7 @@ case 75: } break; case 76: -#line 283 "H5LTparse.y" +#line 284 "H5LTparse.y" { if(yyvsp[-1].ival == H5T_C_S1_TOKEN) yyval.ival = H5Tcopy(H5T_C_S1); @@ -955,8 +981,8 @@ case 76: } break; case 77: -#line 290 "H5LTparse.y" -{ +#line 291 "H5LTparse.y" +{ hid_t str_id = yyvsp[-1].ival; /*set string size*/ @@ -965,63 +991,63 @@ case 77: is_variable = 0; } else H5Tset_size(str_id, str_size); - + /*set string padding and character set*/ H5Tset_strpad(str_id, str_pad); H5Tset_cset(str_id, str_cset); - yyval.ival = str_id; + yyval.ival = str_id; } break; case 78: -#line 307 "H5LTparse.y" +#line 308 "H5LTparse.y" {yyval.ival = H5T_VARIABLE_TOKEN;} break; case 80: -#line 310 "H5LTparse.y" +#line 311 "H5LTparse.y" {yyval.ival = H5T_STR_NULLTERM_TOKEN;} break; case 81: -#line 311 "H5LTparse.y" +#line 312 "H5LTparse.y" {yyval.ival = H5T_STR_NULLPAD_TOKEN;} break; case 82: -#line 312 "H5LTparse.y" +#line 313 "H5LTparse.y" {yyval.ival = H5T_STR_SPACEPAD_TOKEN;} break; case 83: -#line 314 "H5LTparse.y" +#line 315 "H5LTparse.y" {yyval.ival = H5T_CSET_ASCII_TOKEN;} break; case 84: -#line 315 "H5LTparse.y" +#line 316 "H5LTparse.y" {yyval.ival = H5T_CSET_UTF8_TOKEN;} break; case 85: -#line 317 "H5LTparse.y" +#line 318 "H5LTparse.y" {yyval.ival = H5T_C_S1_TOKEN;} break; case 86: -#line 318 "H5LTparse.y" +#line 319 "H5LTparse.y" {yyval.ival = H5T_FORTRAN_S1_TOKEN;} break; case 87: -#line 322 "H5LTparse.y" +#line 323 "H5LTparse.y" { is_enum = 1; enum_id = H5Tenum_create(yyvsp[-1].ival); H5Tclose(yyvsp[-1].ival); } break; case 88: -#line 324 "H5LTparse.y" +#line 325 "H5LTparse.y" { is_enum = 0; /*reset*/ yyval.ival = enum_id; } break; case 91: -#line 329 "H5LTparse.y" +#line 330 "H5LTparse.y" { is_enum_memb = 1; /*indicate member of enum*/ - enum_memb_symbol = strdup(yylval.sval); + enum_memb_symbol = strdup(yylval.sval); } break; case 92: -#line 334 "H5LTparse.y" +#line 335 "H5LTparse.y" { char char_val=(char)yylval.ival; short short_val=(short)yylval.ival; @@ -1030,7 +1056,7 @@ case 92: long_long llong_val=(long_long)yylval.ival; hid_t super = H5Tget_super(enum_id); hid_t native = H5Tget_native_type(super, H5T_DIR_ASCEND); - + if(is_enum && is_enum_memb) { /*if it's an enum member*/ /*To handle machines of different endianness*/ if(H5Tequal(native, H5T_NATIVE_SCHAR) || H5Tequal(native, H5T_NATIVE_UCHAR)) @@ -1044,7 +1070,7 @@ case 92: else if(H5Tequal(native, H5T_NATIVE_LLONG) || H5Tequal(native, H5T_NATIVE_ULLONG)) H5Tenum_insert(enum_id, enum_memb_symbol, &llong_val); - is_enum_memb = 0; + is_enum_memb = 0; if(enum_memb_symbol) free(enum_memb_symbol); } @@ -1052,7 +1078,7 @@ case 92: H5Tclose(native); } break; -#line 1037 "H5LTparse.c" +#line 1063 "H5LTparse.c" } yyssp -= yym; yystate = *yyssp; diff --git a/hl/src/H5LTparse.h b/hl/src/H5LTparse.h index 6cc9749..2dd8057 100644 --- a/hl/src/H5LTparse.h +++ b/hl/src/H5LTparse.h @@ -1,22 +1,3 @@ -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * Copyright by The HDF Group. * - * Copyright by the Board of Trustees of the University of Illinois. * - * All rights reserved. * - * * - * This file is part of HDF5. The full HDF5 copyright notice, including * - * terms governing use, modification, and redistribution, is contained in * - * the files COPYING and Copyright.html. COPYING can be found at the root * - * of the source code distribution tree; Copyright.html can be found at the * - * root level of an installed copy of the electronic HDF5 document set and * - * is linked from the top-level documents page. It can also be found at * - * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have * - * access to either file, you may request a copy from help@hdfgroup.org. * - * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ - -/* This file was generated by Yacc with the command "yacc -o H5LTparse.c -d H5LTparse.y" - * Do NOT modify it by hand. - */ - #ifndef YYERRCODE #define YYERRCODE 256 #endif @@ -81,4 +62,4 @@ typedef union { int ival; /*for integer token*/ char *sval; /*for name string*/ } YYSTYPE; -extern YYSTYPE yylval; +extern YYSTYPE H5LTyylval; |