Use lex/yacc for parsing the config file. Re-work the config file

format using a more human-readable format.

Read part descriptions from the config file now instead of hard-coding
them.

Update usage().

Cleanup unused code.


git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@79 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Brian S. Dean
2001-10-14 23:17:26 +00:00
parent 3bae0d8d14
commit 3d8f8bcd45
14 changed files with 2900 additions and 541 deletions

84
config.h Normal file
View File

@@ -0,0 +1,84 @@
/* $Id$ */
#ifndef __config_h__
#define __config_h__
#include "lists.h"
#include "pindefs.h"
#include "avr.h"
#define MAX_STR_CONST 1024
enum { V_NONE, V_NUM, V_STR };
typedef struct value_t {
int type;
double number;
char * string;
} VALUE;
typedef struct token_t {
int primary;
VALUE value;
} TOKEN;
#define PGM_DESCLEN 80
typedef struct programmer_t {
LISTID id;
char desc[PGM_DESCLEN];
unsigned int pinno[N_PINS];
} PROGRAMMER;
extern FILE * yyin;
extern PROGRAMMER * current_prog;
extern AVRPART * current_part;
extern int current_mem;
extern LISTID programmers;
extern LISTID part_list;
extern int lineno;
extern char * infile;
extern LISTID string_list;
extern LISTID number_list;
#if 0
#define YYSTYPE struct token_t *
#endif
extern YYSTYPE yylval;
extern char string_buf[MAX_STR_CONST];
extern char *string_buf_ptr;
int yyparse(void);
int init_config(void);
TOKEN * new_token(int primary);
void free_token(TOKEN * tkn);
void free_tokens(int n, ...);
TOKEN * number(char * text);
TOKEN * hexnumber(char * text);
TOKEN * string(char * text);
TOKEN * id(char * text);
TOKEN * keyword(int primary);
void print_token(TOKEN * tkn);
PROGRAMMER * new_programmer(void);
AVRPART * new_part(void);
AVRPART * dup_part(AVRPART * d);
char * dup_string(char * str);
#endif