Changing to C99 'bool'

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@562 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2002-05-13 12:45:46 +00:00
parent 2382044ffc
commit 7ae053a6e9
9 changed files with 54 additions and 62 deletions

View file

@ -329,24 +329,24 @@ static const unsigned char lcd_ascii[] = {
void lcd_clear_display(void) void lcd_clear_display(void)
{ {
int i; int i;
lcd_write(TRUE,LCD_CURSOR(0,0)); lcd_write(true,LCD_CURSOR(0,0));
for (i=0;i<24;i++) for (i=0;i<24;i++)
lcd_write(FALSE,0); lcd_write(false,0);
} }
void lcd_puts(int x, int y, char *string) void lcd_puts(int x, int y, char *string)
{ {
lcd_write(TRUE,LCD_CURSOR(x,y)); lcd_write(true,LCD_CURSOR(x,y));
while (*string) while (*string)
lcd_write(FALSE,LCD_ASCII(*string++)); lcd_write(false,LCD_ASCII(*string++));
} }
void lcd_define_pattern (int which,char *pattern,int length) void lcd_define_pattern (int which,char *pattern,int length)
{ {
int i; int i;
lcd_write(TRUE,LCD_PRAM|which); lcd_write(true,LCD_PRAM|which);
for (i=0;i<length;i++) for (i=0;i<length;i++)
lcd_write(FALSE,pattern[i]); lcd_write(false,pattern[i]);
} }
#endif #endif
@ -407,13 +407,13 @@ void lcd_init (void)
PBIOR |= 0x000f; /* IOR = 1 */ PBIOR |= 0x000f; /* IOR = 1 */
/* Initialize LCD */ /* Initialize LCD */
lcd_write (TRUE, LCD_CNTL_RESET); lcd_write (true, LCD_CNTL_RESET);
lcd_write (TRUE, LCD_CNTL_POWER); lcd_write (true, LCD_CNTL_POWER);
lcd_write (TRUE, LCD_CNTL_SEGREMAP); lcd_write (true, LCD_CNTL_SEGREMAP);
lcd_write (TRUE, LCD_CNTL_OUTSCAN); lcd_write (true, LCD_CNTL_OUTSCAN);
lcd_write (TRUE, LCD_CNTL_CONTRAST); lcd_write (true, LCD_CNTL_CONTRAST);
lcd_write (TRUE, 0x30); /* Contrast parameter */ lcd_write (true, 0x30); /* Contrast parameter */
lcd_write (TRUE, LCD_CNTL_DISPON); lcd_write (true, LCD_CNTL_DISPON);
lcd_clear_display(); lcd_clear_display();
lcd_update(); lcd_update();
@ -430,12 +430,12 @@ void lcd_update (void)
/* Copy display bitmap to hardware */ /* Copy display bitmap to hardware */
for (y = 0; y < LCD_HEIGHT/8; y++) for (y = 0; y < LCD_HEIGHT/8; y++)
{ {
lcd_write (TRUE, LCD_CNTL_PAGE | (y & 0xf)); lcd_write (true, LCD_CNTL_PAGE | (y & 0xf));
lcd_write (TRUE, LCD_CNTL_HIGHCOL); lcd_write (true, LCD_CNTL_HIGHCOL);
lcd_write (TRUE, LCD_CNTL_LOWCOL); lcd_write (true, LCD_CNTL_LOWCOL);
for (x = 0; x < LCD_WIDTH; x++) for (x = 0; x < LCD_WIDTH; x++)
lcd_write (FALSE, display[x][y]); lcd_write (false, display[x][y]);
} }
} }
@ -505,8 +505,8 @@ void lcd_putsxy(int x, int y, char *str, int thisfont)
else else
src = char_gen_6x8[ch-ASCII_MIN][0]; src = char_gen_6x8[ch-ASCII_MIN][0];
lcd_bitmap (src, lcd_x, lcd_y, nx-1, ny, TRUE); lcd_bitmap (src, lcd_x, lcd_y, nx-1, ny, true);
lcd_bitmap (zeros, lcd_x+nx-1, lcd_y, 1, ny, TRUE); lcd_bitmap (zeros, lcd_x+nx-1, lcd_y, 1, ny, true);
lcd_x += nx; lcd_x += nx;
} }
@ -515,7 +515,7 @@ void lcd_putsxy(int x, int y, char *str, int thisfont)
/* /*
* Display a bitmap at (x, y), size (nx, ny) * Display a bitmap at (x, y), size (nx, ny)
* clear is TRUE to clear destination area first * clear is true to clear destination area first
*/ */
void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny, void lcd_bitmap (unsigned char *src, int x, int y, int nx, int ny,
bool clear) bool clear)
@ -593,7 +593,7 @@ void lcd_clearrect (int x, int y, int nx, int ny)
{ {
int i; int i;
for (i = 0; i < nx; i++) for (i = 0; i < nx; i++)
lcd_bitmap (zeros, x+i, y, 1, ny, TRUE); lcd_bitmap (zeros, x+i, y, 1, ny, true);
} }
/* /*
@ -603,7 +603,7 @@ void lcd_fillrect (int x, int y, int nx, int ny)
{ {
int i; int i;
for (i = 0; i < nx; i++) for (i = 0; i < nx; i++)
lcd_bitmap (ones, x+i, y, 1, ny, TRUE); lcd_bitmap (ones, x+i, y, 1, ny, true);
} }
/* Invert a rectangular area at (x, y), size (nx, ny) */ /* Invert a rectangular area at (x, y), size (nx, ny) */
@ -611,7 +611,7 @@ void lcd_invertrect (int x, int y, int nx, int ny)
{ {
int i; int i;
for (i = 0; i < nx; i++) for (i = 0; i < nx; i++)
lcd_bitmap (ones, x+i, y, 1, ny, FALSE); lcd_bitmap (ones, x+i, y, 1, ny, false);
} }
#define DRAW_PIXEL(x,y) display[x][y/8] |= (1<<(y&7)) #define DRAW_PIXEL(x,y) display[x][y/8] |= (1<<(y&7))

