"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/scanner.c" between
udunits-2.2.26.tar.gz and udunits-2.2.28.tar.gz

About: UDUNITS supports units of physical quantities. Its C library provides for arithmetic manipulation of units and for conversion of numeric values between compatible units.

scanner.c  (udunits-2.2.26):scanner.c  (udunits-2.2.28)
skipping to change at line 928 skipping to change at line 928
} ; } ;
static yy_state_type yy_last_accepting_state; static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos; static char *yy_last_accepting_cpos;
extern int ut_flex_debug; extern int ut_flex_debug;
int ut_flex_debug = 1; int ut_flex_debug = 1;
static yyconst flex_int16_t yy_rule_linenum[20] = static yyconst flex_int16_t yy_rule_linenum[20] =
{ 0, { 0,
151, 156, 161, 166, 181, 238, 243, 254, 260, 266, 152, 157, 162, 167, 182, 244, 249, 260, 266, 272,
272, 282, 292, 297, 315, 320, 325, 330, 337 278, 288, 298, 303, 321, 326, 331, 336, 343
} ; } ;
/* The intent behind this definition is that it'll catch /* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed. * any uses of REJECT which flex missed.
*/ */
#define REJECT reject_used_but_not_detected #define REJECT reject_used_but_not_detected
#define yymore() yymore_used_but_not_detected #define yymore() yymore_used_but_not_detected
#define YY_MORE_ADJ 0 #define YY_MORE_ADJ 0
#define YY_RESTORE_YY_MORE_OFFSET #define YY_RESTORE_YY_MORE_OFFSET
char *uttext; char *uttext;
skipping to change at line 955 skipping to change at line 955
* in the top-level source-directory of the package for copying and * in the top-level source-directory of the package for copying and
* redistribution conditions. * redistribution conditions.
*/ */
/* /*
* lex(1) specification for tokens for the Unidata units package, UDUNITS2. * lex(1) specification for tokens for the Unidata units package, UDUNITS2.
*/ */
#line 15 "scanner.l" #line 15 "scanner.l"
#include <ctype.h> #include <ctype.h>
#include <errno.h> #include <errno.h>
#include <limits.h>
#include <math.h> #include <math.h>
#include <stddef.h> #include <stddef.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
/** /**
* Decodes a date. * Decodes a date.
* *
skipping to change at line 1032 skipping to change at line 1033
errno = 0; errno = 0;
*value = strtod(text, NULL); *value = strtod(text, NULL);
if (errno == 0) if (errno == 0)
return REAL; return REAL;
ut_handle_error_message("Invalid real: \"%s\"", text); ut_handle_error_message("Invalid real: \"%s\"", text);
return ERR; return ERR;
} }
#line 1034 "<stdout>" #line 1035 "<stdout>"
#define INITIAL 0 #define INITIAL 0
#define ID_SEEN 1 #define ID_SEEN 1
#define SHIFT_SEEN 2 #define SHIFT_SEEN 2
#define DATE_SEEN 3 #define DATE_SEEN 3
#define CLOCK_SEEN 4 #define CLOCK_SEEN 4
#ifndef YY_NO_UNISTD_H #ifndef YY_NO_UNISTD_H
/* Special case for "unistd.h", since it is non-ANSI. We include it way /* Special case for "unistd.h", since it is non-ANSI. We include it way
* down here because we want the user's section 1 to have been scanned first. * down here because we want the user's section 1 to have been scanned first.
skipping to change at line 1278 skipping to change at line 1279
/** The main scanner function which does all the work. /** The main scanner function which does all the work.
*/ */
YY_DECL YY_DECL
{ {
register yy_state_type yy_current_state; register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp; register char *yy_cp, *yy_bp;
register int yy_act; register int yy_act;
/* %% [7.0] user's declarations go here */ /* %% [7.0] user's declarations go here */
#line 145 "scanner.l" #line 146 "scanner.l"
if (_restartScanner) { if (_restartScanner) {
BEGIN INITIAL; BEGIN INITIAL;
_restartScanner = 0; _restartScanner = 0;
} }
#line 1287 "<stdout>" #line 1288 "<stdout>"
if ( !(yy_init) ) if ( !(yy_init) )
{ {
(yy_init) = 1; (yy_init) = 1;
#ifdef YY_USER_INIT #ifdef YY_USER_INIT
YY_USER_INIT; YY_USER_INIT;
#endif #endif
if ( ! (yy_start) ) if ( ! (yy_start) )
skipping to change at line 1401 skipping to change at line 1402
/* %% [13.0] actions go here */ /* %% [13.0] actions go here */
case 0: /* must back up */ case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */ /* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = (yy_hold_char); *yy_cp = (yy_hold_char);
yy_cp = (yy_last_accepting_cpos); yy_cp = (yy_last_accepting_cpos);
yy_current_state = (yy_last_accepting_state); yy_current_state = (yy_last_accepting_state);
goto yy_find_action; goto yy_find_action;
case 1: case 1:
YY_RULE_SETUP YY_RULE_SETUP
#line 151 "scanner.l" #line 152 "scanner.l"
{ {
BEGIN SHIFT_SEEN; BEGIN SHIFT_SEEN;
return SHIFT; return SHIFT;
} }
YY_BREAK YY_BREAK
case 2: case 2:
YY_RULE_SETUP YY_RULE_SETUP
#line 156 "scanner.l" #line 157 "scanner.l"
{ {
BEGIN INITIAL; BEGIN INITIAL;
return DIVIDE; return DIVIDE;
} }
YY_BREAK YY_BREAK
case 3: case 3:
YY_RULE_SETUP YY_RULE_SETUP
#line 161 "scanner.l" #line 162 "scanner.l"
{ {
BEGIN INITIAL; BEGIN INITIAL;
return MULTIPLY; return MULTIPLY;
} }
YY_BREAK YY_BREAK
case 4: case 4:
YY_RULE_SETUP YY_RULE_SETUP
#line 166 "scanner.l" #line 167 "scanner.l"
{ {
int status; int status;
if (sscanf(uttext, "%*[*^]%ld", &yylval.ival) != 1) { if (sscanf(uttext, "%*[*^]%ld", &yylval.ival) != 1) {
ut_handle_error_message("Invalid integer\n", stderr); ut_handle_error_message("Invalid integer\n", stderr);
status = ERR; status = ERR;
} }
else { else {
status = EXPONENT; status = EXPONENT;
} }
return status; return status;
} }
YY_BREAK YY_BREAK
case 5: case 5:
YY_RULE_SETUP YY_RULE_SETUP
#line 181 "scanner.l" #line 182 "scanner.l"
{ {
int status = EXPONENT; int status = EXPONENT;
int exponent = 0; int exponent = 0;
int sign = 1; int sign = 1;
char* cp = uttext; char* cp = uttext;
if (strncmp(cp, "\xe2\x81\xba", 3) == 0) { if (strncmp(cp, "\xe2\x81\xba", 3) == 0) {
cp += 3; cp += 3;
} }
else if (strncmp(cp, "\xe2\x81\xbb", 3) == 0) { else if (strncmp(cp, "\xe2\x81\xbb", 3) == 0) {
skipping to change at line 1476 skipping to change at line 1477
{"\xc2\xb2", 2}, /* 2 */ {"\xc2\xb2", 2}, /* 2 */
{"\xc2\xb3", 2}, /* 3 */ {"\xc2\xb3", 2}, /* 3 */
{"\xe2\x81\xb4", 3}, /* 4 */ {"\xe2\x81\xb4", 3}, /* 4 */
{"\xe2\x81\xb5", 3}, /* 5 */ {"\xe2\x81\xb5", 3}, /* 5 */
{"\xe2\x81\xb6", 3}, /* 6 */ {"\xe2\x81\xb6", 3}, /* 6 */
{"\xe2\x81\xb7", 3}, /* 7 */ {"\xe2\x81\xb7", 3}, /* 7 */
{"\xe2\x81\xb8", 3}, /* 8 */ {"\xe2\x81\xb8", 3}, /* 8 */
{"\xe2\x81\xb9", 3}, /* 9 */ {"\xe2\x81\xb9", 3}, /* 9 */
}; };
if (exponent > INT_MAX/10) {
status = ERR;
break;
}
exponent *= 10; exponent *= 10;
for (j = 0; j < 10; j++) { for (j = 0; j < 10; j++) {
int len = utf8_exponents[j].len; int len = utf8_exponents[j].len;
if (strncmp(cp, utf8_exponents[j].string, len) == 0) { if (strncmp(cp, utf8_exponents[j].string, len) == 0) {
exponent += j; exponent += j;
cp += len; cp += len;
break; break;
} }
skipping to change at line 1503 skipping to change at line 1509
if (status == EXPONENT) if (status == EXPONENT)
yylval.ival = sign * exponent; yylval.ival = sign * exponent;
BEGIN INITIAL; BEGIN INITIAL;
return status; return status;
} }
YY_BREAK YY_BREAK
case 6: case 6:
YY_RULE_SETUP YY_RULE_SETUP
#line 238 "scanner.l" #line 244 "scanner.l"
{ {
BEGIN DATE_SEEN; BEGIN DATE_SEEN;
return decodeDate((char*)uttext, "%d-%d-%d", &yylval.rval); return decodeDate((char*)uttext, "%d-%d-%d", &yylval.rval);
} }
YY_BREAK YY_BREAK
case 7: case 7:
YY_RULE_SETUP YY_RULE_SETUP
#line 243 "scanner.l" #line 249 "scanner.l"
{ {
if (_isTime) { if (_isTime) {
BEGIN DATE_SEEN; BEGIN DATE_SEEN;
return decodeDate((char*)uttext, "%4d%2d%2d", &yylval.rval); return decodeDate((char*)uttext, "%4d%2d%2d", &yylval.rval);
} }
else { else {
BEGIN INITIAL; BEGIN INITIAL;
return decodeReal((char*)uttext, &yylval.rval); return decodeReal((char*)uttext, &yylval.rval);
} }
} }
YY_BREAK YY_BREAK
case 8: case 8:
YY_RULE_SETUP YY_RULE_SETUP
#line 254 "scanner.l" #line 260 "scanner.l"
{ {
yylval.rval = decodeClock((char*)uttext, "%d:%d:%lf"); yylval.rval = decodeClock((char*)uttext, "%d:%d:%lf");
BEGIN CLOCK_SEEN; BEGIN CLOCK_SEEN;
return CLOCK; return CLOCK;
} }
YY_BREAK YY_BREAK
case 9: case 9:
YY_RULE_SETUP YY_RULE_SETUP
#line 260 "scanner.l" #line 266 "scanner.l"
{ {
yylval.rval = decodeClock((char*)uttext, "%2d%2d%lf"); yylval.rval = decodeClock((char*)uttext, "%2d%2d%lf");
BEGIN CLOCK_SEEN; BEGIN CLOCK_SEEN;
return CLOCK; return CLOCK;
} }
YY_BREAK YY_BREAK
case 10: case 10:
YY_RULE_SETUP YY_RULE_SETUP
#line 266 "scanner.l" #line 272 "scanner.l"
{ {
yylval.rval = decodeClock((char*)uttext, "%d:%d"); yylval.rval = decodeClock((char*)uttext, "%d:%d");
BEGIN INITIAL; BEGIN INITIAL;
return CLOCK; return CLOCK;
} }
YY_BREAK YY_BREAK
case 11: case 11:
YY_RULE_SETUP YY_RULE_SETUP
#line 272 "scanner.l" #line 278 "scanner.l"
{ {
yylval.rval = (utleng <= 3) yylval.rval = (utleng <= 3)
? decodeClock((char*)uttext, "%d") ? decodeClock((char*)uttext, "%d")
: (utleng == 4) : (utleng == 4)
? decodeClock((char*)uttext, "%2d%d") ? decodeClock((char*)uttext, "%2d%d")
: decodeClock((char*)uttext, "%3d%d"); : decodeClock((char*)uttext, "%3d%d");
BEGIN INITIAL; BEGIN INITIAL;
return CLOCK; return CLOCK;
} }
YY_BREAK YY_BREAK
case 12: case 12:
YY_RULE_SETUP YY_RULE_SETUP
#line 282 "scanner.l" #line 288 "scanner.l"
{ {
yylval.rval = (utleng <= 2) yylval.rval = (utleng <= 2)
? decodeClock((char*)uttext, "%d") ? decodeClock((char*)uttext, "%d")
: (utleng == 3) : (utleng == 3)
? decodeClock((char*)uttext, "%1d%d") ? decodeClock((char*)uttext, "%1d%d")
: decodeClock((char*)uttext, "%2d%d"); : decodeClock((char*)uttext, "%2d%d");
BEGIN INITIAL; BEGIN INITIAL;
return CLOCK; return CLOCK;
} }
YY_BREAK YY_BREAK
case 13: case 13:
YY_RULE_SETUP YY_RULE_SETUP
#line 292 "scanner.l" #line 298 "scanner.l"
{ {
BEGIN INITIAL; BEGIN INITIAL;
return decodeReal((char*)uttext, &yylval.rval); return decodeReal((char*)uttext, &yylval.rval);
} }
YY_BREAK YY_BREAK
case 14: case 14:
YY_RULE_SETUP YY_RULE_SETUP
#line 297 "scanner.l" #line 303 "scanner.l"
{ {
int status; int status;
errno = 0; errno = 0;
yylval.ival = atol((char*)uttext); yylval.ival = atol((char*)uttext);
if (errno == 0) { if (errno == 0) {
status = INT; status = INT;
} else { } else {
ut_handle_error_message("Invalid integer\n", stderr); ut_handle_error_message("Invalid integer\n", stderr);
status = ERR; status = ERR;
} }
BEGIN INITIAL; BEGIN INITIAL;
return status; return status;
} }
YY_BREAK YY_BREAK
case 15: case 15:
YY_RULE_SETUP YY_RULE_SETUP
#line 315 "scanner.l" #line 321 "scanner.l"
{ {
yylval.rval = 10; yylval.rval = 10;
return LOGREF; return LOGREF;
} }
YY_BREAK YY_BREAK
case 16: case 16:
YY_RULE_SETUP YY_RULE_SETUP
#line 320 "scanner.l" #line 326 "scanner.l"
{ {
yylval.rval = M_E; yylval.rval = M_E;
return LOGREF; return LOGREF;
} }
YY_BREAK YY_BREAK
case 17: case 17:
YY_RULE_SETUP YY_RULE_SETUP
#line 325 "scanner.l" #line 331 "scanner.l"
{ {
yylval.rval = 2; yylval.rval = 2;
return LOGREF; return LOGREF;
} }
YY_BREAK YY_BREAK
case 18: case 18:
YY_RULE_SETUP YY_RULE_SETUP
#line 330 "scanner.l" #line 336 "scanner.l"
{ {
yylval.id = strdup((char*)uttext); yylval.id = strdup((char*)uttext);
BEGIN ID_SEEN; BEGIN ID_SEEN;
return ID; return ID;
} }
YY_BREAK YY_BREAK
case 19: case 19:
YY_RULE_SETUP YY_RULE_SETUP
#line 337 "scanner.l" #line 343 "scanner.l"
{ {
BEGIN INITIAL; BEGIN INITIAL;
return uttext[0]; return uttext[0];
} }
YY_BREAK YY_BREAK
case 20: case 20:
YY_RULE_SETUP YY_RULE_SETUP
#line 342 "scanner.l" #line 348 "scanner.l"
ECHO; ECHO;
YY_BREAK YY_BREAK
#line 1654 "<stdout>" #line 1660 "<stdout>"
case YY_STATE_EOF(INITIAL): case YY_STATE_EOF(INITIAL):
case YY_STATE_EOF(ID_SEEN): case YY_STATE_EOF(ID_SEEN):
case YY_STATE_EOF(SHIFT_SEEN): case YY_STATE_EOF(SHIFT_SEEN):
case YY_STATE_EOF(DATE_SEEN): case YY_STATE_EOF(DATE_SEEN):
case YY_STATE_EOF(CLOCK_SEEN): case YY_STATE_EOF(CLOCK_SEEN):
yyterminate(); yyterminate();
case YY_END_OF_BUFFER: case YY_END_OF_BUFFER:
{ {
/* Amount of text matched not including the EOB char. */ /* Amount of text matched not including the EOB char. */
skipping to change at line 2780 skipping to change at line 2786
free( (char *) ptr ); /* see utrealloc() for (char *) cast */ free( (char *) ptr ); /* see utrealloc() for (char *) cast */
} }
/* %if-tables-serialization definitions */ /* %if-tables-serialization definitions */
/* %define-yytables The name for this specific scanner's tables. */ /* %define-yytables The name for this specific scanner's tables. */
#define YYTABLES_NAME "yytables" #define YYTABLES_NAME "yytables"
/* %endif */ /* %endif */
/* %ok-for-header */ /* %ok-for-header */
#line 342 "scanner.l" #line 348 "scanner.l"
 End of changes. 28 change blocks. 
26 lines changed or deleted 32 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)