00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047 #define YYBISON 1
00048
00049
00050 #define YYBISON_VERSION "2.2"
00051
00052
00053 #define YYSKELETON_NAME "yacc.c"
00054
00055
00056 #define YYPURE 0
00057
00058
00059 #define YYLSP_NEEDED 0
00060
00061
00062 #define yyparse cframeparse
00063 #define yylex cframelex
00064 #define yyerror cframeerror
00065 #define yylval cframelval
00066 #define yychar cframechar
00067 #define yydebug cframedebug
00068 #define yynerrs cframenerrs
00069
00070
00071
00072 #ifndef YYTOKENTYPE
00073 # define YYTOKENTYPE
00074
00075
00076 enum yytokentype {
00077 STRING = 258,
00078 LBRACE = 259,
00079 RBRACE = 260,
00080 EQ = 261,
00081 COMMA = 262
00082 };
00083 #endif
00084
00085 #define STRING 258
00086 #define LBRACE 259
00087 #define RBRACE 260
00088 #define EQ 261
00089 #define COMMA 262
00090
00091
00092
00093
00094
00095 #line 1 "src/cframe_parser.y"
00096
00097 #include <config.h>
00098
00099 #include <stdio.h>
00100 #include <stdlib.h>
00101 #include <string.h>
00102 #include <errno.h>
00103
00104 #include <cartcomm/nmea.h>
00105 #include <cartcomm/cframe.h>
00106 #include "nan.h"
00107
00108 #define DEBUG_LEVEL 1
00109 #include "debug.h"
00110
00111 #include "cframe_lexer.h"
00112 #include "cframe_parser.h"
00113
00114 #define YYPARSE_PARAM data
00115 #define cdata ((cframe_t *) data)
00116
00117 int cframedebug = 1;
00118 #define YYERROR_VERBOSE
00119
00120 int cframewrap(void) { return 1; }
00121 void cframeerror(char *str) {
00122 DEBUG1("error decoding: %s", str);
00123 }
00124
00125 void parse_avpair(cframe_t *cf, char *fieldName, char *fieldVal);
00126
00127
00128
00129 #ifndef YYDEBUG
00130 # define YYDEBUG 0
00131 #endif
00132
00133
00134 #ifdef YYERROR_VERBOSE
00135 # undef YYERROR_VERBOSE
00136 # define YYERROR_VERBOSE 1
00137 #else
00138 # define YYERROR_VERBOSE 0
00139 #endif
00140
00141
00142 #ifndef YYTOKEN_TABLE
00143 # define YYTOKEN_TABLE 0
00144 #endif
00145
00146 #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
00147 typedef union YYSTYPE
00148 #line 33 "src/cframe_parser.y"
00149 {
00150 char *string;
00151 }
00152
00153 #line 154 "src/cframe_parser.tab.c"
00154 YYSTYPE;
00155 # define yystype YYSTYPE
00156 # define YYSTYPE_IS_DECLARED 1
00157 # define YYSTYPE_IS_TRIVIAL 1
00158 #endif
00159
00160
00161
00162
00163
00164
00165
00166 #line 167 "src/cframe_parser.tab.c"
00167
00168 #ifdef short
00169 # undef short
00170 #endif
00171
00172 #ifdef YYTYPE_UINT8
00173 typedef YYTYPE_UINT8 yytype_uint8;
00174 #else
00175 typedef unsigned char yytype_uint8;
00176 #endif
00177
00178 #ifdef YYTYPE_INT8
00179 typedef YYTYPE_INT8 yytype_int8;
00180 #elif (defined __STDC__ || defined __C99__FUNC__ \
00181 || defined __cplusplus || defined _MSC_VER)
00182 typedef signed char yytype_int8;
00183 #else
00184 typedef short int yytype_int8;
00185 #endif
00186
00187 #ifdef YYTYPE_UINT16
00188 typedef YYTYPE_UINT16 yytype_uint16;
00189 #else
00190 typedef unsigned short int yytype_uint16;
00191 #endif
00192
00193 #ifdef YYTYPE_INT16
00194 typedef YYTYPE_INT16 yytype_int16;
00195 #else
00196 typedef short int yytype_int16;
00197 #endif
00198
00199 #ifndef YYSIZE_T
00200 # ifdef __SIZE_TYPE__
00201 # define YYSIZE_T __SIZE_TYPE__
00202 # elif defined size_t
00203 # define YYSIZE_T size_t
00204 # elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
00205 || defined __cplusplus || defined _MSC_VER)
00206 # include <stddef.h>
00207 # define YYSIZE_T size_t
00208 # else
00209 # define YYSIZE_T unsigned int
00210 # endif
00211 #endif
00212
00213 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
00214
00215 #ifndef YY_
00216 # if YYENABLE_NLS
00217 # if ENABLE_NLS
00218 # include <libintl.h>
00219 # define YY_(msgid) dgettext ("bison-runtime", msgid)
00220 # endif
00221 # endif
00222 # ifndef YY_
00223 # define YY_(msgid) msgid
00224 # endif
00225 #endif
00226
00227
00228 #if ! defined lint || defined __GNUC__
00229 # define YYUSE(e) ((void) (e))
00230 #else
00231 # define YYUSE(e)
00232 #endif
00233
00234
00235 #ifndef lint
00236 # define YYID(n) (n)
00237 #else
00238 #if (defined __STDC__ || defined __C99__FUNC__ \
00239 || defined __cplusplus || defined _MSC_VER)
00240 static int
00241 YYID (int i)
00242 #else
00243 static int
00244 YYID (i)
00245 int i;
00246 #endif
00247 {
00248 return i;
00249 }
00250 #endif
00251
00252 #if ! defined yyoverflow || YYERROR_VERBOSE
00253
00254
00255
00256 # ifdef YYSTACK_USE_ALLOCA
00257 # if YYSTACK_USE_ALLOCA
00258 # ifdef __GNUC__
00259 # define YYSTACK_ALLOC __builtin_alloca
00260 # elif defined __BUILTIN_VA_ARG_INCR
00261 # include <alloca.h>
00262 # elif defined _AIX
00263 # define YYSTACK_ALLOC __alloca
00264 # elif defined _MSC_VER
00265 # include <malloc.h>
00266 # define alloca _alloca
00267 # else
00268 # define YYSTACK_ALLOC alloca
00269 # if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00270 || defined __cplusplus || defined _MSC_VER)
00271 # include <stdlib.h>
00272 # ifndef _STDLIB_H
00273 # define _STDLIB_H 1
00274 # endif
00275 # endif
00276 # endif
00277 # endif
00278 # endif
00279
00280 # ifdef YYSTACK_ALLOC
00281
00282 # define YYSTACK_FREE(Ptr) do { ; } while (YYID (0))
00283 # ifndef YYSTACK_ALLOC_MAXIMUM
00284
00285
00286
00287
00288 # define YYSTACK_ALLOC_MAXIMUM 4032
00289 # endif
00290 # else
00291 # define YYSTACK_ALLOC YYMALLOC
00292 # define YYSTACK_FREE YYFREE
00293 # ifndef YYSTACK_ALLOC_MAXIMUM
00294 # define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
00295 # endif
00296 # if (defined __cplusplus && ! defined _STDLIB_H \
00297 && ! ((defined YYMALLOC || defined malloc) \
00298 && (defined YYFREE || defined free)))
00299 # include <stdlib.h>
00300 # ifndef _STDLIB_H
00301 # define _STDLIB_H 1
00302 # endif
00303 # endif
00304 # ifndef YYMALLOC
00305 # define YYMALLOC malloc
00306 # if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00307 || defined __cplusplus || defined _MSC_VER)
00308 void *malloc (YYSIZE_T);
00309 # endif
00310 # endif
00311 # ifndef YYFREE
00312 # define YYFREE free
00313 # if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
00314 || defined __cplusplus || defined _MSC_VER)
00315 void free (void *);
00316 # endif
00317 # endif
00318 # endif
00319 #endif
00320
00321
00322 #if (! defined yyoverflow \
00323 && (! defined __cplusplus \
00324 || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
00325
00326
00327 union yyalloc
00328 {
00329 yytype_int16 yyss;
00330 YYSTYPE yyvs;
00331 };
00332
00333
00334 # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
00335
00336
00337
00338 # define YYSTACK_BYTES(N) \
00339 ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
00340 + YYSTACK_GAP_MAXIMUM)
00341
00342
00343
00344 # ifndef YYCOPY
00345 # if defined __GNUC__ && 1 < __GNUC__
00346 # define YYCOPY(To, From, Count) \
00347 __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
00348 # else
00349 # define YYCOPY(To, From, Count) \
00350 do \
00351 { \
00352 YYSIZE_T yyi; \
00353 for (yyi = 0; yyi < (Count); yyi++) \
00354 (To)[yyi] = (From)[yyi]; \
00355 } \
00356 while (YYID (0))
00357 # endif
00358 # endif
00359
00360
00361
00362
00363
00364
00365 # define YYSTACK_RELOCATE(Stack) \
00366 do \
00367 { \
00368 YYSIZE_T yynewbytes; \
00369 YYCOPY (&yyptr->Stack, Stack, yysize); \
00370 Stack = &yyptr->Stack; \
00371 yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
00372 yyptr += yynewbytes / sizeof (*yyptr); \
00373 } \
00374 while (YYID (0))
00375
00376 #endif
00377
00378
00379 #define YYFINAL 4
00380
00381 #define YYLAST 6
00382
00383
00384 #define YYNTOKENS 8
00385
00386 #define YYNNTS 4
00387
00388 #define YYNRULES 6
00389
00390 #define YYNSTATES 11
00391
00392
00393 #define YYUNDEFTOK 2
00394 #define YYMAXUTOK 262
00395
00396 #define YYTRANSLATE(YYX) \
00397 ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
00398
00399
00400 static const yytype_uint8 yytranslate[] =
00401 {
00402 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00403 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00404 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00405 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00406 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00407 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00408 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00409 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00410 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00411 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00412 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00413 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00414 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00415 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00416 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00417 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00418 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00419 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00420 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00421 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00422 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00423 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00424 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00425 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00426 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
00427 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
00428 5, 6, 7
00429 };
00430
00431 #if YYDEBUG
00432
00433
00434 static const yytype_uint8 yyprhs[] =
00435 {
00436 0, 0, 3, 8, 9, 13, 17
00437 };
00438
00439
00440 static const yytype_int8 yyrhs[] =
00441 {
00442 9, 0, -1, 4, 10, 3, 5, -1, -1, 10,
00443 11, 7, -1, 3, 6, 3, -1, 3, 6, -1
00444 };
00445
00446
00447 static const yytype_uint8 yyrline[] =
00448 {
00449 0, 45, 45, 53, 55, 58, 63
00450 };
00451 #endif
00452
00453 #if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
00454
00455
00456 static const char *const yytname[] =
00457 {
00458 "$end", "error", "$undefined", "STRING", "LBRACE", "RBRACE", "EQ",
00459 "COMMA", "$accept", "msg", "avpairlist", "avpair", 0
00460 };
00461 #endif
00462
00463 # ifdef YYPRINT
00464
00465
00466 static const yytype_uint16 yytoknum[] =
00467 {
00468 0, 256, 257, 258, 259, 260, 261, 262
00469 };
00470 # endif
00471
00472
00473 static const yytype_uint8 yyr1[] =
00474 {
00475 0, 8, 9, 10, 10, 11, 11
00476 };
00477
00478
00479 static const yytype_uint8 yyr2[] =
00480 {
00481 0, 2, 4, 0, 3, 3, 2
00482 };
00483
00484
00485
00486
00487 static const yytype_uint8 yydefact[] =
00488 {
00489 0, 3, 0, 0, 1, 0, 0, 2, 6, 4,
00490 5
00491 };
00492
00493
00494 static const yytype_int8 yydefgoto[] =
00495 {
00496 -1, 2, 3, 6
00497 };
00498
00499
00500
00501 #define YYPACT_NINF -6
00502 static const yytype_int8 yypact[] =
00503 {
00504 -2, -6, 3, 1, -6, -5, -1, -6, 2, -6,
00505 -6
00506 };
00507
00508
00509 static const yytype_int8 yypgoto[] =
00510 {
00511 -6, -6, -6, -6
00512 };
00513
00514
00515
00516
00517
00518 #define YYTABLE_NINF -1
00519 static const yytype_uint8 yytable[] =
00520 {
00521 7, 8, 1, 4, 5, 10, 9
00522 };
00523
00524 static const yytype_uint8 yycheck[] =
00525 {
00526 5, 6, 4, 0, 3, 3, 7
00527 };
00528
00529
00530
00531 static const yytype_uint8 yystos[] =
00532 {
00533 0, 4, 9, 10, 0, 3, 11, 5, 6, 7,
00534 3
00535 };
00536
00537 #define yyerrok (yyerrstatus = 0)
00538 #define yyclearin (yychar = YYEMPTY)
00539 #define YYEMPTY (-2)
00540 #define YYEOF 0
00541
00542 #define YYACCEPT goto yyacceptlab
00543 #define YYABORT goto yyabortlab
00544 #define YYERROR goto yyerrorlab
00545
00546
00547
00548
00549
00550
00551 #define YYFAIL goto yyerrlab
00552
00553 #define YYRECOVERING() (!!yyerrstatus)
00554
00555 #define YYBACKUP(Token, Value) \
00556 do \
00557 if (yychar == YYEMPTY && yylen == 1) \
00558 { \
00559 yychar = (Token); \
00560 yylval = (Value); \
00561 yytoken = YYTRANSLATE (yychar); \
00562 YYPOPSTACK (1); \
00563 goto yybackup; \
00564 } \
00565 else \
00566 { \
00567 yyerror (YY_("syntax error: cannot back up")); \
00568 YYERROR; \
00569 } \
00570 while (YYID (0))
00571
00572
00573 #define YYTERROR 1
00574 #define YYERRCODE 256
00575
00576
00577
00578
00579
00580
00581 #define YYRHSLOC(Rhs, K) ((Rhs)[K])
00582 #ifndef YYLLOC_DEFAULT
00583 # define YYLLOC_DEFAULT(Current, Rhs, N) \
00584 do \
00585 if (YYID (N)) \
00586 { \
00587 (Current).first_line = YYRHSLOC (Rhs, 1).first_line; \
00588 (Current).first_column = YYRHSLOC (Rhs, 1).first_column; \
00589 (Current).last_line = YYRHSLOC (Rhs, N).last_line; \
00590 (Current).last_column = YYRHSLOC (Rhs, N).last_column; \
00591 } \
00592 else \
00593 { \
00594 (Current).first_line = (Current).last_line = \
00595 YYRHSLOC (Rhs, 0).last_line; \
00596 (Current).first_column = (Current).last_column = \
00597 YYRHSLOC (Rhs, 0).last_column; \
00598 } \
00599 while (YYID (0))
00600 #endif
00601
00602
00603
00604
00605
00606
00607 #ifndef YY_LOCATION_PRINT
00608 # if YYLTYPE_IS_TRIVIAL
00609 # define YY_LOCATION_PRINT(File, Loc) \
00610 fprintf (File, "%d.%d-%d.%d", \
00611 (Loc).first_line, (Loc).first_column, \
00612 (Loc).last_line, (Loc).last_column)
00613 # else
00614 # define YY_LOCATION_PRINT(File, Loc) ((void) 0)
00615 # endif
00616 #endif
00617
00618
00619
00620
00621 #ifdef YYLEX_PARAM
00622 # define YYLEX yylex (YYLEX_PARAM)
00623 #else
00624 # define YYLEX yylex ()
00625 #endif
00626
00627
00628 #if YYDEBUG
00629
00630 # ifndef YYFPRINTF
00631 # include <stdio.h>
00632 # define YYFPRINTF fprintf
00633 # endif
00634
00635 # define YYDPRINTF(Args) \
00636 do { \
00637 if (yydebug) \
00638 YYFPRINTF Args; \
00639 } while (YYID (0))
00640
00641 # define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
00642 do { \
00643 if (yydebug) \
00644 { \
00645 YYFPRINTF (stderr, "%s ", Title); \
00646 yy_symbol_print (stderr, \
00647 Type, Value); \
00648 YYFPRINTF (stderr, "\n"); \
00649 } \
00650 } while (YYID (0))
00651
00652
00653
00654
00655
00656
00657
00658 #if (defined __STDC__ || defined __C99__FUNC__ \
00659 || defined __cplusplus || defined _MSC_VER)
00660 static void
00661 yy_symbol_value_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep)
00662 #else
00663 static void
00664 yy_symbol_value_print (yyoutput, yytype, yyvaluep)
00665 FILE *yyoutput;
00666 int yytype;
00667 const YYSTYPE * const yyvaluep;
00668 #endif
00669 {
00670 if (!yyvaluep)
00671 return;
00672 # ifdef YYPRINT
00673 if (yytype < YYNTOKENS)
00674 YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
00675 # else
00676 YYUSE (yyoutput);
00677 # endif
00678 switch (yytype)
00679 {
00680 default:
00681 break;
00682 }
00683 }
00684
00685
00686
00687
00688
00689
00690 #if (defined __STDC__ || defined __C99__FUNC__ \
00691 || defined __cplusplus || defined _MSC_VER)
00692 static void
00693 yy_symbol_print (FILE *yyoutput, int yytype, const YYSTYPE * const yyvaluep)
00694 #else
00695 static void
00696 yy_symbol_print (yyoutput, yytype, yyvaluep)
00697 FILE *yyoutput;
00698 int yytype;
00699 const YYSTYPE * const yyvaluep;
00700 #endif
00701 {
00702 if (yytype < YYNTOKENS)
00703 YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
00704 else
00705 YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
00706
00707 yy_symbol_value_print (yyoutput, yytype, yyvaluep);
00708 YYFPRINTF (yyoutput, ")");
00709 }
00710
00711
00712
00713
00714
00715
00716 #if (defined __STDC__ || defined __C99__FUNC__ \
00717 || defined __cplusplus || defined _MSC_VER)
00718 static void
00719 yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
00720 #else
00721 static void
00722 yy_stack_print (bottom, top)
00723 yytype_int16 *bottom;
00724 yytype_int16 *top;
00725 #endif
00726 {
00727 YYFPRINTF (stderr, "Stack now");
00728 for (; bottom <= top; ++bottom)
00729 YYFPRINTF (stderr, " %d", *bottom);
00730 YYFPRINTF (stderr, "\n");
00731 }
00732
00733 # define YY_STACK_PRINT(Bottom, Top) \
00734 do { \
00735 if (yydebug) \
00736 yy_stack_print ((Bottom), (Top)); \
00737 } while (YYID (0))
00738
00739
00740
00741
00742
00743
00744 #if (defined __STDC__ || defined __C99__FUNC__ \
00745 || defined __cplusplus || defined _MSC_VER)
00746 static void
00747 yy_reduce_print (YYSTYPE *yyvsp,
00748 int yyrule)
00749 #else
00750 static void
00751 yy_reduce_print (yyvsp, yyrule
00752 )
00753 YYSTYPE *yyvsp;
00754
00755 int yyrule;
00756 #endif
00757 {
00758 int yynrhs = yyr2[yyrule];
00759 int yyi;
00760 unsigned long int yylno = yyrline[yyrule];
00761 YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
00762 yyrule - 1, yylno);
00763
00764 for (yyi = 0; yyi < yynrhs; yyi++)
00765 {
00766 fprintf (stderr, " $%d = ", yyi + 1);
00767 yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
00768 &(yyvsp[(yyi + 1) - (yynrhs)])
00769 );
00770 fprintf (stderr, "\n");
00771 }
00772 }
00773
00774 # define YY_REDUCE_PRINT(Rule) \
00775 do { \
00776 if (yydebug) \
00777 yy_reduce_print (yyvsp, Rule); \
00778 } while (YYID (0))
00779
00780
00781
00782 int yydebug;
00783 #else
00784 # define YYDPRINTF(Args)
00785 # define YY_SYMBOL_PRINT(Title, Type, Value, Location)
00786 # define YY_STACK_PRINT(Bottom, Top)
00787 # define YY_REDUCE_PRINT(Rule)
00788 #endif
00789
00790
00791
00792 #ifndef YYINITDEPTH
00793 # define YYINITDEPTH 200
00794 #endif
00795
00796
00797
00798
00799
00800
00801
00802
00803 #ifndef YYMAXDEPTH
00804 # define YYMAXDEPTH 10000
00805 #endif
00806
00807
00808
00809 #if YYERROR_VERBOSE
00810
00811 # ifndef yystrlen
00812 # if defined __GLIBC__ && defined _STRING_H
00813 # define yystrlen strlen
00814 # else
00815
00816 #if (defined __STDC__ || defined __C99__FUNC__ \
00817 || defined __cplusplus || defined _MSC_VER)
00818 static YYSIZE_T
00819 yystrlen (const char *yystr)
00820 #else
00821 static YYSIZE_T
00822 yystrlen (yystr)
00823 const char *yystr;
00824 #endif
00825 {
00826 YYSIZE_T yylen;
00827 for (yylen = 0; yystr[yylen]; yylen++)
00828 continue;
00829 return yylen;
00830 }
00831 # endif
00832 # endif
00833
00834 # ifndef yystpcpy
00835 # if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
00836 # define yystpcpy stpcpy
00837 # else
00838
00839
00840 #if (defined __STDC__ || defined __C99__FUNC__ \
00841 || defined __cplusplus || defined _MSC_VER)
00842 static char *
00843 yystpcpy (char *yydest, const char *yysrc)
00844 #else
00845 static char *
00846 yystpcpy (yydest, yysrc)
00847 char *yydest;
00848 const char *yysrc;
00849 #endif
00850 {
00851 char *yyd = yydest;
00852 const char *yys = yysrc;
00853
00854 while ((*yyd++ = *yys++) != '\0')
00855 continue;
00856
00857 return yyd - 1;
00858 }
00859 # endif
00860 # endif
00861
00862 # ifndef yytnamerr
00863
00864
00865
00866
00867
00868
00869
00870 static YYSIZE_T
00871 yytnamerr (char *yyres, const char *yystr)
00872 {
00873 if (*yystr == '"')
00874 {
00875 YYSIZE_T yyn = 0;
00876 char const *yyp = yystr;
00877
00878 for (;;)
00879 switch (*++yyp)
00880 {
00881 case '\'':
00882 case ',':
00883 goto do_not_strip_quotes;
00884
00885 case '\\':
00886 if (*++yyp != '\\')
00887 goto do_not_strip_quotes;
00888
00889 default:
00890 if (yyres)
00891 yyres[yyn] = *yyp;
00892 yyn++;
00893 break;
00894
00895 case '"':
00896 if (yyres)
00897 yyres[yyn] = '\0';
00898 return yyn;
00899 }
00900 do_not_strip_quotes: ;
00901 }
00902
00903 if (! yyres)
00904 return yystrlen (yystr);
00905
00906 return yystpcpy (yyres, yystr) - yyres;
00907 }
00908 # endif
00909
00910
00911
00912
00913
00914
00915
00916
00917 static YYSIZE_T
00918 yysyntax_error (char *yyresult, int yystate, int yychar)
00919 {
00920 int yyn = yypact[yystate];
00921
00922 if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
00923 return 0;
00924 else
00925 {
00926 int yytype = YYTRANSLATE (yychar);
00927 YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
00928 YYSIZE_T yysize = yysize0;
00929 YYSIZE_T yysize1;
00930 int yysize_overflow = 0;
00931 enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
00932 char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
00933 int yyx;
00934
00935 # if 0
00936
00937
00938 YY_("syntax error, unexpected %s");
00939 YY_("syntax error, unexpected %s, expecting %s");
00940 YY_("syntax error, unexpected %s, expecting %s or %s");
00941 YY_("syntax error, unexpected %s, expecting %s or %s or %s");
00942 YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
00943 # endif
00944 char *yyfmt;
00945 char const *yyf;
00946 static char const yyunexpected[] = "syntax error, unexpected %s";
00947 static char const yyexpecting[] = ", expecting %s";
00948 static char const yyor[] = " or %s";
00949 char yyformat[sizeof yyunexpected
00950 + sizeof yyexpecting - 1
00951 + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
00952 * (sizeof yyor - 1))];
00953 char const *yyprefix = yyexpecting;
00954
00955
00956
00957 int yyxbegin = yyn < 0 ? -yyn : 0;
00958
00959
00960 int yychecklim = YYLAST - yyn + 1;
00961 int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
00962 int yycount = 1;
00963
00964 yyarg[0] = yytname[yytype];
00965 yyfmt = yystpcpy (yyformat, yyunexpected);
00966
00967 for (yyx = yyxbegin; yyx < yyxend; ++yyx)
00968 if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
00969 {
00970 if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
00971 {
00972 yycount = 1;
00973 yysize = yysize0;
00974 yyformat[sizeof yyunexpected - 1] = '\0';
00975 break;
00976 }
00977 yyarg[yycount++] = yytname[yyx];
00978 yysize1 = yysize + yytnamerr (0, yytname[yyx]);
00979 yysize_overflow |= (yysize1 < yysize);
00980 yysize = yysize1;
00981 yyfmt = yystpcpy (yyfmt, yyprefix);
00982 yyprefix = yyor;
00983 }
00984
00985 yyf = YY_(yyformat);
00986 yysize1 = yysize + yystrlen (yyf);
00987 yysize_overflow |= (yysize1 < yysize);
00988 yysize = yysize1;
00989
00990 if (yysize_overflow)
00991 return YYSIZE_MAXIMUM;
00992
00993 if (yyresult)
00994 {
00995
00996
00997
00998 char *yyp = yyresult;
00999 int yyi = 0;
01000 while ((*yyp = *yyf) != '\0')
01001 {
01002 if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
01003 {
01004 yyp += yytnamerr (yyp, yyarg[yyi++]);
01005 yyf += 2;
01006 }
01007 else
01008 {
01009 yyp++;
01010 yyf++;
01011 }
01012 }
01013 }
01014 return yysize;
01015 }
01016 }
01017 #endif
01018
01019
01020
01021
01022
01023
01024
01025 #if (defined __STDC__ || defined __C99__FUNC__ \
01026 || defined __cplusplus || defined _MSC_VER)
01027 static void
01028 yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
01029 #else
01030 static void
01031 yydestruct (yymsg, yytype, yyvaluep)
01032 const char *yymsg;
01033 int yytype;
01034 YYSTYPE *yyvaluep;
01035 #endif
01036 {
01037 YYUSE (yyvaluep);
01038
01039 if (!yymsg)
01040 yymsg = "Deleting";
01041 YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
01042
01043 switch (yytype)
01044 {
01045
01046 default:
01047 break;
01048 }
01049 }
01050
01051
01052
01053
01054 #ifdef YYPARSE_PARAM
01055 #if defined __STDC__ || defined __cplusplus
01056 int yyparse (void *YYPARSE_PARAM);
01057 #else
01058 int yyparse ();
01059 #endif
01060 #else
01061 #if defined __STDC__ || defined __cplusplus
01062 int yyparse (void);
01063 #else
01064 int yyparse ();
01065 #endif
01066 #endif
01067
01068
01069
01070
01071 int yychar;
01072
01073
01074 YYSTYPE yylval;
01075
01076
01077 int yynerrs;
01078
01079
01080
01081
01082
01083
01084
01085 #ifdef YYPARSE_PARAM
01086 #if (defined __STDC__ || defined __C99__FUNC__ \
01087 || defined __cplusplus || defined _MSC_VER)
01088 int
01089 yyparse (void *YYPARSE_PARAM)
01090 #else
01091 int
01092 yyparse (YYPARSE_PARAM)
01093 void *YYPARSE_PARAM;
01094 #endif
01095 #else
01096 #if (defined __STDC__ || defined __C99__FUNC__ \
01097 || defined __cplusplus || defined _MSC_VER)
01098 int
01099 yyparse (void)
01100 #else
01101 int
01102 yyparse ()
01103
01104 #endif
01105 #endif
01106 {
01107
01108 int yystate;
01109 int yyn;
01110 int yyresult;
01111
01112 int yyerrstatus;
01113
01114 int yytoken = 0;
01115 #if YYERROR_VERBOSE
01116
01117 char yymsgbuf[128];
01118 char *yymsg = yymsgbuf;
01119 YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
01120 #endif
01121
01122
01123
01124
01125
01126
01127
01128
01129
01130
01131 yytype_int16 yyssa[YYINITDEPTH];
01132 yytype_int16 *yyss = yyssa;
01133 yytype_int16 *yyssp;
01134
01135
01136 YYSTYPE yyvsa[YYINITDEPTH];
01137 YYSTYPE *yyvs = yyvsa;
01138 YYSTYPE *yyvsp;
01139
01140
01141
01142 #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
01143
01144 YYSIZE_T yystacksize = YYINITDEPTH;
01145
01146
01147
01148 YYSTYPE yyval;
01149
01150
01151
01152
01153 int yylen = 0;
01154
01155 YYDPRINTF ((stderr, "Starting parse\n"));
01156
01157 yystate = 0;
01158 yyerrstatus = 0;
01159 yynerrs = 0;
01160 yychar = YYEMPTY;
01161
01162
01163
01164
01165
01166
01167 yyssp = yyss;
01168 yyvsp = yyvs;
01169
01170 goto yysetstate;
01171
01172
01173
01174
01175 yynewstate:
01176
01177
01178 yyssp++;
01179
01180 yysetstate:
01181 *yyssp = yystate;
01182
01183 if (yyss + yystacksize - 1 <= yyssp)
01184 {
01185
01186 YYSIZE_T yysize = yyssp - yyss + 1;
01187
01188 #ifdef yyoverflow
01189 {
01190
01191
01192
01193 YYSTYPE *yyvs1 = yyvs;
01194 yytype_int16 *yyss1 = yyss;
01195
01196
01197
01198
01199
01200
01201 yyoverflow (YY_("memory exhausted"),
01202 &yyss1, yysize * sizeof (*yyssp),
01203 &yyvs1, yysize * sizeof (*yyvsp),
01204
01205 &yystacksize);
01206
01207 yyss = yyss1;
01208 yyvs = yyvs1;
01209 }
01210 #else
01211 # ifndef YYSTACK_RELOCATE
01212 goto yyexhaustedlab;
01213 # else
01214
01215 if (YYMAXDEPTH <= yystacksize)
01216 goto yyexhaustedlab;
01217 yystacksize *= 2;
01218 if (YYMAXDEPTH < yystacksize)
01219 yystacksize = YYMAXDEPTH;
01220
01221 {
01222 yytype_int16 *yyss1 = yyss;
01223 union yyalloc *yyptr =
01224 (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
01225 if (! yyptr)
01226 goto yyexhaustedlab;
01227 YYSTACK_RELOCATE (yyss);
01228 YYSTACK_RELOCATE (yyvs);
01229
01230 # undef YYSTACK_RELOCATE
01231 if (yyss1 != yyssa)
01232 YYSTACK_FREE (yyss1);
01233 }
01234 # endif
01235 #endif
01236
01237 yyssp = yyss + yysize - 1;
01238 yyvsp = yyvs + yysize - 1;
01239
01240
01241 YYDPRINTF ((stderr, "Stack size increased to %lu\n",
01242 (unsigned long int) yystacksize));
01243
01244 if (yyss + yystacksize - 1 <= yyssp)
01245 YYABORT;
01246 }
01247
01248 YYDPRINTF ((stderr, "Entering state %d\n", yystate));
01249
01250 goto yybackup;
01251
01252
01253
01254
01255 yybackup:
01256
01257
01258
01259
01260
01261 yyn = yypact[yystate];
01262 if (yyn == YYPACT_NINF)
01263 goto yydefault;
01264
01265
01266
01267
01268 if (yychar == YYEMPTY)
01269 {
01270 YYDPRINTF ((stderr, "Reading a token: "));
01271 yychar = YYLEX;
01272 }
01273
01274 if (yychar <= YYEOF)
01275 {
01276 yychar = yytoken = YYEOF;
01277 YYDPRINTF ((stderr, "Now at end of input.\n"));
01278 }
01279 else
01280 {
01281 yytoken = YYTRANSLATE (yychar);
01282 YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
01283 }
01284
01285
01286
01287 yyn += yytoken;
01288 if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
01289 goto yydefault;
01290 yyn = yytable[yyn];
01291 if (yyn <= 0)
01292 {
01293 if (yyn == 0 || yyn == YYTABLE_NINF)
01294 goto yyerrlab;
01295 yyn = -yyn;
01296 goto yyreduce;
01297 }
01298
01299 if (yyn == YYFINAL)
01300 YYACCEPT;
01301
01302
01303
01304 if (yyerrstatus)
01305 yyerrstatus--;
01306
01307
01308 YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
01309
01310
01311 if (yychar != YYEOF)
01312 yychar = YYEMPTY;
01313
01314 yystate = yyn;
01315 *++yyvsp = yylval;
01316
01317 goto yynewstate;
01318
01319
01320
01321
01322
01323 yydefault:
01324 yyn = yydefact[yystate];
01325 if (yyn == 0)
01326 goto yyerrlab;
01327 goto yyreduce;
01328
01329
01330
01331
01332
01333 yyreduce:
01334
01335 yylen = yyr2[yyn];
01336
01337
01338
01339
01340
01341
01342
01343
01344
01345 yyval = yyvsp[1-yylen];
01346
01347
01348 YY_REDUCE_PRINT (yyn);
01349 switch (yyn)
01350 {
01351 case 2:
01352 #line 46 "src/cframe_parser.y"
01353 {
01354 errno = 0;
01355 cdata->checksum = strtol((yyvsp[(3) - (4)].string), NULL, 16);
01356 ASSERT_EQUAL(errno, 0);
01357 free((yyvsp[(3) - (4)].string));
01358 }
01359 break;
01360
01361 case 5:
01362 #line 59 "src/cframe_parser.y"
01363 {
01364 parse_avpair(cdata, (yyvsp[(1) - (3)].string), (yyvsp[(3) - (3)].string));
01365 free((yyvsp[(1) - (3)].string)); free((yyvsp[(3) - (3)].string));
01366 }
01367 break;
01368
01369 case 6:
01370 #line 64 "src/cframe_parser.y"
01371 {
01372 parse_avpair(cdata, (yyvsp[(1) - (2)].string), "");
01373 free((yyvsp[(1) - (2)].string));
01374 }
01375 break;
01376
01377
01378
01379 #line 1380 "src/cframe_parser.tab.c"
01380 default: break;
01381 }
01382 YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
01383
01384 YYPOPSTACK (yylen);
01385 yylen = 0;
01386 YY_STACK_PRINT (yyss, yyssp);
01387
01388 *++yyvsp = yyval;
01389
01390
01391
01392
01393
01394
01395 yyn = yyr1[yyn];
01396
01397 yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
01398 if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
01399 yystate = yytable[yystate];
01400 else
01401 yystate = yydefgoto[yyn - YYNTOKENS];
01402
01403 goto yynewstate;
01404
01405
01406
01407
01408
01409 yyerrlab:
01410
01411 if (!yyerrstatus)
01412 {
01413 ++yynerrs;
01414 #if ! YYERROR_VERBOSE
01415 yyerror (YY_("syntax error"));
01416 #else
01417 {
01418 YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
01419 if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
01420 {
01421 YYSIZE_T yyalloc = 2 * yysize;
01422 if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
01423 yyalloc = YYSTACK_ALLOC_MAXIMUM;
01424 if (yymsg != yymsgbuf)
01425 YYSTACK_FREE (yymsg);
01426 yymsg = (char *) YYSTACK_ALLOC (yyalloc);
01427 if (yymsg)
01428 yymsg_alloc = yyalloc;
01429 else
01430 {
01431 yymsg = yymsgbuf;
01432 yymsg_alloc = sizeof yymsgbuf;
01433 }
01434 }
01435
01436 if (0 < yysize && yysize <= yymsg_alloc)
01437 {
01438 (void) yysyntax_error (yymsg, yystate, yychar);
01439 yyerror (yymsg);
01440 }
01441 else
01442 {
01443 yyerror (YY_("syntax error"));
01444 if (yysize != 0)
01445 goto yyexhaustedlab;
01446 }
01447 }
01448 #endif
01449 }
01450
01451
01452
01453 if (yyerrstatus == 3)
01454 {
01455
01456
01457
01458 if (yychar <= YYEOF)
01459 {
01460
01461 if (yychar == YYEOF)
01462 YYABORT;
01463 }
01464 else
01465 {
01466 yydestruct ("Error: discarding",
01467 yytoken, &yylval);
01468 yychar = YYEMPTY;
01469 }
01470 }
01471
01472
01473
01474 goto yyerrlab1;
01475
01476
01477
01478
01479
01480 yyerrorlab:
01481
01482
01483
01484
01485 if ( 0)
01486 goto yyerrorlab;
01487
01488
01489
01490 YYPOPSTACK (yylen);
01491 yylen = 0;
01492 YY_STACK_PRINT (yyss, yyssp);
01493 yystate = *yyssp;
01494 goto yyerrlab1;
01495
01496
01497
01498
01499
01500 yyerrlab1:
01501 yyerrstatus = 3;
01502
01503 for (;;)
01504 {
01505 yyn = yypact[yystate];
01506 if (yyn != YYPACT_NINF)
01507 {
01508 yyn += YYTERROR;
01509 if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
01510 {
01511 yyn = yytable[yyn];
01512 if (0 < yyn)
01513 break;
01514 }
01515 }
01516
01517
01518 if (yyssp == yyss)
01519 YYABORT;
01520
01521
01522 yydestruct ("Error: popping",
01523 yystos[yystate], yyvsp);
01524 YYPOPSTACK (1);
01525 yystate = *yyssp;
01526 YY_STACK_PRINT (yyss, yyssp);
01527 }
01528
01529 if (yyn == YYFINAL)
01530 YYACCEPT;
01531
01532 *++yyvsp = yylval;
01533
01534
01535
01536 YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
01537
01538 yystate = yyn;
01539 goto yynewstate;
01540
01541
01542
01543
01544
01545 yyacceptlab:
01546 yyresult = 0;
01547 goto yyreturn;
01548
01549
01550
01551
01552 yyabortlab:
01553 yyresult = 1;
01554 goto yyreturn;
01555
01556 #ifndef yyoverflow
01557
01558
01559
01560 yyexhaustedlab:
01561 yyerror (YY_("memory exhausted"));
01562 yyresult = 2;
01563
01564 #endif
01565
01566 yyreturn:
01567 if (yychar != YYEOF && yychar != YYEMPTY)
01568 yydestruct ("Cleanup: discarding lookahead",
01569 yytoken, &yylval);
01570
01571
01572 YYPOPSTACK (yylen);
01573 YY_STACK_PRINT (yyss, yyssp);
01574 while (yyssp != yyss)
01575 {
01576 yydestruct ("Cleanup: popping",
01577 yystos[*yyssp], yyvsp);
01578 YYPOPSTACK (1);
01579 }
01580 #ifndef yyoverflow
01581 if (yyss != yyssa)
01582 YYSTACK_FREE (yyss);
01583 #endif
01584 #if YYERROR_VERBOSE
01585 if (yymsg != yymsgbuf)
01586 YYSTACK_FREE (yymsg);
01587 #endif
01588 return yyresult;
01589 }
01590
01591
01592 #line 68 "src/cframe_parser.y"
01593
01594
01595
01596
01597
01598
01599 void parse_avpair(cframe_t *cf, char *fieldName, char *fieldVal) {
01600 int ival;
01601 int valid_ival = 1;
01602 double dval;
01603 int valid_dval = 1;
01604 double nmeaval;
01605 int valid_nmeaval = 1;
01606
01607
01608 errno = 0;
01609 ival = strtol(fieldVal, NULL, 10);
01610 if(errno != 0)
01611 valid_ival = 0;
01612
01613 errno = 0;
01614 dval = strtod(fieldVal, NULL);
01615 if(errno != 0)
01616 valid_dval = 0;
01617
01618 nmeaval = nmea_to_deg(fieldVal);
01619 if(isnan(nmeaval))
01620 valid_nmeaval = 0;
01621
01622
01623 if(!strcmp(fieldName, "MsgLength")) {
01624 if(valid_ival)
01625 cf->msg_len = ival;
01626 else
01627 DEBUG1("invalid ival for MsgLength");
01628 } else if(!strcmp(fieldName, "VehMsgCount")) {
01629 if(valid_ival)
01630 cf->seqno = ival;
01631 else
01632 DEBUG1("invalid ival for VehMsgCount");
01633 } else if(!strcmp(fieldName, "TimeStamp")) {
01634 if(valid_ival)
01635 cf->timestamp = ival;
01636 else
01637 DEBUG1("invalid ival for TimeStamp");
01638 }
01639
01640
01641 else if(!strcmp(fieldName, "CmdTurnRadius")) {
01642 if(valid_dval)
01643 cf->cmd_irad = dval;
01644 else
01645 DEBUG1("invalid dval for CmdTurnRadius");
01646 } else if(!strcmp(fieldName, "StatusTurnRadius")) {
01647 if(valid_dval)
01648 cf->cur_irad = dval;
01649 else
01650 DEBUG1("invalid dval for StatusTurnRadius");
01651 } else if(!strcmp(fieldName, "StatusSteeringPosLimitError")) {
01652 strncpy(cf->steer_limit_error, fieldVal,
01653 sizeof(cf->steer_limit_error) - 1);
01654 cf->steer_limit_error[sizeof(cf->steer_limit_error) - 1] = 0;
01655 }
01656
01657
01658 else if(!strcmp(fieldName, "CmdVehSpeed")) {
01659 if(valid_dval)
01660 cf->cmd_speed = dval;
01661 else
01662 DEBUG1("invalid dval for CmdVehSpeed");
01663 } else if(!strcmp(fieldName, "StatusVehSpeed")) {
01664 if(valid_dval)
01665 cf->cur_speed = dval;
01666 else
01667 DEBUG1("invalid dval for StatusVehSpeed");
01668 } else if(!strcmp(fieldName, "StatusPercentThrottle")) {
01669 if(valid_dval)
01670 cf->cur_throttle = dval;
01671 else
01672 DEBUG1("invalid dval for StatusPercentThrottle");
01673 } else if(!strcmp(fieldName, "StatusVehSpeedLimitError")) {
01674 strncpy(cf->speed_limit_error, fieldVal,
01675 sizeof(cf->speed_limit_error) - 1);
01676 cf->speed_limit_error[sizeof(cf->speed_limit_error) - 1] = 0;
01677 }
01678
01679
01680 else if(!strcmp(fieldName, "GPSLat")) {
01681 if(valid_nmeaval)
01682 cf->gps_lat = nmeaval;
01683 else
01684 DEBUG1("invalid nmeaval for GPSLat");
01685 } else if(!strcmp(fieldName, "GPSLon")) {
01686 if(valid_nmeaval)
01687 cf->gps_lon = nmeaval;
01688 else
01689 DEBUG1("invalid nmeaval for GPSLon");
01690 } else if(!strcmp(fieldName, "GPSSpdE")) {
01691 if(valid_dval)
01692 cf->gps_speed_east = dval;
01693 else
01694 DEBUG1("invalid dval for GPSSpdE");
01695 } else if(!strcmp(fieldName, "GPSSpdN")) {
01696 if(valid_dval)
01697 cf->gps_speed_north = dval;
01698 else
01699 DEBUG1("invalid dval for GPSSpdN");
01700 } else if(!strcmp(fieldName, "GPSEstimatedPositionError") ||
01701 !strcmp(fieldName, "GPSEstPositionError")) {
01702 if(valid_dval)
01703 cf->gps_epe = dval;
01704 else
01705 DEBUG1("invalid dval for GPSEstimatedPositionError");
01706 } else if(!strcmp(fieldName, "GPSStatus")) {
01707 strncpy(cf->gps_status, fieldVal, sizeof(cf->gps_status) - 1);
01708 cf->gps_status[sizeof(cf->gps_status) - 1] = 0;
01709 }
01710
01711
01712 else if(!strcmp(fieldName, "StatusComm")) {
01713 strncpy(cf->status, fieldVal, sizeof(cf->status) - 1);
01714 cf->status[sizeof(cf->status) - 1] = 0;
01715 }
01716
01717
01718 else if(!strcmp(fieldName, "CmdSystemMode")) {
01719 strncpy(cf->cmd_mode, fieldVal, sizeof(cf->cmd_mode) - 1);
01720 cf->cmd_mode[sizeof(cf->cmd_mode) - 1] = 0;
01721 }
01722
01723
01724 else if(!strcmp(fieldName, "StatusSystemMode")) {
01725 strncpy(cf->cur_mode, fieldVal, sizeof(cf->cur_mode) - 1);
01726 cf->cur_mode[sizeof(cf->cur_mode) - 1] = 0;
01727 }
01728
01729
01730 else if(!strcmp(fieldName, "StatusErrorCode")) {
01731 if(valid_ival)
01732 cf->error_code = ival;
01733 else
01734 DEBUG1("invalid ival for StatusErrorCode");
01735 }
01736
01737 else
01738 DEBUG1("unexpected attribute: %s", fieldName);
01739 }
01740
01741 int parse_msg(cframe_t *cf, char *msg) {
01742 int result;
01743 YY_BUFFER_STATE buf;
01744
01745 buf = cframe_scan_string(msg);
01746 result = yyparse(cf);
01747 cframe_delete_buffer(buf);
01748
01749 return result;
01750 }
01751