View file

@ -17,7 +17,6 @@
* *
****************************************************************************/ ****************************************************************************/
#include "types.h"
#include "lcd.h" #include "lcd.h"
#include "button.h" #include "button.h"
#include "kernel.h" #include "kernel.h"

View file

@ -26,7 +26,6 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <file.h> #include <file.h>
#include <types.h>
#include <lcd.h> #include <lcd.h>
#include <button.h> #include <button.h>
#include "id3.h" #include "id3.h"

View file

@ -17,7 +17,6 @@
* *
****************************************************************************/ ****************************************************************************/
#include "types.h"
#include "lcd.h" #include "lcd.h"
#include "menu.h" #include "menu.h"

View file

@ -20,10 +20,9 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <file.h> #include "file.h"
#include <types.h> #include "lcd.h"
#include <lcd.h> #include "button.h"
#include <button.h>
#include "kernel.h" #include "kernel.h"
#include "tree.h" #include "tree.h"
#include "debug.h" #include "debug.h"

View file

@ -20,7 +20,6 @@
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include "screensaver.h" #include "screensaver.h"
#include "types.h"
#include "lcd.h" #include "lcd.h"
#include "button.h" #include "button.h"
#include "kernel.h" #include "kernel.h"

View file

@ -20,8 +20,7 @@
****************************************************************************/ ****************************************************************************/
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
#include <stdbool.h>
#include "types.h"
#include "lcd.h" #include "lcd.h"
#include "button.h" #include "button.h"
#include "kernel.h" #include "kernel.h"
@ -121,7 +120,7 @@ void draw_frame(int fstart_x,int fstop_x,int fstart_y,int fstop_y)
lcd_drawline(fstop_x, fstart_y, fstop_x, fstop_y); lcd_drawline(fstop_x, fstart_y, fstop_x, fstop_y);
} }
void draw_block(int x,int y,int block,int frame,int clear) void draw_block(int x,int y,int block,int frame,bool clear)
{ {
int i; int i;
for(i=0;i < 4;i++) { for(i=0;i < 4;i++) {
@ -143,7 +142,7 @@ void to_virtual()
(current_x+block_data[current_b][current_f][0][i])) = current_b+1; (current_x+block_data[current_b][current_f][0][i])) = current_b+1;
} }
int gameover() bool gameover()
{ {
int i; int i;
int frame, block, y, x; int frame, block, y, x;
@ -162,14 +161,14 @@ int gameover()
if(y+block_data[block][frame][1][i] < start_y) if(y+block_data[block][frame][1][i] < start_y)
{ {
/* Game over ;) */ /* Game over ;) */
return TRUE; return true;
} }
} }
} }
return FALSE; return false;
} }
int valid_position(int x,int y,int block,int frame) bool valid_position(int x,int y,int block,int frame)
{ {
int i; int i;
for(i=0;i < 4;i++) for(i=0;i < 4;i++)
@ -179,8 +178,8 @@ int valid_position(int x,int y,int block,int frame)
(x+block_data[block][frame][0][i] > max_x-1) || (x+block_data[block][frame][0][i] > max_x-1) ||
(y+block_data[block][frame][1][i] < 0) || (y+block_data[block][frame][1][i] < 0) ||
(y+block_data[block][frame][1][i] > max_y-1)) (y+block_data[block][frame][1][i] > max_y-1))
return FALSE; return false;
return TRUE; return true;
} }
void from_virtual() void from_virtual()
@ -207,10 +206,10 @@ void move_block(int x,int y,int f)
} }
if(valid_position(current_x+x,current_y+y,current_b,current_f)) if(valid_position(current_x+x,current_y+y,current_b,current_f))
{ {
draw_block(current_x,current_y,current_b,last_frame,TRUE); draw_block(current_x,current_y,current_b,last_frame,true);
current_x += x; current_x += x;
current_y += y; current_y += y;
draw_block(current_x,current_y,current_b,current_f,FALSE); draw_block(current_x,current_y,current_b,current_f,false);
lcd_update(); lcd_update();
} }
else else
@ -225,27 +224,28 @@ void new_block()
current_y = 0; current_y = 0;
next_b = t_rand(blocks); next_b = t_rand(blocks);
next_f = t_rand(block_frames[next_b]); next_f = t_rand(block_frames[next_b]);
draw_block(max_x+2,start_y-1,current_b,current_f,TRUE); draw_block(max_x+2,start_y-1,current_b,current_f,true);
draw_block(max_x+2,start_y-1,next_b,next_f,FALSE); draw_block(max_x+2,start_y-1,next_b,next_f,false);
if(!valid_position(current_x,current_y,current_b,current_f)) if(!valid_position(current_x,current_y,current_b,current_f))
{ {
draw_block(current_x,current_y,current_b,current_f,FALSE); draw_block(current_x,current_y,current_b,current_f,false);
lcd_update(); lcd_update();
} }
else else
draw_block(current_x,current_y,current_b,current_f,FALSE); draw_block(current_x,current_y,current_b,current_f,false);
} }
int check_lines() int check_lines()
{ {
int x,y,line,i; int x,y,i;
bool line;
int lines = 0; int lines = 0;
for(y=0;y < max_y;y++) for(y=0;y < max_y;y++)
{ {
line = TRUE; line = true;
for(x=0;x < max_x;x++) for(x=0;x < max_x;x++)
if(virtual[y*max_x+x] == 0) if(virtual[y*max_x+x] == 0)
line = FALSE; line = false;
if(line) if(line)
{ {
lines++; lines++;

View file

@ -19,24 +19,22 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdbool.h>
#include <dir.h> #include "dir.h"
#include <file.h> #include "file.h"
#include <types.h> #include "lcd.h"
#include <lcd.h> #include "button.h"
#include <button.h>
#include "kernel.h" #include "kernel.h"
#include "tree.h" #include "tree.h"
#include "icons.h" #include "icons.h"
#include "play.h" #include "play.h"
#define TREE_MAX_FILENAMELEN 128 #define TREE_MAX_FILENAMELEN 128
struct entry { struct entry {
int file; /* TRUE if file, FALSE if dir */ int file; /* true if file, false if dir */
char name[TREE_MAX_FILENAMELEN]; char name[TREE_MAX_FILENAMELEN];
int namelen; int namelen;
}; };
@ -110,7 +108,7 @@ int static showdir(char *path, struct entry *buffer, int start,
else else
icon_type=Folder; icon_type=Folder;
lcd_bitmap(bitmap_icons_6x8[icon_type], 6, MARGIN_Y+i*LINE_HEIGTH, 6, lcd_bitmap(bitmap_icons_6x8[icon_type], 6, MARGIN_Y+i*LINE_HEIGTH, 6,
8, TRUE); 8, true);
#endif #endif
if(len < TREE_MAX_LEN_DISPLAY) if(len < TREE_MAX_LEN_DISPLAY)
@ -177,13 +175,13 @@ bool dirbrowse(char *root)
} }
switch(key) { switch(key) {
case BUTTON_OFF: case BUTTON_OFF:
return FALSE; return false;
break; break;
case BUTTON_LEFT: case BUTTON_LEFT:
i=strlen(currdir); i=strlen(currdir);
if (i==1) { if (i==1) {
return FALSE; return false;
} }
else { else {
while (currdir[i-1]!='/') while (currdir[i-1]!='/')
@ -286,5 +284,5 @@ bool dirbrowse(char *root)
} }
} }
return FALSE; return false;
} }

View file

@ -16,7 +16,6 @@
* KIND, either express or implied. * KIND, either express or implied.
* *
****************************************************************************/ ****************************************************************************/
#include "types.h"
#include "button.h" #include "button.h"
#include "X11/keysym.h" #include "X11/keysym.h"