Rockbox.org home
release
dev builds
extras
themes manual
wiki
device status forums
mailing lists
IRC bugs
patches
dev guide



Rockbox mail archive

Subject: Re: Problems with rpncalc-2.c
From: BlueChip (cs_bluechip_at_webtribe.net)
Date: 2004-07-12


At 16:47 12/07/04, you wrote:
>Hey everyone,
>
>I'm having problems with getting my Reverse Polish Notation calculator
>plugin working. It seems that my field variables are not being modified
>at all, and I can't pinpoint where in my code that is happening.
>
>If anyone could give me a hand, the least I could do is owe you a pint ;)
>
>My Source can be found on:
>http://code.trancegeek.net/rpncalc-2.c
>
>Thanks!
>_______________________________________________
>http://cool.haxx.se/mailman/listinfo/rockbox

I cannot find the variable "field" ...few comments that will make the
compiler happy though:

C89: all variables must be declared IMMEDIATELY after an "{" (open brace)
int b = rb->button_get(true);
...plus, quite bluntly, if you do not care for the keypress, then this will do:
rb->button_get(true);

static int get_key_press()
should be:
static int get_key_press(void)

rb->lcd_invertrect(px*w,7*h,w,h);
Why "7*h"??? Surely that should be "7" ...as taken from
rb->lcd_puts(0,7,"0123456789 +-*/");
               ^^^

double rpnstack[5];
...
     for(i=0;i<=5;i++)
         rpnstack[i]=rpnstack[i+1];
errrr, 0,1,2,3,4,5 ...that's SIX numbers and you've only delared [5] elements
not least of all to mention that you request [i+1] which will eventually
request element [6] !!!
...try:
     for(i=0;i<4;i++)

this element does not exist:
     rpnstack[5]=0;
[0],[1],[2],[3],[4] ...that's all you've declared

Whether this will fix the "field" problem, I don't know, but it will sure
make a difference

blOOchip

_______________________________________________
http://cool.haxx.se/mailman/listinfo/rockbox



Page was last modified "Jan 10 2012" The Rockbox Crew
aaa