?? cascadefileparser.cc
字號(hào):
/* A Bison parser, made by GNU Bison 1.875c. *//* Skeleton parser for Yacc-like parsing with Bison, Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *//* As a special exception, when this file is copied by Bison into a Bison output file, you may use that output file without restriction. This special exception was added by the Free Software Foundation in version 1.24 of Bison. *//* Written by Richard Stallman by simplifying the original so called ``semantic'' parser. *//* All symbols defined below should begin with yy or YY, to avoid infringing on user name space. This should be done even for local variables, as they might otherwise be expanded by user macros. There are some unavoidable exceptions within include files to define necessary library symbols; they are noted "INFRINGES ON USER NAME SPACE" below. *//* Identify Bison output. */#define YYBISON 1/* Skeleton name. */#define YYSKELETON_NAME "yacc.c"/* Pure parsers. */#define YYPURE 0/* Using locations. */#define YYLSP_NEEDED 0/* Tokens. */#ifndef YYTOKENTYPE# define YYTOKENTYPE /* Put the tokens into the symbol table, so that GDB and other debuggers know about them. */ enum yytokentype { CLASSIFIER_CASCADE = 258, TYPE_SEQUENTIAL = 259, TYPE_FAN = 260, TYPE_TREE = 261, RATIO = 262, FPR = 263, DR = 264, SUCCESSFUL = 265, EXHAUSTED = 266, STRONG = 267, CLASSIFIER = 268, CLASSIFIERS = 269, UPCASE_STRONG = 270, WEAK = 271, NULL_ID = 272, THRESHOLD = 273, LEFT_RIGHT = 274, UP_DOWN = 275, LEFT_CENTER_RIGHT = 276, SEVEN_COLUMNS = 277, DIAG = 278, LEFT_RIGHT_SAME = 279, UP_DOWN_SAME = 280, LEFT_CENTER_RIGHT_SAME = 281, SEVEN_COLUMNS_SAME = 282, SEVEN_COLUMNS_SIMILAR = 283, DIAG_SAME = 284, DIAG_SIMILAR = 285, FOUR_BOXES = 286, FOUR_BOXES_SAME = 287, DOUBLEQUOTE = 288, COMMA = 289, X_BY = 290, SLASH = 291, DOT = 292, COLON = 293, OPEN_PAREN = 294, CLOSE_PAREN = 295, OPEN_BRACKET = 296, CLOSE_BRACKET = 297, ASTERIX = 298, LT = 299, GTEQ = 300, MINUS = 301, BRANCH = 302, BRANCHES = 303, COMMON = 304, INT_NUMBER = 305, FP_NUMBER = 306, NAME = 307 };#endif#define CLASSIFIER_CASCADE 258#define TYPE_SEQUENTIAL 259#define TYPE_FAN 260#define TYPE_TREE 261#define RATIO 262#define FPR 263#define DR 264#define SUCCESSFUL 265#define EXHAUSTED 266#define STRONG 267#define CLASSIFIER 268#define CLASSIFIERS 269#define UPCASE_STRONG 270#define WEAK 271#define NULL_ID 272#define THRESHOLD 273#define LEFT_RIGHT 274#define UP_DOWN 275#define LEFT_CENTER_RIGHT 276#define SEVEN_COLUMNS 277#define DIAG 278#define LEFT_RIGHT_SAME 279#define UP_DOWN_SAME 280#define LEFT_CENTER_RIGHT_SAME 281#define SEVEN_COLUMNS_SAME 282#define SEVEN_COLUMNS_SIMILAR 283#define DIAG_SAME 284#define DIAG_SIMILAR 285#define FOUR_BOXES 286#define FOUR_BOXES_SAME 287#define DOUBLEQUOTE 288#define COMMA 289#define X_BY 290#define SLASH 291#define DOT 292#define COLON 293#define OPEN_PAREN 294#define CLOSE_PAREN 295#define OPEN_BRACKET 296#define CLOSE_BRACKET 297#define ASTERIX 298#define LT 299#define GTEQ 300#define MINUS 301#define BRANCH 302#define BRANCHES 303#define COMMON 304#define INT_NUMBER 305#define FP_NUMBER 306#define NAME 307/* Copy the first part of user declarations. */#line 62 "CascadeFileParser.yy"#include "Cascade.h"#include "Classifiers.h"#include "IntegralFeatures.h"#include "Exceptions.h"//#include <stdio.h>// internal variables:bool parse_entire_cascade;int image_width, image_height;CStrongClassifier* curr_strong;CClassifierCascade* pCascade;CWeakClassifier* parsed_weak;int curr_line;int curr_branch;string yyIDstring;void nextline(void){ curr_line++;}void yyerror(const char *str)//void yyerror(YYLTYPE *llocp, const char *str){ char* buf = new char[strlen(str)+1024]; sprintf(buf, "parsing error (line %d): %s", curr_line, str); string safe(buf); delete buf; throw ITException(safe);// printf("error: %s\n", str);}int yyparse(void);int yylex(void); extern FILE* yyin;CClassifierCascade* parse_cascade(FILE* fp){ // init variables pCascade = NULL; curr_strong = NULL; parsed_weak = NULL; image_width = image_height = -1; parse_entire_cascade = true; curr_line = 1; yyin = fp; // yyout = fopen("C:\\tmp\\dump.txt", "a+"); // parse the file! int result = yyparse(); // fflush(yyout); // fclose(yyout); if (result) { delete pCascade; throw ITException("error parsing"); } return pCascade;}/* Enabling traces. */#ifndef YYDEBUG# define YYDEBUG 0#endif/* Enabling verbose error messages. */#ifdef YYERROR_VERBOSE# undef YYERROR_VERBOSE# define YYERROR_VERBOSE 1#else# define YYERROR_VERBOSE 0#endif#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)#line 130 "CascadeFileParser.yy"typedef union YYSTYPE { int ival; double fval; char* sval; bool bval; CIntegralFeature* pIF; CRect* pRect; CWeakClassifier* pWC; CClassifierCascade* pCasc;} YYSTYPE;/* Line 191 of yacc.c. */#line 258 "CascadeFileParser.cc"# define yystype YYSTYPE /* obsolescent; will be withdrawn */# define YYSTYPE_IS_DECLARED 1# define YYSTYPE_IS_TRIVIAL 1#endif/* Copy the second part of user declarations. *//* Line 214 of yacc.c. */#line 270 "CascadeFileParser.cc"#if ! defined (yyoverflow) || YYERROR_VERBOSE# ifndef YYFREE# define YYFREE free# endif# ifndef YYMALLOC# define YYMALLOC malloc# endif/* The parser invokes alloca or malloc; define the necessary symbols. */# ifdef YYSTACK_USE_ALLOCA# if YYSTACK_USE_ALLOCA# define YYSTACK_ALLOC alloca# endif# else# if defined (alloca) || defined (_ALLOCA_H)# define YYSTACK_ALLOC alloca# else# ifdef __GNUC__# define YYSTACK_ALLOC __builtin_alloca# endif# endif# endif# ifdef YYSTACK_ALLOC /* Pacify GCC's `empty if-body' warning. */# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)# else# if defined (__STDC__) || defined (__cplusplus)# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */# define YYSIZE_T size_t# endif# define YYSTACK_ALLOC YYMALLOC# define YYSTACK_FREE YYFREE# endif#endif /* ! defined (yyoverflow) || YYERROR_VERBOSE */#if (! defined (yyoverflow) \ && (! defined (__cplusplus) \ || (defined (YYSTYPE_IS_TRIVIAL) && YYSTYPE_IS_TRIVIAL)))/* A type that is properly aligned for any stack member. */union yyalloc{ short yyss; YYSTYPE yyvs; };/* The size of the maximum gap between one aligned stack and the next. */# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)/* The size of an array large to enough to hold all stacks, each with N elements. */# define YYSTACK_BYTES(N) \ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \ + YYSTACK_GAP_MAXIMUM)/* Copy COUNT objects from FROM to TO. The source and destination do not overlap. */# ifndef YYCOPY# if defined (__GNUC__) && 1 < __GNUC__# define YYCOPY(To, From, Count) \ __builtin_memcpy (To, From, (Count) * sizeof (*(From)))# else# define YYCOPY(To, From, Count) \ do \ { \ register YYSIZE_T yyi; \ for (yyi = 0; yyi < (Count); yyi++) \ (To)[yyi] = (From)[yyi]; \ } \ while (0)# endif# endif/* Relocate STACK from its old location to the new one. The local variables YYSIZE and YYSTACKSIZE give the old and new number of elements in the stack, and YYPTR gives the new location of the stack. Advance YYPTR to a properly aligned location for the next stack. */# define YYSTACK_RELOCATE(Stack) \ do \ { \ YYSIZE_T yynewbytes; \ YYCOPY (&yyptr->Stack, Stack, yysize); \ Stack = &yyptr->Stack; \ yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ yyptr += yynewbytes / sizeof (*yyptr); \ } \ while (0)#endif#if defined (__STDC__) || defined (__cplusplus) typedef signed char yysigned_char;#else typedef short yysigned_char;#endif/* YYFINAL -- State number of the termination state. */#define YYFINAL 24/* YYLAST -- Last index in YYTABLE. */#define YYLAST 311/* YYNTOKENS -- Number of terminals. */#define YYNTOKENS 53/* YYNNTS -- Number of nonterminals. */#define YYNNTS 22/* YYNRULES -- Number of rules. */#define YYNRULES 46/* YYNRULES -- Number of states. */#define YYNSTATES 313/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */#define YYUNDEFTOK 2#define YYMAXUTOK 307#define YYTRANSLATE(YYX) \ ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */static const unsigned char yytranslate[] ={ 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 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, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52};#if YYDEBUG/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in YYRHS. */static const unsigned short yyprhs[] ={ 0, 0, 3, 5, 7, 11, 15, 18, 24, 44, 67, 69, 71, 73, 76, 80, 83, 98, 101, 106, 109, 111, 114, 135, 138, 140, 144, 153, 155, 157, 159, 170, 181, 194, 215, 228, 239, 250, 263, 284, 305, 318, 331, 340, 349, 359, 361};/* YYRHS -- A `-1'-separated list of the rules' RHS. */static const yysigned_char yyrhs[] ={ 54, 0, -1, 55, -1, 70, -1, 56, 57, 63, -1, 56, 58, 61, -1, 56, 59, -1, 3, 33, 52, 33, 34, -1, 4, 34, 50, 35, 50, 34, 7, 74, 39, 8, 38, 74, 34, 9, 38, 74, 34, 60, 40, -1, 5, 34, 50, 35, 50, 34, 7, 74, 39, 8, 38, 74, 34, 9, 38, 74, 34, 60, 40, 50, 48, 37, -1, 6, -1, 10, -1, 11, -1, 62, 63, -1, 61, 62, 63, -1, 49, 47, -1, 47, 50, 33, 52, 33, 39, 8, 38, 74, 34, 9, 38, 74, 40, -1, 64, 65, -1, 50, 12, 14, 37, -1, 65, 66, -1, 66, -1, 67, 68, -1, 15, 13, 50, 39, 8, 38, 74, 34, 9, 38, 74, 40, 38, 50, 16, 14, 34, 18, 74, 38, -1, 68, 69, -1, 69, -1, 74, 43, 70, -1, 41, 72, 42, 71, 74, 39, 74, 40, -1, 44, -1, 45, -1, 17, -1, 19, 50, 34, 50, 35, 50, 34, 50, 34, 50, -1, 20, 50, 34, 50, 34, 50, 35, 50, 34, 50, -1, 21, 50, 34, 50, 35, 50, 34, 50, 36, 50, 34, 50, -1, 22, 50, 34, 50, 35, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, -1, 23, 50, 34, 50, 34, 50, 35, 50, 34, 50, 34, 50, -1, 24, 50, 34, 50, 35, 50, 34, 50, 34, 50, -1, 25, 50, 34, 50, 34, 50, 35, 50, 34, 50, -1, 26, 50, 34, 50, 35, 50, 34, 50, 36, 50, 34, 50, -1, 27, 50, 34, 50, 35, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, -1, 28, 50, 34, 50, 35, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, 34, 50, -1, 29, 50, 34, 50, 34, 50, 35, 50, 34, 50, 34, 50, -1, 30, 50, 34, 50, 34, 50, 35, 50, 34, 50, 34, 50, -1, 31, 73, 34, 73, 34, 73, 34, 73, -1, 32, 73, 34, 73, 34, 73, 34, 73, -1, 39, 50, 34, 50, 34, 50, 34, 50, 40, -1, 51, -1, 50, -1};/* YYRLINE[YYN] -- source line where rule number YYN was defined. */static const unsigned short yyrline[] =
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -