expr*.cをMinGWでつくったものでさしかえ
R245のtranslate.cを取り込み
@@ -148,7 +148,7 @@ | ||
148 | 148 | typedef union YYSTYPE |
149 | 149 | { |
150 | 150 | |
151 | -/* Line 214 of yacc.c */ | |
151 | +/* Line 222 of yacc.c */ | |
152 | 152 | #line 43 "expr_parse.y" |
153 | 153 | |
154 | 154 | int a; |
@@ -160,7 +160,7 @@ | ||
160 | 160 | |
161 | 161 | |
162 | 162 | |
163 | -/* Line 214 of yacc.c */ | |
163 | +/* Line 222 of yacc.c */ | |
164 | 164 | #line 165 "expr_parse.c" |
165 | 165 | } YYSTYPE; |
166 | 166 | # define YYSTYPE_IS_TRIVIAL 1 |
@@ -54,7 +54,6 @@ | ||
54 | 54 | typedef unsigned char flex_uint8_t; |
55 | 55 | typedef unsigned short int flex_uint16_t; |
56 | 56 | typedef unsigned int flex_uint32_t; |
57 | -#endif /* ! C99 */ | |
58 | 57 | |
59 | 58 | /* Limits of integral types. */ |
60 | 59 | #ifndef INT8_MIN |
@@ -85,6 +84,8 @@ | ||
85 | 84 | #define UINT32_MAX (4294967295U) |
86 | 85 | #endif |
87 | 86 | |
87 | +#endif /* ! C99 */ | |
88 | + | |
88 | 89 | #endif /* ! FLEXINT_H */ |
89 | 90 | |
90 | 91 | #ifdef __cplusplus |
@@ -141,7 +142,15 @@ | ||
141 | 142 | |
142 | 143 | /* Size of default input buffer. */ |
143 | 144 | #ifndef YY_BUF_SIZE |
145 | +#ifdef __ia64__ | |
146 | +/* On IA-64, the buffer size is 16k, not 8k. | |
147 | + * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | |
148 | + * Ditto for the __ia64__ case accordingly. | |
149 | + */ | |
150 | +#define YY_BUF_SIZE 32768 | |
151 | +#else | |
144 | 152 | #define YY_BUF_SIZE 16384 |
153 | +#endif /* __ia64__ */ | |
145 | 154 | #endif |
146 | 155 | |
147 | 156 | /* The state buf must be large enough to hold one state per character in the main buffer. |
@@ -1948,16 +1957,16 @@ | ||
1948 | 1957 | #define YY_RESTORE_YY_MORE_OFFSET |
1949 | 1958 | char *yytext; |
1950 | 1959 | #line 1 "expr_scan.lex" |
1951 | -/*********************************************************************** | |
1952 | - * | |
1953 | - * file: expr_scan.lex | |
1954 | - * | |
1955 | - * 単純なスキャナ | |
1956 | - * | |
1957 | - */ | |
1960 | +/*********************************************************************** | |
1961 | + * | |
1962 | + * file: expr_scan.lex | |
1963 | + * | |
1964 | + * 単純なスキャナ | |
1965 | + * | |
1966 | + */ | |
1967 | + | |
1968 | +#line 1969 "expr_scan.c" | |
1958 | 1969 | |
1959 | -#line 1960 "expr_scan.c" | |
1960 | - | |
1961 | 1970 | #define INITIAL 0 |
1962 | 1971 | #define EXPR_SET 1 |
1963 | 1972 |
@@ -2038,7 +2047,12 @@ | ||
2038 | 2047 | |
2039 | 2048 | /* Amount of stuff to slurp up with each read. */ |
2040 | 2049 | #ifndef YY_READ_BUF_SIZE |
2050 | +#ifdef __ia64__ | |
2051 | +/* On IA-64, the buffer size is 16k, not 8k */ | |
2052 | +#define YY_READ_BUF_SIZE 16384 | |
2053 | +#else | |
2041 | 2054 | #define YY_READ_BUF_SIZE 8192 |
2055 | +#endif /* __ia64__ */ | |
2042 | 2056 | #endif |
2043 | 2057 | |
2044 | 2058 | /* Copy whatever the last rule matched to the standard output. */ |
@@ -2046,7 +2060,7 @@ | ||
2046 | 2060 | /* This used to be an fputs(), but since the string might contain NUL's, |
2047 | 2061 | * we now use fwrite(). |
2048 | 2062 | */ |
2049 | -#define ECHO fwrite( yytext, yyleng, 1, yyout ) | |
2063 | +#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) | |
2050 | 2064 | #endif |
2051 | 2065 | |
2052 | 2066 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
@@ -2057,7 +2071,7 @@ | ||
2057 | 2071 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
2058 | 2072 | { \ |
2059 | 2073 | int c = '*'; \ |
2060 | - int n; \ | |
2074 | + size_t n; \ | |
2061 | 2075 | for ( n = 0; n < max_size && \ |
2062 | 2076 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
2063 | 2077 | buf[n] = (char) c; \ |
@@ -2141,9 +2155,9 @@ | ||
2141 | 2155 | |
2142 | 2156 | #line 33 "expr_scan.lex" |
2143 | 2157 | |
2158 | + | |
2159 | +#line 2160 "expr_scan.c" | |
2144 | 2160 | |
2145 | -#line 2146 "expr_scan.c" | |
2146 | - | |
2147 | 2161 | if ( !(yy_init) ) |
2148 | 2162 | { |
2149 | 2163 | (yy_init) = 1; |
@@ -2228,134 +2242,134 @@ | ||
2228 | 2242 | case 1: |
2229 | 2243 | YY_RULE_SETUP |
2230 | 2244 | #line 35 "expr_scan.lex" |
2231 | -comment( yytext ); | |
2245 | +comment( yytext ); | |
2232 | 2246 | YY_BREAK |
2233 | 2247 | case 2: |
2234 | 2248 | YY_RULE_SETUP |
2235 | 2249 | #line 37 "expr_scan.lex" |
2236 | -expr_error("ターゲット<%s:%d文字くらい>は明らかに長すぎるので無視!", yytext, yyleng); return JUNK; | |
2250 | +expr_error("ターゲット<%s:%d文字くらい>は明らかに長すぎるので無視!", yytext, yyleng); return JUNK; | |
2237 | 2251 | YY_BREAK |
2238 | 2252 | case 3: |
2239 | 2253 | YY_RULE_SETUP |
2240 | 2254 | #line 39 "expr_scan.lex" |
2241 | -return mkdict(CA_U, 1); | |
2255 | +return mkdict(CA_U, 1); | |
2242 | 2256 | YY_BREAK |
2243 | 2257 | case 4: |
2244 | 2258 | YY_RULE_SETUP |
2245 | 2259 | #line 40 "expr_scan.lex" |
2246 | -return mkdict(CA_U, 0); | |
2260 | +return mkdict(CA_U, 0); | |
2247 | 2261 | YY_BREAK |
2248 | 2262 | case 5: |
2249 | 2263 | YY_RULE_SETUP |
2250 | 2264 | #line 42 "expr_scan.lex" |
2251 | -return mkdict(CA_C, 1); | |
2265 | +return mkdict(CA_C, 1); | |
2252 | 2266 | YY_BREAK |
2253 | 2267 | case 6: |
2254 | 2268 | YY_RULE_SETUP |
2255 | 2269 | #line 43 "expr_scan.lex" |
2256 | -return mkdict(CA_C, 0); | |
2270 | +return mkdict(CA_C, 0); | |
2257 | 2271 | YY_BREAK |
2258 | 2272 | case 7: |
2259 | 2273 | YY_RULE_SETUP |
2260 | 2274 | #line 45 "expr_scan.lex" |
2261 | -return mkdict(CA_A, 1); | |
2275 | +return mkdict(CA_A, 1); | |
2262 | 2276 | YY_BREAK |
2263 | 2277 | case 8: |
2264 | 2278 | YY_RULE_SETUP |
2265 | 2279 | #line 46 "expr_scan.lex" |
2266 | -return mkdict(CA_A, 0); | |
2280 | +return mkdict(CA_A, 0); | |
2267 | 2281 | YY_BREAK |
2268 | 2282 | case 9: |
2269 | 2283 | YY_RULE_SETUP |
2270 | 2284 | #line 48 "expr_scan.lex" |
2271 | -expr_error("ターゲット<%s:%d文字>は明らかに長すぎるので無視!", yytext, yyleng); return JUNK; | |
2285 | +expr_error("ターゲット<%s:%d文字>は明らかに長すぎるので無視!", yytext, yyleng); return JUNK; | |
2272 | 2286 | YY_BREAK |
2273 | 2287 | case 10: |
2274 | 2288 | YY_RULE_SETUP |
2275 | 2289 | #line 50 "expr_scan.lex" |
2276 | -return mkchx(yytext[1], 1); | |
2290 | +return mkchx(yytext[1], 1); | |
2277 | 2291 | YY_BREAK |
2278 | 2292 | case 11: |
2279 | 2293 | YY_RULE_SETUP |
2280 | 2294 | #line 51 "expr_scan.lex" |
2281 | -return mkchx(yytext[1], 0); | |
2295 | +return mkchx(yytext[1], 0); | |
2282 | 2296 | YY_BREAK |
2283 | 2297 | case 12: |
2284 | 2298 | YY_RULE_SETUP |
2285 | 2299 | #line 53 "expr_scan.lex" |
2286 | -BEGIN(0); | |
2300 | +BEGIN(0); | |
2287 | 2301 | YY_BREAK |
2288 | 2302 | case 13: |
2289 | 2303 | YY_RULE_SETUP |
2290 | 2304 | #line 54 "expr_scan.lex" |
2291 | -yylval.bmp = mkrng(cv64(yytext[0]), cv64(yytext[2])); return RNGS; | |
2305 | +yylval.bmp = mkrng(cv64(yytext[0]), cv64(yytext[2])); return RNGS; | |
2292 | 2306 | YY_BREAK |
2293 | 2307 | case 14: |
2294 | 2308 | YY_RULE_SETUP |
2295 | 2309 | #line 55 "expr_scan.lex" |
2296 | -yylval.bmp = mkrng(cv64(yytext[0]), (unsigned)-1); return RNGS; | |
2310 | +yylval.bmp = mkrng(cv64(yytext[0]), (unsigned)-1); return RNGS; | |
2297 | 2311 | YY_BREAK |
2298 | 2312 | case 15: |
2299 | 2313 | /* rule 15 can match eol */ |
2300 | 2314 | YY_RULE_SETUP |
2301 | 2315 | #line 56 "expr_scan.lex" |
2302 | -BEGIN(0); expr_error("範囲指定の中で改行するなんて…"); g_lineno++; | |
2316 | +BEGIN(0); expr_error("範囲指定の中で改行するなんて…"); g_lineno++; | |
2303 | 2317 | YY_BREAK |
2304 | 2318 | case 16: |
2305 | 2319 | YY_RULE_SETUP |
2306 | 2320 | #line 57 "expr_scan.lex" |
2307 | -BEGIN(0); expr_error("文字<%c%c(0x%02X%02X)>は範囲指定に含めるワケにはいかないので無視します。", yytext[0], yytext[1], yytext[0] & 0xFF, yytext[1] & 0xFF); | |
2321 | +BEGIN(0); expr_error("文字<%c%c(0x%02X%02X)>は範囲指定に含めるワケにはいかないので無視します。", yytext[0], yytext[1], yytext[0] & 0xFF, yytext[1] & 0xFF); | |
2308 | 2322 | YY_BREAK |
2309 | 2323 | case 17: |
2310 | 2324 | YY_RULE_SETUP |
2311 | 2325 | #line 58 "expr_scan.lex" |
2312 | -BEGIN(0); expr_error("文字<%c>は範囲指定に含められないので無視します。", yytext[0]); | |
2326 | +BEGIN(0); expr_error("文字<%c>は範囲指定に含められないので無視します。", yytext[0]); | |
2313 | 2327 | YY_BREAK |
2314 | 2328 | case 18: |
2315 | 2329 | YY_RULE_SETUP |
2316 | 2330 | #line 59 "expr_scan.lex" |
2317 | -BEGIN(0); expr_error("なんですかこの文字は範囲指定なのに? <0x%02X> 無視っすよ?", yytext[0] & 0xFF); | |
2331 | +BEGIN(0); expr_error("なんですかこの文字は範囲指定なのに? <0x%02X> 無視っすよ?", yytext[0] & 0xFF); | |
2318 | 2332 | YY_BREAK |
2319 | 2333 | case 19: |
2320 | 2334 | YY_RULE_SETUP |
2321 | 2335 | #line 61 "expr_scan.lex" |
2322 | -return yytext[0]; | |
2336 | +return yytext[0]; | |
2323 | 2337 | YY_BREAK |
2324 | 2338 | case 20: |
2325 | 2339 | YY_RULE_SETUP |
2326 | 2340 | #line 62 "expr_scan.lex" |
2327 | -BEGIN(EXPR_SET); return CLS_CMPL; | |
2341 | +BEGIN(EXPR_SET); return CLS_CMPL; | |
2328 | 2342 | YY_BREAK |
2329 | 2343 | case 21: |
2330 | 2344 | YY_RULE_SETUP |
2331 | 2345 | #line 63 "expr_scan.lex" |
2332 | -BEGIN(EXPR_SET); return CLS; | |
2346 | +BEGIN(EXPR_SET); return CLS; | |
2333 | 2347 | YY_BREAK |
2334 | 2348 | case 22: |
2335 | 2349 | /* rule 22 can match eol */ |
2336 | 2350 | YY_RULE_SETUP |
2337 | 2351 | #line 65 "expr_scan.lex" |
2338 | -g_lineno++; return OR; | |
2352 | +g_lineno++; return OR; | |
2339 | 2353 | YY_BREAK |
2340 | 2354 | case 23: |
2341 | 2355 | YY_RULE_SETUP |
2342 | 2356 | #line 66 "expr_scan.lex" |
2343 | -return OR; | |
2357 | +return OR; | |
2344 | 2358 | YY_BREAK |
2345 | 2359 | case 24: |
2346 | 2360 | YY_RULE_SETUP |
2347 | 2361 | #line 68 "expr_scan.lex" |
2348 | -expr_error("文字<%c%c(0x%02X%02X)>はお行儀が悪いので無視します。", yytext[0], yytext[1], yytext[0] & 0xFF, yytext[1] & 0xFF); return JUNK; | |
2362 | +expr_error("文字<%c%c(0x%02X%02X)>はお行儀が悪いので無視します。", yytext[0], yytext[1], yytext[0] & 0xFF, yytext[1] & 0xFF); return JUNK; | |
2349 | 2363 | YY_BREAK |
2350 | 2364 | case 25: |
2351 | 2365 | YY_RULE_SETUP |
2352 | 2366 | #line 69 "expr_scan.lex" |
2353 | -expr_error("文字<%c>はよくわかってないので無視します。", yytext[0]); return JUNK; | |
2367 | +expr_error("文字<%c>はよくわかってないので無視します。", yytext[0]); return JUNK; | |
2354 | 2368 | YY_BREAK |
2355 | 2369 | case 26: |
2356 | 2370 | YY_RULE_SETUP |
2357 | 2371 | #line 70 "expr_scan.lex" |
2358 | -expr_error("なんですかこの文字は? <0x%02X> 無視っすよ?", yytext[0] & 0xFF); return JUNK; | |
2372 | +expr_error("なんですかこの文字は? <0x%02X> 無視っすよ?", yytext[0] & 0xFF); return JUNK; | |
2359 | 2373 | YY_BREAK |
2360 | 2374 | case 27: |
2361 | 2375 | YY_RULE_SETUP |
@@ -2362,7 +2376,7 @@ | ||
2362 | 2376 | #line 72 "expr_scan.lex" |
2363 | 2377 | ECHO; |
2364 | 2378 | YY_BREAK |
2365 | -#line 2366 "expr_scan.c" | |
2379 | +#line 2380 "expr_scan.c" | |
2366 | 2380 | case YY_STATE_EOF(INITIAL): |
2367 | 2381 | case YY_STATE_EOF(EXPR_SET): |
2368 | 2382 | yyterminate(); |
@@ -3121,8 +3135,8 @@ | ||
3121 | 3135 | |
3122 | 3136 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
3123 | 3137 | * scan from a @e copy of @a bytes. |
3124 | - * @param bytes the byte buffer to scan | |
3125 | - * @param len the number of bytes in the buffer pointed to by @a bytes. | |
3138 | + * @param yybytes the byte buffer to scan | |
3139 | + * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. | |
3126 | 3140 | * |
3127 | 3141 | * @return the newly allocated buffer state object. |
3128 | 3142 | */ |
@@ -3364,11 +3378,11 @@ | ||
3364 | 3378 | #line 72 "expr_scan.lex" |
3365 | 3379 | |
3366 | 3380 | |
3381 | + | |
3382 | +/* | |
3383 | + * Local Variables: | |
3384 | + * tab-width: 4 | |
3385 | + * End: | |
3386 | + * | |
3387 | + * EOF */ | |
3367 | 3388 | |
3368 | -/* | |
3369 | - * Local Variables: | |
3370 | - * tab-width: 4 | |
3371 | - * End: | |
3372 | - * | |
3373 | - * EOF */ | |
3374 | - |
@@ -91,6 +91,12 @@ | ||
91 | 91 | } |
92 | 92 | ptr[7] ^= 0x80; c0 = ptr[7] << 8; |
93 | 93 | } |
94 | + else if ((ptr[n] & 0x7F) == 0x00 | |
95 | + && (ptr[n + 1] & 0x7F) != 0x00) | |
96 | + { | |
97 | + /* BSD鯖では失敗 */ | |
98 | + return 0; | |
99 | + } | |
94 | 100 | else if (n == 6 |
95 | 101 | && (ptr[6] | 0x80) == 0x81 |
96 | 102 | && (ptr[7] & 0x7F) == 0x40) |