plugins: make local functions static for a subset of plugins

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30564 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Bertrik Sikken 2011-09-17 17:20:27 +00:00
parent e03faf835d
commit d91e67acc9
14 changed files with 124 additions and 122 deletions

View file

@ -630,7 +630,7 @@ static void cube_draw(void)
} }
} }
void cleanup(void) static void cleanup(void)
{ {
#ifdef USEGSLIB #ifdef USEGSLIB
grey_release(); grey_release();

View file

@ -68,10 +68,10 @@ static struct configdata config[] =
{TYPE_ENUM, 0, 8, { .int_p = &sides_index }, "side count", sides_conf} {TYPE_ENUM, 0, 8, { .int_p = &sides_index }, "side count", sides_conf}
}; };
void dice_init(struct dices* dice); static void dice_init(struct dices* dice);
void dice_roll(struct dices* dice); static void dice_roll(struct dices* dice);
void dice_print(struct dices* dice, struct screen* display); static void dice_print(struct dices* dice, struct screen* display);
bool dice_menu(struct dices* dice); static bool dice_menu(struct dices* dice);
/* plugin entry point */ /* plugin entry point */
enum plugin_status plugin_start(const void* parameter) { enum plugin_status plugin_start(const void* parameter) {
@ -107,13 +107,13 @@ enum plugin_status plugin_start(const void* parameter) {
} }
} }
void dice_init(struct dices* dice){ static void dice_init(struct dices* dice){
dice->nb_dices=INITIAL_NB_DICES; dice->nb_dices=INITIAL_NB_DICES;
sides_index=INITIAL_NB_SIDES; sides_index=INITIAL_NB_SIDES;
} }
void dice_roll(struct dices* dice) { static void dice_roll(struct dices* dice) {
int i; int i;
dice->total = 0; dice->total = 0;
for (i=0; i<dice->nb_dices; i++) { for (i=0; i<dice->nb_dices; i++) {
@ -122,7 +122,7 @@ void dice_roll(struct dices* dice) {
} }
} }
void dice_print_string_buffer(struct dices* dice, char* buffer, static void dice_print_string_buffer(struct dices* dice, char* buffer,
int start, int end){ int start, int end){
int i, written; int i, written;
for (i=start; i<end; i++) { for (i=start; i<end; i++) {
@ -132,7 +132,7 @@ void dice_print_string_buffer(struct dices* dice, char* buffer,
} }
} }
void dice_print(struct dices* dice, struct screen* display){ static void dice_print(struct dices* dice, struct screen* display){
char buffer[PRINT_BUFFER_LENGTH]; char buffer[PRINT_BUFFER_LENGTH];
/* display characteristics */ /* display characteristics */
int char_height, char_width; int char_height, char_width;
@ -171,7 +171,7 @@ void dice_print(struct dices* dice, struct screen* display){
display->update(); display->update();
} }
bool dice_menu(struct dices * dice) { static bool dice_menu(struct dices * dice) {
int selection; int selection;
bool menu_quit = false, result = false; bool menu_quit = false, result = false;

View file

@ -48,7 +48,7 @@ struct stWord
#ifdef ROCKBOX_BIG_ENDIAN #ifdef ROCKBOX_BIG_ENDIAN
#define reverse(x) x #define reverse(x) x
#else #else
long reverse (long N) { static long reverse (long N) {
unsigned char B[4]; unsigned char B[4];
B[0] = (N & 0x000000FF) >> 0; B[0] = (N & 0x000000FF) >> 0;
B[1] = (N & 0x0000FF00) >> 8; B[1] = (N & 0x0000FF00) >> 8;

View file

@ -47,7 +47,7 @@ bool tidy_loaded_and_changed = false;
#define DEFAULT_FILES PLUGIN_APPS_DATA_DIR "/disktidy.config" #define DEFAULT_FILES PLUGIN_APPS_DATA_DIR "/disktidy.config"
#define CUSTOM_FILES PLUGIN_APPS_DATA_DIR "/disktidy_custom.config" #define CUSTOM_FILES PLUGIN_APPS_DATA_DIR "/disktidy_custom.config"
void add_item(const char* name, int index) static void add_item(const char* name, int index)
{ {
char *a; char *a;
struct tidy_type *entry = tidy_types + index; struct tidy_type *entry = tidy_types + index;
@ -115,7 +115,7 @@ static int find_file_string(const char *file, char *last_group)
return i; return i;
} }
bool tidy_load_file(const char* file) static bool tidy_load_file(const char* file)
{ {
int fd = rb->open(file, O_RDONLY), i; int fd = rb->open(file, O_RDONLY), i;
char buf[MAX_PATH], *str, *remove; char buf[MAX_PATH], *str, *remove;
@ -165,7 +165,7 @@ static bool match(struct tidy_type *tidy_type, char *string, int len)
string + len - tidy_type->post) == 0); string + len - tidy_type->post) == 0);
} }
bool tidy_remove_item(char *item, int attr) static bool tidy_remove_item(char *item, int attr)
{ {
int i; int i;
int len; int len;
@ -186,7 +186,7 @@ bool tidy_remove_item(char *item, int attr)
return ret; return ret;
} }
void tidy_lcd_status(const char *name) static void tidy_lcd_status(const char *name)
{ {
/* display status text */ /* display status text */
rb->lcd_clear_display(); rb->lcd_clear_display();
@ -198,7 +198,7 @@ void tidy_lcd_status(const char *name)
rb->lcd_update(); rb->lcd_update();
} }
int tidy_path_append_entry(char *path, struct dirent *entry, int *path_length) static int tidy_path_append_entry(char *path, struct dirent *entry, int *path_length)
{ {
int name_len = rb->strlen(entry->d_name); int name_len = rb->strlen(entry->d_name);
/* for the special case of path="/" this is one bigger but it's not a problem */ /* for the special case of path="/" this is one bigger but it's not a problem */
@ -223,7 +223,7 @@ int tidy_path_append_entry(char *path, struct dirent *entry, int *path_length)
return 1; return 1;
} }
void tidy_path_remove_entry(char *path, int old_path_length, int *path_length) static void tidy_path_remove_entry(char *path, int old_path_length, int *path_length)
{ {
path[old_path_length] = '\0'; path[old_path_length] = '\0';
*path_length = old_path_length; *path_length = old_path_length;
@ -233,7 +233,7 @@ void tidy_path_remove_entry(char *path, int old_path_length, int *path_length)
removing all files and directories in that directory. removing all files and directories in that directory.
path is assumed to be array of size MAX_PATH. path is assumed to be array of size MAX_PATH.
*/ */
enum tidy_return tidy_removedir(char *path, int *path_length) static enum tidy_return tidy_removedir(char *path, int *path_length)
{ {
/* delete directory */ /* delete directory */
struct dirent *entry; struct dirent *entry;
@ -307,7 +307,7 @@ enum tidy_return tidy_removedir(char *path, int *path_length)
} }
/* path is assumed to be array of size MAX_PATH */ /* path is assumed to be array of size MAX_PATH */
enum tidy_return tidy_clean(char *path, int *path_length) static enum tidy_return tidy_clean(char *path, int *path_length)
{ {
/* deletes junk files and dirs left by system */ /* deletes junk files and dirs left by system */
struct dirent *entry; struct dirent *entry;
@ -400,7 +400,7 @@ enum tidy_return tidy_clean(char *path, int *path_length)
} }
} }
enum tidy_return tidy_do(void) static enum tidy_return tidy_do(void)
{ {
/* clean disk and display num of items removed */ /* clean disk and display num of items removed */
enum tidy_return status; enum tidy_return status;
@ -432,7 +432,7 @@ enum tidy_return tidy_do(void)
return status; return status;
} }
enum themable_icons get_icon(int item, void * data) static enum themable_icons get_icon(int item, void * data)
{ {
(void)data; (void)data;
if (tidy_types[item].filestring[0] == '<') /* special type */ if (tidy_types[item].filestring[0] == '<') /* special type */
@ -456,7 +456,7 @@ static const char* get_name(int selected_item, void * data,
return tidy_types[selected_item].filestring; return tidy_types[selected_item].filestring;
} }
int list_action_callback(int action, struct gui_synclist *lists) static int list_action_callback(int action, struct gui_synclist *lists)
{ {
if (action == ACTION_STD_OK) if (action == ACTION_STD_OK)
{ {
@ -499,7 +499,7 @@ int list_action_callback(int action, struct gui_synclist *lists)
return action; return action;
} }
enum tidy_return tidy_lcd_menu(void) static enum tidy_return tidy_lcd_menu(void)
{ {
int selection = 0; int selection = 0;
enum tidy_return status = TIDY_RETURN_OK; enum tidy_return status = TIDY_RETURN_OK;

View file

@ -110,14 +110,14 @@ void patterns_deinit(struct screen* display)
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */
/*Call when the program exit*/ /*Call when the program exit*/
void jackpot_exit(void) static void jackpot_exit(void)
{ {
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
patterns_deinit(rb->screens[SCREEN_MAIN]); patterns_deinit(rb->screens[SCREEN_MAIN]);
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */
} }
void jackpot_init(struct jackpot* game) static void jackpot_init(struct jackpot* game)
{ {
int i,j; int i,j;
game->money=20; game->money=20;
@ -128,7 +128,7 @@ void jackpot_init(struct jackpot* game)
} }
} }
int jackpot_get_result(struct jackpot* game) static int jackpot_get_result(struct jackpot* game)
{ {
int i=NB_SLOTS-1; int i=NB_SLOTS-1;
int multiple=1; int multiple=1;
@ -141,7 +141,7 @@ int jackpot_get_result(struct jackpot* game)
return(result); return(result);
} }
int jackpot_get_gain(struct jackpot* game) static int jackpot_get_gain(struct jackpot* game)
{ {
switch (jackpot_get_result(game)) switch (jackpot_get_result(game))
{ {
@ -164,7 +164,7 @@ int jackpot_get_gain(struct jackpot* game)
return(0); return(0);
} }
void jackpot_display_slot_machine(struct jackpot* game, struct screen* display) static void jackpot_display_slot_machine(struct jackpot* game, struct screen* display)
{ {
char str[20]; char str[20];
int i; int i;
@ -215,7 +215,7 @@ void jackpot_display_slot_machine(struct jackpot* game, struct screen* display)
} }
void jackpot_info_message(struct screen* display, char* message) static void jackpot_info_message(struct screen* display, char* message)
{ {
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS
display->puts_scroll(0,1,message); display->puts_scroll(0,1,message);
@ -232,7 +232,7 @@ void jackpot_info_message(struct screen* display, char* message)
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */
} }
void jackpot_print_turn_result(struct jackpot* game, static void jackpot_print_turn_result(struct jackpot* game,
int gain, struct screen* display) int gain, struct screen* display)
{ {
char str[20]; char str[20];
@ -250,7 +250,7 @@ void jackpot_print_turn_result(struct jackpot* game,
display->update(); display->update();
} }
void jackpot_play_turn(struct jackpot* game) static void jackpot_play_turn(struct jackpot* game)
{ {
/* How many pattern? */ /* How many pattern? */
int nb_turns[NB_SLOTS]; int nb_turns[NB_SLOTS];

View file

@ -148,7 +148,7 @@ static struct viewport vp_lyrics[NB_SCREENS];
#else /* HAVE_LCD_BITMAP */ #else /* HAVE_LCD_BITMAP */
#define LST_OFF_Y 1 #define LST_OFF_Y 1
#endif #endif
int lrc_set_time(const char *title, const char *unit, long *pval, static int lrc_set_time(const char *title, const char *unit, long *pval,
int step, int min, int max, int flags) int step, int min, int max, int flags)
{ {
const struct button_mapping *lst_contexts[] = { const struct button_mapping *lst_contexts[] = {

View file

@ -839,7 +839,7 @@ static int count_bigv ( short *ix, uint32_t start, uint32_t end, int table0, in
int *bits); int *bits);
bool checkString(int fd, char *string) static bool checkString(int fd, char *string)
{ {
char temp[4]; char temp[4];
@ -849,7 +849,7 @@ bool checkString(int fd, char *string)
return !rb->memcmp(temp, string, 4); return !rb->memcmp(temp, string, 4);
} }
int Read16BitsLowHigh(int fd) static int Read16BitsLowHigh(int fd)
{ {
char first, second; char first, second;
@ -860,7 +860,7 @@ int Read16BitsLowHigh(int fd)
} }
int Read32BitsLowHigh(int fd) static int Read32BitsLowHigh(int fd)
{ {
int first = 0xffff & Read16BitsLowHigh(fd); int first = 0xffff & Read16BitsLowHigh(fd);
int second = 0xffff & Read16BitsLowHigh(fd); int second = 0xffff & Read16BitsLowHigh(fd);
@ -868,7 +868,7 @@ int Read32BitsLowHigh(int fd)
return (second << 16) + first; return (second << 16) + first;
} }
int wave_open(void) static int wave_open(void)
{ {
unsigned short wFormatTag; unsigned short wFormatTag;
/* rockbox: comment 'set but unused" variable /* rockbox: comment 'set but unused" variable
@ -912,7 +912,7 @@ int wave_open(void)
return 0; return 0;
} }
int read_samples(uint16_t *buffer, int num_samples) static int read_samples(uint16_t *buffer, int num_samples)
{ {
uint16_t tmpbuf[MAX_SAMP_PER_FRAME*2]; /* SAMP_PER_FRAME*MAX_CHANNELS */ uint16_t tmpbuf[MAX_SAMP_PER_FRAME*2]; /* SAMP_PER_FRAME*MAX_CHANNELS */
int byte_per_sample = cfg.channels * 2; /* requires bits_per_sample==16 */ int byte_per_sample = cfg.channels * 2; /* requires bits_per_sample==16 */
@ -1247,7 +1247,7 @@ void putbits(uint32_t val, uint32_t nbit)
/* of the Huffman tables as defined in the IS (Table B.7), and will not */ /* of the Huffman tables as defined in the IS (Table B.7), and will not */
/* work with any arbitrary tables. */ /* work with any arbitrary tables. */
/***************************************************************************/ /***************************************************************************/
int choose_table( short *ix, uint32_t begin, uint32_t end, int *bits ) static int choose_table( short *ix, uint32_t begin, uint32_t end, int *bits )
{ {
uint32_t i; uint32_t i;
int max, table0, table1; int max, table0, table1;
@ -1392,7 +1392,7 @@ int count_bigv(short *ix, uint32_t start, uint32_t end, int table0,
/* Function: Calculation of rzero, count1, address3 */ /* Function: Calculation of rzero, count1, address3 */
/* (Partitions ix into big values, quadruples and zeros). */ /* (Partitions ix into big values, quadruples and zeros). */
/*************************************************************************/ /*************************************************************************/
int calc_runlen( short *ix, side_info_t *si ) static int calc_runlen( short *ix, side_info_t *si )
{ {
int p, i, sum = 0; int p, i, sum = 0;
@ -1438,7 +1438,7 @@ int calc_runlen( short *ix, side_info_t *si )
/*************************************************************************/ /*************************************************************************/
/* Function: Quantization of the vector xr ( -> ix) */ /* Function: Quantization of the vector xr ( -> ix) */
/*************************************************************************/ /*************************************************************************/
int quantize_int(int *xr, short *ix, side_info_t *si) static int quantize_int(int *xr, short *ix, side_info_t *si)
{ {
unsigned int i, idx, s, frac_pow[] = { 0x10000, 0xd745, 0xb505, 0x9838 }; unsigned int i, idx, s, frac_pow[] = { 0x10000, 0xd745, 0xb505, 0x9838 };
@ -1470,7 +1470,7 @@ int quantize_int(int *xr, short *ix, side_info_t *si)
/*************************************************************************/ /*************************************************************************/
/* subdivides the bigvalue region which will use separate Huffman tables */ /* subdivides the bigvalue region which will use separate Huffman tables */
/*************************************************************************/ /*************************************************************************/
void subdivide(side_info_t *si) static void subdivide(side_info_t *si)
{ {
int scfb, count0, count1; int scfb, count0, count1;
@ -1498,7 +1498,7 @@ void subdivide(side_info_t *si)
/*******************************************************************/ /*******************************************************************/
/* Count the number of bits necessary to code the bigvalues region */ /* Count the number of bits necessary to code the bigvalues region */
/*******************************************************************/ /*******************************************************************/
int bigv_bitcount(short *ix, side_info_t *gi) static int bigv_bitcount(short *ix, side_info_t *gi)
{ {
int b1=0, b2=0, b3=0; int b1=0, b2=0, b3=0;
@ -1519,7 +1519,7 @@ int bigv_bitcount(short *ix, side_info_t *gi)
return b1+b2+b3; return b1+b2+b3;
} }
int quantize_and_count_bits(int *xr, short *ix, side_info_t *si) static int quantize_and_count_bits(int *xr, short *ix, side_info_t *si)
{ {
int bits = 10000; int bits = 10000;
@ -1536,7 +1536,7 @@ int quantize_and_count_bits(int *xr, short *ix, side_info_t *si)
/************************************************************************/ /************************************************************************/
/* The code selects the best quantStep for a particular set of scalefacs*/ /* The code selects the best quantStep for a particular set of scalefacs*/
/************************************************************************/ /************************************************************************/
int inner_loop(int *xr, int max_bits, side_info_t *si) static int inner_loop(int *xr, int max_bits, side_info_t *si)
{ {
int bits; int bits;
@ -1560,7 +1560,7 @@ int inner_loop(int *xr, int max_bits, side_info_t *si)
return bits; return bits;
} }
void iteration_loop(int *xr, side_info_t *si, int gr_cnt) static void iteration_loop(int *xr, side_info_t *si, int gr_cnt)
{ {
int remain, tar_bits, max_bits = cfg.mean_bits; int remain, tar_bits, max_bits = cfg.mean_bits;
@ -2072,7 +2072,7 @@ static int find_samplerate_index(uint16_t freq, int *mp3_type)
return 0; return 0;
} }
void init_mp3_encoder_engine(bool stereo, int bitrate, uint16_t sample_rate) static void init_mp3_encoder_engine(bool stereo, int bitrate, uint16_t sample_rate)
{ {
uint32_t avg_byte_per_frame; uint32_t avg_byte_per_frame;
@ -2130,7 +2130,7 @@ void init_mp3_encoder_engine(bool stereo, int bitrate, uint16_t sample_rate)
: (cfg.channels == 1 ? 72 : 136)); : (cfg.channels == 1 ? 72 : 136));
} }
void set_scale_facs(int *mdct_freq) static void set_scale_facs(int *mdct_freq)
{ {
unsigned int i, is, ie, k, s; unsigned int i, is, ie, k, s;
int max_freq_val, avrg_freq_val; int max_freq_val, avrg_freq_val;
@ -2163,7 +2163,7 @@ void set_scale_facs(int *mdct_freq)
} }
} }
void compress(void) static void compress(void)
{ {
int i, gr, gr_cnt; int i, gr, gr_cnt;
uint32_t max; uint32_t max;
@ -2369,7 +2369,7 @@ void compress(void)
int num_file; int num_file;
char mp3_name[80]; char mp3_name[80];
void get_mp3_filename(const char *wav_name) static void get_mp3_filename(const char *wav_name)
{ {
rb->strlcpy(mp3_name, wav_name, sizeof(mp3_name)); rb->strlcpy(mp3_name, wav_name, sizeof(mp3_name));
rb->strlcpy(mp3_name + rb->strlen(mp3_name) - 4, ".mp3", 5); rb->strlcpy(mp3_name + rb->strlen(mp3_name) - 4, ".mp3", 5);

View file

@ -43,7 +43,7 @@ struct file_format {
}; };
struct file_format *list = NULL; struct file_format *list = NULL;
void update_screen(bool clear) static void update_screen(bool clear)
{ {
char buf[15]; char buf[15];
int i; int i;
@ -58,7 +58,7 @@ void update_screen(bool clear)
} }
} }
void traversedir(char* location, char* name) static void traversedir(char* location, char* name)
{ {
struct dirent *entry; struct dirent *entry;
DIR* dir; DIR* dir;
@ -126,7 +126,7 @@ void traversedir(char* location, char* name)
} }
} }
bool custom_dir(void) static bool custom_dir(void)
{ {
DIR* dir_check; DIR* dir_check;
char *starts, line[MAX_PATH], formatted_line[MAX_PATH]; char *starts, line[MAX_PATH], formatted_line[MAX_PATH];
@ -212,7 +212,7 @@ bool custom_dir(void)
return true; return true;
} }
void generate(void) static void generate(void)
{ {
dirs_count = 0; dirs_count = 0;
cancel = false; cancel = false;
@ -245,7 +245,7 @@ static const char* list_get_name_cb(int selected_item, void* data,
return buf; return buf;
} }
int load_list(void) static int load_list(void)
{ {
int myfd = rb->open(RFA_FILE,O_RDONLY); int myfd = rb->open(RFA_FILE,O_RDONLY);
if (myfd < 0) if (myfd < 0)
@ -263,7 +263,7 @@ int load_list(void)
return 0; return 0;
} }
int save_list(void) static int save_list(void)
{ {
int myfd = rb->creat(RFA_FILE, 0666); int myfd = rb->creat(RFA_FILE, 0666);
if (myfd < 0) if (myfd < 0)
@ -288,7 +288,7 @@ int save_list(void)
return 1; return 1;
} }
int edit_list(void) static int edit_list(void)
{ {
struct gui_synclist lists; struct gui_synclist lists;
bool exit = false; bool exit = false;
@ -373,7 +373,7 @@ int edit_list(void)
return ret; return ret;
} }
int export_list_to_file_text(void) static int export_list_to_file_text(void)
{ {
int i = 0; int i = 0;
/* load the dat file if not already done */ /* load the dat file if not already done */
@ -412,7 +412,7 @@ int export_list_to_file_text(void)
return 1; return 1;
} }
int import_list_from_file_text(void) static int import_list_from_file_text(void)
{ {
char line[MAX_PATH]; char line[MAX_PATH];
@ -465,7 +465,7 @@ int import_list_from_file_text(void)
return list->count; return list->count;
} }
int start_shuffled_play(void) static int start_shuffled_play(void)
{ {
int *order; int *order;
size_t max_shuffle_size; size_t max_shuffle_size;
@ -539,7 +539,7 @@ int start_shuffled_play(void)
return 1; return 1;
} }
enum plugin_status main_menu(void) static enum plugin_status main_menu(void)
{ {
bool exit = false; bool exit = false;
MENUITEM_STRINGLIST(menu, "Main Menu", NULL, MENUITEM_STRINGLIST(menu, "Main Menu", NULL,

View file

@ -75,7 +75,7 @@ static enum themable_icons list_get_icon_cb(int selected_item, void *data)
return Icon_NOICON; return Icon_NOICON;
} }
bool save_changes(void) static bool save_changes(void)
{ {
int fd; int fd;
int i; int i;
@ -123,7 +123,7 @@ bool save_changes(void)
return true; return true;
} }
void create_view(struct gui_synclist *lists) static void create_view(struct gui_synclist *lists)
{ {
unsigned int cnt = 0; unsigned int cnt = 0;
int i, j; int i, j;
@ -168,7 +168,7 @@ void create_view(struct gui_synclist *lists)
} }
} }
bool toggle(int selected_item) static bool toggle(int selected_item)
{ {
if (items_list[view_id_list[selected_item]].flag == FL_CATEGORY) if (items_list[view_id_list[selected_item]].flag == FL_CATEGORY)
return false; return false;
@ -179,7 +179,7 @@ bool toggle(int selected_item)
return true; return true;
} }
void update_category_string(void) static void update_category_string(void)
{ {
if (show_categories) if (show_categories)
rb->strcpy(category_string,"Hide categories"); rb->strcpy(category_string,"Hide categories");
@ -187,7 +187,7 @@ void update_category_string(void)
rb->strcpy(category_string,"Show categories"); rb->strcpy(category_string,"Show categories");
} }
enum plugin_status load_file(void) static enum plugin_status load_file(void)
{ {
int fd; int fd;
static char temp_line[DESC_SIZE]; static char temp_line[DESC_SIZE];

View file

@ -415,7 +415,7 @@ static struct highscore highscores[NUM_SCORES];
#define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels" #define LEVELS_FILE PLUGIN_GAMES_DIR "/snake2.levels"
#define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/snake2.score" #define SCORE_FILE PLUGIN_GAMES_DATA_DIR "/snake2.score"
int load_all_levels(void) static int load_all_levels(void)
{ {
int linecnt = 0; int linecnt = 0;
int fd; int fd;
@ -465,7 +465,7 @@ int load_all_levels(void)
** Completely clear the board of walls and/or snake ** Completely clear the board of walls and/or snake
*/ */
void clear_board( void) static void clear_board( void)
{ {
int x,y; int x,y;
@ -478,7 +478,7 @@ void clear_board( void)
} }
} }
int load_level( int level_number ) static int load_level( int level_number )
{ {
int x,y; int x,y;
clear_board(); clear_board();
@ -510,7 +510,7 @@ int load_level( int level_number )
** in the direction buffer. If there is something in the ** in the direction buffer. If there is something in the
** next part of the buffer then that is moved to the first place ** next part of the buffer then that is moved to the first place
*/ */
void get_direction( void ) static void get_direction( void )
{ {
/*if 1st place is empty*/ /*if 1st place is empty*/
if(ardirectionbuffer[0] != -1) if(ardirectionbuffer[0] != -1)
@ -532,7 +532,7 @@ void get_direction( void )
/* /*
** Sets the direction ** Sets the direction
*/ */
void set_direction(int newdir) static void set_direction(int newdir)
{ {
if(ardirectionbuffer[0] != newdir) if(ardirectionbuffer[0] != newdir)
{ {
@ -552,7 +552,7 @@ void set_direction(int newdir)
} }
} }
void new_level(int level) static void new_level(int level)
{ {
load_level(level); load_level(level);
@ -573,7 +573,7 @@ void new_level(int level)
num_apples_to_got=0; num_apples_to_got=0;
} }
void init_snake(void) static void init_snake(void)
{ {
num_apples_to_get=1; num_apples_to_get=1;
if(game_type == 1) if(game_type == 1)
@ -583,7 +583,7 @@ void init_snake(void)
} }
#if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128) #if (LCD_WIDTH >= 160) && (LCD_HEIGHT >= 128)
void draw_frame_bitmap(int header_type) static void draw_frame_bitmap(int header_type)
{ {
rb->lcd_bitmap(header_type==1? snake2_header1: snake2_header2, 0, 0, rb->lcd_bitmap(header_type==1? snake2_header1: snake2_header2, 0, 0,
BMPWIDTH_snake2_header, BMPHEIGHT_snake2_header); BMPWIDTH_snake2_header, BMPHEIGHT_snake2_header);
@ -602,7 +602,7 @@ void draw_frame_bitmap(int header_type)
** Draws the apple. If it doesn't exist then ** Draws the apple. If it doesn't exist then
** a new one get's created. ** a new one get's created.
*/ */
void draw_apple_bit(int x, int y) static void draw_apple_bit(int x, int y)
{ {
rb->lcd_fillrect((CENTER_X+x*MULTIPLIER)+1, CENTER_Y+y*MULTIPLIER, rb->lcd_fillrect((CENTER_X+x*MULTIPLIER)+1, CENTER_Y+y*MULTIPLIER,
MODIFIER_2, MODIFIER_1); MODIFIER_2, MODIFIER_1);
@ -610,7 +610,7 @@ void draw_apple_bit(int x, int y)
MODIFIER_1, MODIFIER_2); MODIFIER_1, MODIFIER_2);
} }
void draw_apple( void ) static void draw_apple( void )
{ {
int x,y; int x,y;
@ -646,7 +646,7 @@ void draw_apple( void )
* x x * * x x *
* x x * * x x *
*/ */
void draw_vertical_bit(int x, int y) static void draw_vertical_bit(int x, int y)
{ {
rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER,
MODIFIER_2, MODIFIER_1); MODIFIER_2, MODIFIER_1);
@ -658,7 +658,7 @@ void draw_vertical_bit(int x, int y)
X X X X X X X X
* * * * * * * *
*/ */
void draw_horizontal_bit(int x, int y) static void draw_horizontal_bit(int x, int y)
{ {
rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER+1, rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER+1,
MODIFIER_1, MODIFIER_2); MODIFIER_1, MODIFIER_2);
@ -670,7 +670,7 @@ void draw_horizontal_bit(int x, int y)
* X X X * X X X
* X X * * X X *
*/ */
void draw_n_to_e_bit(int x, int y) static void draw_n_to_e_bit(int x, int y)
{ {
rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER+2, rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER+2,
MODIFIER_2, MODIFIER_2); MODIFIER_2, MODIFIER_2);
@ -684,7 +684,7 @@ void draw_n_to_e_bit(int x, int y)
* X X X * X X X
* X X * * X X *
*/ */
void draw_w_to_s_bit(int x, int y) static void draw_w_to_s_bit(int x, int y)
{ {
draw_n_to_e_bit(x,y); draw_n_to_e_bit(x,y);
} }
@ -695,7 +695,7 @@ void draw_w_to_s_bit(int x, int y)
X X X * X X X *
* X X * * X X *
*/ */
void draw_n_to_w_bit(int x, int y) static void draw_n_to_w_bit(int x, int y)
{ {
rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER+1, rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER+1,
MODIFIER_2, MODIFIER_2); MODIFIER_2, MODIFIER_2);
@ -709,7 +709,7 @@ void draw_n_to_w_bit(int x, int y)
X X X * X X X *
* X X * * X X *
*/ */
void draw_e_to_s_bit(int x, int y) static void draw_e_to_s_bit(int x, int y)
{ {
draw_n_to_w_bit(x, y); draw_n_to_w_bit(x, y);
} }
@ -720,7 +720,7 @@ void draw_e_to_s_bit(int x, int y)
* * X X * * X X
* * * * * * * *
*/ */
void draw_s_to_e_bit(int x, int y) static void draw_s_to_e_bit(int x, int y)
{ {
rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER,
MODIFIER_2, MODIFIER_2); MODIFIER_2, MODIFIER_2);
@ -734,7 +734,7 @@ void draw_s_to_e_bit(int x, int y)
* * X X * * X X
* * * * * * * *
*/ */
void draw_w_to_n_bit(int x, int y) static void draw_w_to_n_bit(int x, int y)
{ {
draw_s_to_e_bit(x,y); draw_s_to_e_bit(x,y);
} }
@ -745,7 +745,7 @@ void draw_w_to_n_bit(int x, int y)
X X * * X X * *
* * * * * * * *
*/ */
void draw_e_to_n_bit(int x, int y) static void draw_e_to_n_bit(int x, int y)
{ {
rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER, rb->lcd_fillrect(CENTER_X+x*MULTIPLIER+1, CENTER_Y+y*MULTIPLIER,
MODIFIER_2, MODIFIER_2); MODIFIER_2, MODIFIER_2);
@ -759,21 +759,22 @@ void draw_e_to_n_bit(int x, int y)
X X * * X X * *
* * * * * * * *
*/ */
void draw_s_to_w_bit(int x, int y) static void draw_s_to_w_bit(int x, int y)
{ {
draw_e_to_n_bit(x, y); draw_e_to_n_bit(x, y);
} }
void draw_head_bit(int x, int y) static void draw_head_bit(int x, int y)
{ {
rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER, rb->lcd_fillrect(CENTER_X+x*MULTIPLIER, CENTER_Y+y*MULTIPLIER,
MODIFIER_1, MODIFIER_1); MODIFIER_1, MODIFIER_1);
} }
#if 0 /* unused */
/* /*
** Draws a wall/obsticals ** Draws a wall/obsticals
*/ */
void draw_boundary ( void ) static void draw_boundary ( void )
{ {
int x, y; int x, y;
@ -799,11 +800,12 @@ void draw_boundary ( void )
board[0][HEIGHT-1] = SOUTH_EAST; board[0][HEIGHT-1] = SOUTH_EAST;
board[WIDTH-1][HEIGHT-1] = EAST_NORTH; board[WIDTH-1][HEIGHT-1] = EAST_NORTH;
} }
#endif
/* /*
** Redraw the entire board ** Redraw the entire board
*/ */
void redraw (void) static void redraw (void)
{ {
int x,y; int x,y;
@ -860,7 +862,7 @@ void redraw (void)
** Draws the snake bit described by nCurrentBit at position x/y ** Draws the snake bit described by nCurrentBit at position x/y
** deciding whether it's a corner bit by examing the nPrevious bit ** deciding whether it's a corner bit by examing the nPrevious bit
*/ */
void draw_snake_bit(int currentbit, int previousbit, int x, int y) static void draw_snake_bit(int currentbit, int previousbit, int x, int y)
{ {
rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
draw_head_bit(x, y); draw_head_bit(x, y);
@ -942,7 +944,7 @@ void draw_snake_bit(int currentbit, int previousbit, int x, int y)
} }
} }
void redraw_snake(void) static void redraw_snake(void)
{ {
int x = tailx, y = taily; int x = tailx, y = taily;
int olddir, newdir = board[x][y]; int olddir, newdir = board[x][y];
@ -989,7 +991,7 @@ void redraw_snake(void)
/* /*
** Death 'sequence' and end game stuff. ** Death 'sequence' and end game stuff.
*/ */
void die (void) static void die (void)
{ {
int button; int button;
bool done=false; bool done=false;
@ -1045,7 +1047,7 @@ void die (void)
** sets of the death sequence. What we want is it to only return a true/false ** sets of the death sequence. What we want is it to only return a true/false
** depending on whether a collision occured. ** depending on whether a collision occured.
*/ */
void collision ( int x, int y ) static void collision ( int x, int y )
{ {
int bdeath=0; int bdeath=0;
@ -1096,7 +1098,7 @@ void collision ( int x, int y )
} }
} }
void move( void ) static void move( void )
{ {
int taildir; int taildir;
/*this actually sets the dir variable.*/ /*this actually sets the dir variable.*/
@ -1177,7 +1179,7 @@ void move( void )
applecountdown--; applecountdown--;
} }
void frame (void) static void frame (void)
{ {
int olddir, noldx, noldy, temp; int olddir, noldx, noldy, temp;
noldx = headx; noldx = headx;
@ -1235,7 +1237,7 @@ void frame (void)
rb->lcd_update(); rb->lcd_update();
} }
void game_pause (void) static void game_pause (void)
{ {
int button; int button;
@ -1276,7 +1278,7 @@ void game_pause (void)
} }
} }
void game (void) static void game (void)
{ {
int button; int button;
@ -1365,7 +1367,7 @@ void game (void)
} }
void select_maze(void) static void select_maze(void)
{ {
int button; int button;
@ -1440,7 +1442,7 @@ void select_maze(void)
} }
void game_init(void) static void game_init(void)
{ {
int selection = 0; int selection = 0;

View file

@ -802,7 +802,7 @@ void solitaire_init(void);
enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB }; enum { MENU_RESUME, MENU_SAVE_AND_QUIT, MENU_QUIT, MENU_USB };
static bool _ingame; static bool _ingame;
int solitaire_menu_cb(int action, const struct menu_item_ex *this_item) static int solitaire_menu_cb(int action, const struct menu_item_ex *this_item)
{ {
int i = (intptr_t)this_item; int i = (intptr_t)this_item;
if( action == ACTION_REQUEST_MENUITEM ) if( action == ACTION_REQUEST_MENUITEM )
@ -813,7 +813,7 @@ int solitaire_menu_cb(int action, const struct menu_item_ex *this_item)
return action; return action;
} }
int solitaire_menu(bool in_game) static int solitaire_menu(bool in_game)
{ {
int selected = 0; int selected = 0;
int result = -1; int result = -1;
@ -907,7 +907,7 @@ int stacks[SUITS];
* Card handling routines * Card handling routines
*/ */
int next_random_card( card_t *deck ) static int next_random_card( card_t *deck )
{ {
int i,r; int i,r;
@ -1012,7 +1012,7 @@ void solitaire_init( void )
} }
/* find the column number in which 'card' can be found */ /* find the column number in which 'card' can be found */
int find_card_col( int card ) static int find_card_col( int card )
{ {
int i; int i;
int c; int c;
@ -1044,7 +1044,7 @@ int find_card_col( int card )
/* find the card preceding 'card' */ /* find the card preceding 'card' */
/* if it doesn't exist, return NOT_A_CARD */ /* if it doesn't exist, return NOT_A_CARD */
int find_prev_card( int card ){ static int find_prev_card( int card ){
int i; int i;
for( i=0; i < NUM_CARDS; i++ ) for( i=0; i < NUM_CARDS; i++ )
@ -1056,7 +1056,7 @@ int find_prev_card( int card ){
} }
/* find the last card of a given column */ /* find the last card of a given column */
int find_last_card( int col ) static int find_last_card( int col )
{ {
int c; int c;
@ -1085,7 +1085,7 @@ int find_last_card( int col )
enum move { MOVE_OK, MOVE_NOT_OK }; enum move { MOVE_OK, MOVE_NOT_OK };
enum move move_card( int dest_col, int src_card ) static enum move move_card( int dest_col, int src_card )
{ {
/* the column on which to take src_card */ /* the column on which to take src_card */
int src_col; int src_col;
@ -1238,7 +1238,7 @@ enum { SOLITAIRE_WIN, SOLITAIRE_SAVE_AND_QUIT, SOLITAIRE_QUIT, SOLITAIRE_USB };
#define BC_MYSPEED (6*BC_ACCEL) #define BC_MYSPEED (6*BC_ACCEL)
#define BC_MXSPEED (6*LCD_HEIGHT/128) #define BC_MXSPEED (6*LCD_HEIGHT/128)
int bouncing_cards( void ) static int bouncing_cards( void )
{ {
int i, j, x, vx, y, fp_y, fp_vy, button; int i, j, x, vx, y, fp_y, fp_vy, button;
@ -1299,7 +1299,7 @@ int bouncing_cards( void )
/** /**
* Game save/load routines * Game save/load routines
*/ */
void get_save_filename( char *buf ) static void get_save_filename( char *buf )
{ {
#ifdef APPLICATION #ifdef APPLICATION
rb->snprintf(buf, sizeof(buf), PLUGIN_DATA_DIR "/sol.save"); rb->snprintf(buf, sizeof(buf), PLUGIN_DATA_DIR "/sol.save");
@ -1312,14 +1312,14 @@ void get_save_filename( char *buf )
#endif #endif
} }
int open_save_file( int flags ) static int open_save_file( int flags )
{ {
char buf[MAX_PATH]; char buf[MAX_PATH];
get_save_filename( buf ); get_save_filename( buf );
return rb->open( buf, flags, 0666); return rb->open( buf, flags, 0666);
} }
void delete_save_file( void ) static void delete_save_file( void )
{ {
char buf[MAX_PATH]; char buf[MAX_PATH];
get_save_filename( buf ); get_save_filename( buf );
@ -1329,7 +1329,7 @@ void delete_save_file( void )
#ifdef write #ifdef write
# undef write # undef write
#endif #endif
int save_write( int fd, const void *buf, size_t count, int *checksum ) static int save_write( int fd, const void *buf, size_t count, int *checksum )
{ {
size_t i; size_t i;
if( rb->write( fd, buf, count ) < (ssize_t)count ) if( rb->write( fd, buf, count ) < (ssize_t)count )
@ -1342,7 +1342,7 @@ int save_write( int fd, const void *buf, size_t count, int *checksum )
#ifdef read #ifdef read
# undef read # undef read
#endif #endif
int save_read( int fd, void *buf, size_t count, int *checksum ) static int save_read( int fd, void *buf, size_t count, int *checksum )
{ {
size_t i; size_t i;
if( rb->read( fd, buf, count ) < (ssize_t)count ) if( rb->read( fd, buf, count ) < (ssize_t)count )
@ -1352,7 +1352,7 @@ int save_read( int fd, void *buf, size_t count, int *checksum )
return 0; return 0;
} }
int save_game( void ) static int save_game( void )
{ {
int fd = open_save_file( O_CREAT|O_WRONLY|O_TRUNC ); int fd = open_save_file( O_CREAT|O_WRONLY|O_TRUNC );
int checksum = 42; int checksum = 42;
@ -1378,7 +1378,7 @@ int save_game( void )
return 0; return 0;
} }
int load_game( void ) static int load_game( void )
{ {
int checksum, retval; int checksum, retval;
@ -1422,7 +1422,7 @@ int load_game( void )
* game will resume. * game will resume.
*/ */
int solitaire( int skipmenu ) static int solitaire( int skipmenu )
{ {
int i,j; int i,j;

View file

@ -81,7 +81,7 @@ static void sort_buffer(void)
rb->qsort(pointers, num_entries, sizeof(char *), compare); rb->qsort(pointers, num_entries, sizeof(char *), compare);
} }
int read_buffer(int offset) static int read_buffer(int offset)
{ {
int fd; int fd;
char *buf_ptr; char *buf_ptr;

View file

@ -115,12 +115,12 @@ static bool cancel;
#endif #endif
/* we don't have yet a filetype attribute for image files */ /* we don't have yet a filetype attribute for image files */
const char *image_exts[] = {"bmp","jpg","jpe","jpeg","png","ppm"}; static const char *image_exts[] = {"bmp","jpg","jpe","jpeg","png","ppm"};
/* neither for video ones */ /* neither for video ones */
const char *video_exts[] = {"mpg","mpeg","mpv","m2v"}; static const char *video_exts[] = {"mpg","mpeg","mpv","m2v"};
void prn(const char *str, int y) static void prn(const char *str, int y)
{ {
rb->lcd_puts(0,y,str); rb->lcd_puts(0,y,str);
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
@ -128,7 +128,7 @@ void prn(const char *str, int y)
#endif #endif
} }
void update_screen(void) static void update_screen(void)
{ {
char buf[32]; char buf[32];
@ -165,7 +165,7 @@ void update_screen(void)
#endif #endif
} }
void traversedir(char* location, char* name) static void traversedir(char* location, char* name)
{ {
int button; int button;
struct dirent *entry; struct dirent *entry;

View file

@ -330,7 +330,7 @@ static void ticks_to_string(int ticks,int lap,int buflen, char * buf)
/* /*
* Load saved stopwatch state, if exists. * Load saved stopwatch state, if exists.
*/ */
void load_stopwatch(void) static void load_stopwatch(void)
{ {
int fd; int fd;
@ -370,7 +370,7 @@ void load_stopwatch(void)
/* /*
* Save stopwatch state. * Save stopwatch state.
*/ */
void save_stopwatch(void) static void save_stopwatch(void)
{ {
int fd; int fd;