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: source suggestings (was missing win32 file)
From: Björn Stenberg (bjorn_at_haxx.se)
Date: 2002-06-12


Greg Haerr wrote:

> My idea is that, if this app code is shared, then the #ifdef's could be
> removed by using only BUTTON_{UP,DOWN,LEFT,RIGHT} rather than the
> current BUTTON_LEFT for the recorder version and BUTTON_STOP for the
> player version.

Unfortunately, we can't do that. The recorder and the player don't use the
same buttons:

The player uses left/right (+/-) to advance in the directory list, while
the recorder uses up/down for the same functions. The recorder instead
uses left/right to enter/exit a directory or function, whereas the player
uses play/stop for this function.

One solution would be to rename the key defines into "logical" names such
as BUTTON_NEXT etc but that quickly becomes confusing in code such as
Tetris.

A good combination solution, I think, is to create such logical button
defintions on a file/module level, so that tree.c for instance defines and
uses BUTTON_NEXT locally. That removes the #ifdefs from the switch
statement and thus cleans it up considerably.

> it's just intended to be a helpful comment from somebody who's just
> taken a quick look at the entire source tree.

I appreciate it. Your comments just improved the code!

> I agree. The init code for the simulator and target versions probably
> needs to be consolidated as well then. That will remove more #ifndef
> SIMULATOR calls.

Sure. Consolitating the init just means creating a number of stubs for the
target init calls, which isn't much of a problem.

-- 
Björn



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