* lexer.l,config_gram.y,config.[hc]: changed reading of numbers to integers except of default_bitclock which is the only real number.

No signs are allowed as negative values do not make sense for current config values.
* buspirate.c: include own header file buspirate.h
* doc/.cvsignore: add programmers.texi to ignore list

git-svn-id: svn://svn.savannah.nongnu.org/avrdude/trunk/avrdude@1105 81a1dc3b-b13d-400b-aceb-764788c761c2
This commit is contained in:
Rene Liebscher 2012-11-04 17:18:59 +00:00
parent dd3ce5f0e1
commit 673f43f37d
8 changed files with 67 additions and 18 deletions

View File

@ -1,3 +1,12 @@
2012-11-04 Rene Liebscher <R.Liebscher@gmx.de>
* lexer.l,config_gram.y,config.[hc]: changed reading of numbers to integers
except of default_bitclock which is the only real number.
No signs are allowed as negative values do not make sense for current
config values.
* buspirate.c: include own header file buspirate.h
* doc/.cvsignore: add programmers.texi to ignore list
2012-09-06 Joerg Wunsch <j.gnu@uriah.heep.sax.de>
* doc/Makefile.am: add EXTRA_DIST, replace $(srcdir) by

View File

@ -326,7 +326,7 @@
#
default_parallel = "@DEFAULT_PAR_PORT@";
default_serial = "@DEFAULT_SER_PORT@";
# default_bitclock = 2.5
# default_bitclock = 2.5;
#

View File

@ -50,6 +50,7 @@
#include "avr.h"
#include "pgm.h"
#include "serial.h"
#include "buspirate.h"
/* ====== Private data structure ====== */
/* CS and AUX pin bitmasks in

View File

@ -149,15 +149,29 @@ TOKEN * number(char * text)
tkn = new_token(TKN_NUMBER);
tkn->value.type = V_NUM;
tkn->value.number = atof(text);
tkn->value.number = atoi(text);
#if DEBUG
fprintf(stderr, "NUMBER(%g)\n", tkn->value.number);
fprintf(stderr, "NUMBER(%d)\n", tkn->value.number);
#endif
return tkn;
}
TOKEN * number_real(char * text)
{
struct token_t * tkn;
tkn = new_token(TKN_NUMBER);
tkn->value.type = V_NUM_REAL;
tkn->value.number_real = atof(text);
#if DEBUG
fprintf(stderr, "NUMBER(%g)\n", tkn->value.number_real);
#endif
return tkn;
}
TOKEN * hexnumber(char * text)
{
@ -224,7 +238,11 @@ void print_token(TOKEN * tkn)
fprintf(stderr, "token = %d = ", tkn->primary);
switch (tkn->value.type) {
case V_NUM:
fprintf(stderr, "NUMBER, value=%g", tkn->value.number);
fprintf(stderr, "NUMBER, value=%d", tkn->value.number);
break;
case V_NUM_REAL:
fprintf(stderr, "NUMBER, value=%g", tkn->value.number_real);
break;
case V_STR:

View File

@ -29,11 +29,14 @@
#define MAX_STR_CONST 1024
enum { V_NONE, V_NUM, V_STR };
enum { V_NONE, V_NUM, V_NUM_REAL, V_STR };
typedef struct value_t {
int type;
double number;
/*union { TODO: use an anonymous union here ? */
int number;
double number_real;
char * string;
/*};*/
} VALUE;
@ -91,6 +94,8 @@ void free_tokens(int n, ...);
TOKEN * number(char * text);
TOKEN * number_real(char * text);
TOKEN * hexnumber(char * text);
TOKEN * string(char * text);

View File

@ -200,12 +200,24 @@ static int pin_name;
%token TKN_SEMI
%token TKN_TILDE
%token TKN_NUMBER
%token TKN_NUMBER_REAL
%token TKN_STRING
%start configuration
%%
number_real :
TKN_NUMBER {
$$ = $1;
/* convert value to real */
$$->value.number_real = $$->value.number;
$$->value.type = V_NUM_REAL;
} |
TKN_NUMBER_REAL {
$$ = $1;
}
configuration :
/* empty */ | config
;
@ -239,8 +251,8 @@ def :
free_token($3);
} |
K_DEFAULT_BITCLOCK TKN_EQUAL TKN_NUMBER TKN_SEMI {
default_bitclock = $3->value.number;
K_DEFAULT_BITCLOCK TKN_EQUAL number_real TKN_SEMI {
default_bitclock = $3->value.number_real;
free_token($3);
}
;

View File

@ -22,3 +22,4 @@ texinfo.tex
version.texi
programmer_types.texi
parts.texi
programmers.texi

View File

@ -57,9 +57,12 @@ SIGN [+-]
%%
{SIGN}*{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; }
{SIGN}*{DIGIT}+"."{DIGIT}* { yylval = number(yytext); return TKN_NUMBER; }
{SIGN}*"."{DIGIT}* { yylval = number(yytext); return TKN_NUMBER; }
#{SIGN}*{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; }
#{SIGN}*{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; }
#{SIGN}*"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; }
{DIGIT}+ { yylval = number(yytext); return TKN_NUMBER; }
{DIGIT}+"."{DIGIT}* { yylval = number_real(yytext); return TKN_NUMBER_REAL; }
"."{DIGIT}+ { yylval = number_real(yytext); return TKN_NUMBER_REAL; }
"\"" { string_buf_ptr = string_buf; BEGIN(strng); }