1 /* 2 * avrdude - A Downloader/Uploader for AVR device programmers 3 * Copyright (C) 2000-2004 Brian S. Dean <bsd@bsdhome.com> 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * This program is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 /* $Id$ */ 20 21 /* These are the internal definitions needed for config parsing */ 22 23 #ifndef config_h 24 #define config_h 25 26 #include "libavrdude.h" 27 28 29 #define MAX_STR_CONST 1024 30 31 enum { V_NONE, V_NUM, V_NUM_REAL, V_STR }; 32 typedef struct value_t { 33 int type; 34 /*union { TODO: use an anonymous union here ? */ 35 int number; 36 double number_real; 37 char * string; 38 /*};*/ 39 } VALUE; 40 41 42 typedef struct token_t { 43 int primary; 44 VALUE value; 45 } TOKEN; 46 typedef struct token_t *token_p; 47 48 49 extern FILE * yyin; 50 extern PROGRAMMER * current_prog; 51 extern AVRPART * current_part; 52 extern AVRMEM * current_mem; 53 extern int lineno; 54 extern const char * infile; 55 extern LISTID string_list; 56 extern LISTID number_list; 57 58 59 #if !defined(HAS_YYSTYPE) 60 #define YYSTYPE token_p 61 #endif 62 extern YYSTYPE yylval; 63 64 extern char string_buf[MAX_STR_CONST]; 65 extern char *string_buf_ptr; 66 67 #ifdef __cplusplus 68 extern "C" { 69 #endif 70 71 int yyparse(void); 72 73 int yyerror(char * errmsg, ...); 74 75 int yywarning(char * errmsg, ...); 76 77 TOKEN * new_token(int primary); 78 79 void free_token(TOKEN * tkn); 80 81 void free_tokens(int n, ...); 82 83 TOKEN * number(char * text); 84 85 TOKEN * number_real(char * text); 86 87 TOKEN * hexnumber(char * text); 88 89 TOKEN * string(char * text); 90 91 TOKEN * keyword(int primary); 92 93 void print_token(TOKEN * tkn); 94 95 void pyytext(void); 96 97 char * dup_string(const char * str); 98 99 #ifdef __cplusplus 100 } 101 #endif 102 103 #endif 104