Plugin parameters should be const.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17492 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Steve Bavin 2008-05-13 09:57:56 +00:00
parent a94e40d515
commit 6526577818
159 changed files with 363 additions and 371 deletions

View file

@ -600,7 +600,7 @@ static const struct plugin_api rockbox_api = {
#endif /* HAVE_BUTTON_LIGHT */ #endif /* HAVE_BUTTON_LIGHT */
}; };
int plugin_load(const char* plugin, void* parameter) int plugin_load(const char* plugin, const void* parameter)
{ {
int rc; int rc;
struct plugin_header *hdr; struct plugin_header *hdr;
@ -719,8 +719,7 @@ int plugin_load(const char* plugin, void* parameter)
invalidate_icache(); invalidate_icache();
rc = hdr->entry_point((struct plugin_api*) &rockbox_api, parameter); rc = hdr->entry_point(&rockbox_api, parameter);
/* explicitly casting the pointer here to avoid touching every plugin. */
button_clear_queue(); button_clear_queue();

View file

@ -120,12 +120,12 @@
#define PLUGIN_MAGIC 0x526F634B /* RocK */ #define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */ /* increase this every time the api struct changes */
#define PLUGIN_API_VERSION 111 #define PLUGIN_API_VERSION 112
/* update this to latest version if a change to the api struct breaks /* update this to latest version if a change to the api struct breaks
backwards compatibility (and please take the opportunity to sort in any backwards compatibility (and please take the opportunity to sort in any
new function which are "waiting" at the end of the function table) */ new function which are "waiting" at the end of the function table) */
#define PLUGIN_MIN_API_VERSION 108 #define PLUGIN_MIN_API_VERSION 112
/* plugin return codes */ /* plugin return codes */
enum plugin_status { enum plugin_status {
@ -754,7 +754,7 @@ struct plugin_header {
unsigned short api_version; unsigned short api_version;
unsigned char *load_addr; unsigned char *load_addr;
unsigned char *end_addr; unsigned char *end_addr;
enum plugin_status(*entry_point)(struct plugin_api*, void*); enum plugin_status(*entry_point)(const struct plugin_api*, const void*);
}; };
#ifdef PLUGIN #ifdef PLUGIN
@ -792,7 +792,7 @@ extern unsigned char plugin_end_addr[];
#endif /* PLUGIN_USE_IRAM */ #endif /* PLUGIN_USE_IRAM */
#endif /* PLUGIN */ #endif /* PLUGIN */
int plugin_load(const char* plugin, void* parameter); int plugin_load(const char* plugin, const void* parameter);
void* plugin_get_buffer(size_t *buffer_size); void* plugin_get_buffer(size_t *buffer_size);
void* plugin_get_audio_buffer(size_t *buffer_size); void* plugin_get_audio_buffer(size_t *buffer_size);
#ifdef PLUGIN_USE_IRAM #ifdef PLUGIN_USE_IRAM
@ -806,7 +806,7 @@ void plugin_iram_init(char *iramstart, char *iramcopy, size_t iram_size,
void plugin_tsr(bool (*exit_callback)(bool reenter)); void plugin_tsr(bool (*exit_callback)(bool reenter));
/* defined by the plugin */ /* defined by the plugin */
enum plugin_status plugin_start(struct plugin_api* rockbox, void* parameter) enum plugin_status plugin_start(const struct plugin_api* rockbox, const void* parameter)
NO_PROF_ATTR; NO_PROF_ATTR;
/* Use this macro in plugins where gcc tries to optimize by calling /* Use this macro in plugins where gcc tries to optimize by calling

View file

@ -133,8 +133,8 @@ void sound_neutral(void); /* set to everything flat and 0 dB volume */
void sound_normal(void); /* return to user settings */ void sound_normal(void); /* return to user settings */
void thread(void); /* the thread running it all */ void thread(void); /* the thread running it all */
int main(void* parameter); /* main loop */ int main(const void* parameter); /* main loop */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter); /* entry */ enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter); /* entry */
/****************** data types ******************/ /****************** data types ******************/
@ -207,7 +207,7 @@ struct
struct thread_entry *thread; /* worker thread id */ struct thread_entry *thread; /* worker thread id */
} gTread; } gTread;
static struct plugin_api* rb; /* here is the global API struct pointer */ static const struct plugin_api* rb; /* here is the global API struct pointer */
/****************** implementation ******************/ /****************** implementation ******************/
@ -1133,7 +1133,7 @@ bool exit_tsr(bool reenter)
/****************** main ******************/ /****************** main ******************/
int main(void* parameter) int main(const void* parameter)
{ {
(void)parameter; (void)parameter;
#ifdef DEBUG #ifdef DEBUG
@ -1189,7 +1189,7 @@ int main(void* parameter)
/***************** Plugin Entry Point *****************/ /***************** Plugin Entry Point *****************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
rb = api; /* copy to global api pointer */ rb = api; /* copy to global api pointer */

View file

@ -169,14 +169,14 @@ PLUGIN_HEADER
#endif #endif
/****************************** Plugin Entry Point ****************************/ /****************************** Plugin Entry Point ****************************/
static struct plugin_api* rb; static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb); MEM_FUNCTION_WRAPPERS(rb);
int main(void); int main(void);
bool exit_tsr(bool); bool exit_tsr(bool);
void thread(void); void thread(void);
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;
rb = api; rb = api;

View file

@ -178,7 +178,7 @@ const unsigned char * drumNames[]={
long gmbuf[BUF_SIZE*NBUF]; long gmbuf[BUF_SIZE*NBUF];
int quit=0; int quit=0;
struct plugin_api * rb; const struct plugin_api * rb;
#define STATE_STOPPED 0 #define STATE_STOPPED 0
@ -232,7 +232,7 @@ int editState=EDITSTATE_PATTERN;
int playState=STATE_STOPPED, stepFlag=0; int playState=STATE_STOPPED, stepFlag=0;
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int retval = 0; int retval = 0;

View file

@ -313,7 +313,7 @@ extern const fb_data card_back[];
#define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]] #define NEXT_CARD bj->player_cards[done][bj->num_player_cards[done]]
/* global rockbox api */ /* global rockbox api */
static struct plugin_api* rb; static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb); MEM_FUNCTION_WRAPPERS(rb);
@ -1529,7 +1529,8 @@ static int blackjack(struct game_context* bj) {
/***************************************************************************** /*****************************************************************************
* plugin entry point. * plugin entry point.
******************************************************************************/ ******************************************************************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{
struct game_context bj; struct game_context bj;
bool exit = false; bool exit = false;
unsigned int position; unsigned int position;

View file

@ -167,7 +167,7 @@ PLUGIN_HEADER
#endif #endif
#endif #endif
static struct plugin_api* rb; static const struct plugin_api* rb;
#define LETTER_WIDTH 11 #define LETTER_WIDTH 11
#define LETTER_HEIGHT 16 #define LETTER_HEIGHT 16
@ -573,7 +573,7 @@ static int loopit(void)
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int w, h; int w, h;
char *off = "[Off] to stop"; char *off = "[Off] to stop";

View file

@ -195,7 +195,7 @@ PLUGIN_HEADER
#endif #endif
static struct plugin_api* rb; static const struct plugin_api* rb;
enum menu_items { enum menu_items {
BM_START, BM_START,
@ -2015,7 +2015,7 @@ int game_loop(void)
} }
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;
rb = api; rb = api;

View file

@ -192,7 +192,7 @@ PLUGIN_HEADER
#define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10) #define MIN_DISTANCE ((BUBBLE_WIDTH*8)/10)*((BUBBLE_HEIGHT*8)/10)
/* global rockbox api */ /* global rockbox api */
static struct plugin_api* rb; static const struct plugin_api* rb;
/* levels */ /* levels */
char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = { char level[NUM_LEVELS][BB_LEVEL_HEIGHT][BB_WIDTH] = {
@ -2585,7 +2585,7 @@ static int bubbles(struct game_context* bb) {
/***************************************************************************** /*****************************************************************************
* plugin entry point. * plugin entry point.
******************************************************************************/ ******************************************************************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
struct game_context bb; struct game_context bb;
bool exit = false; bool exit = false;
int position; int position;

View file

@ -290,7 +290,7 @@ PLUGIN_HEADER
#endif #endif
#endif #endif
static struct plugin_api* rb; static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb); MEM_FUNCTION_WRAPPERS(rb);
enum { enum {
@ -1536,7 +1536,7 @@ void sciButtonsProcess(void){
/* ----------------------------------------------------------------------- /* -----------------------------------------------------------------------
Main(); Main();
----------------------------------------------------------------------- */ ----------------------------------------------------------------------- */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;
rb = api; rb = api;

View file

@ -25,7 +25,7 @@
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
static bool leap_year; static bool leap_year;
static int days_in_month[2][13] = { static int days_in_month[2][13] = {
@ -659,7 +659,7 @@ static void prev_day(struct shown *shown, int step)
draw_calendar(shown); draw_calendar(shown);
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
struct today today; struct today today;
struct shown shown; struct shown shown;

View file

@ -27,7 +27,7 @@
PLUGIN_HEADER PLUGIN_HEADER
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox"); return run_overlay(api, parameter, PLUGIN_GAMES_DIR "/chessbox.ovl", "ChessBox");
} }

View file

@ -902,7 +902,7 @@ void cb_play_game(void) {
/***************************************************************************** /*****************************************************************************
* plugin entry point. * plugin entry point.
******************************************************************************/ ******************************************************************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
/* plugin init */ /* plugin init */

View file

@ -24,7 +24,7 @@
#define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log" #define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log"
int loghandler; int loghandler;
struct plugin_api* rb; const struct plugin_api* rb;
short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}}; short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}};
short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}}; short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
@ -556,7 +556,7 @@ void write_pgn_token(int fhandler, char *buffer, size_t *line_length){
} }
/* ---- api functions ---- */ /* ---- api functions ---- */
struct pgn_game_node* pgn_list_games(struct plugin_api* api,const char* filename){ struct pgn_game_node* pgn_list_games(const struct plugin_api* api,const char* filename){
int fhandler; int fhandler;
char line_buffer[128]; char line_buffer[128];
struct pgn_game_node size_node, *first_game = NULL; struct pgn_game_node size_node, *first_game = NULL;
@ -614,7 +614,7 @@ struct pgn_game_node* pgn_list_games(struct plugin_api* api,const char* filename
return first_game; return first_game;
} }
struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api,
struct pgn_game_node* first_game){ struct pgn_game_node* first_game){
int curr_selection = 0; int curr_selection = 0;
int button; int button;
@ -659,7 +659,7 @@ struct pgn_game_node* pgn_show_game_list(struct plugin_api* api,
} }
} }
void pgn_parse_game(struct plugin_api* api, const char* filename, void pgn_parse_game(const struct plugin_api* api, const char* filename,
struct pgn_game_node* selected_game){ struct pgn_game_node* selected_game){
struct pgn_ply_node size_ply, *first_ply = NULL; struct pgn_ply_node size_ply, *first_ply = NULL;
struct pgn_ply_node *temp_ply = NULL, *curr_node = NULL; struct pgn_ply_node *temp_ply = NULL, *curr_node = NULL;
@ -729,7 +729,7 @@ void pgn_parse_game(struct plugin_api* api, const char* filename,
rb->close(fhandler); rb->close(fhandler);
} }
struct pgn_game_node* pgn_init_game(struct plugin_api* api){ struct pgn_game_node* pgn_init_game(const struct plugin_api* api){
struct pgn_game_node game_size, *game; struct pgn_game_node game_size, *game;
struct pgn_ply_node ply_size, *ply; struct pgn_ply_node ply_size, *ply;
struct tm *current_time; struct tm *current_time;
@ -767,7 +767,7 @@ struct pgn_game_node* pgn_init_game(struct plugin_api* api){
return game; return game;
} }
void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game, void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game,
unsigned short ply_player, char *move_buffer, bool is_mate){ unsigned short ply_player, char *move_buffer, bool is_mate){
struct pgn_ply_node ply_size, *ply, *temp; struct pgn_ply_node ply_size, *ply, *temp;
@ -801,7 +801,7 @@ void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game,
temp->prev_node = ply; temp->prev_node = ply;
} }
void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game, void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game,
bool is_mate){ bool is_mate){
rb = api; rb = api;
@ -815,7 +815,7 @@ void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game,
} }
} }
void pgn_store_game(struct plugin_api* api, struct pgn_game_node* game){ void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game){
int fhandler; int fhandler;
struct pgn_ply_node *ply; struct pgn_ply_node *ply;
unsigned ply_count; unsigned ply_count;

View file

@ -350,35 +350,35 @@ struct pgn_game_node {
* the user selects a game, that obviously saves processing * the user selects a game, that obviously saves processing
* and speeds up response when the user selects the file * and speeds up response when the user selects the file
*/ */
struct pgn_game_node* pgn_list_games(struct plugin_api* api, struct pgn_game_node* pgn_list_games(const struct plugin_api* api,
const char* filename); const char* filename);
/* Show the list of games found in a file and allow the user /* Show the list of games found in a file and allow the user
* to select a game to be parsed and showed * to select a game to be parsed and showed
*/ */
struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api,
struct pgn_game_node* first_game); struct pgn_game_node* first_game);
/* Parse the pgn string of a game and assign it to the move /* Parse the pgn string of a game and assign it to the move
* list in the structure * list in the structure
*/ */
void pgn_parse_game(struct plugin_api* api, const char* filename, void pgn_parse_game(const struct plugin_api* api, const char* filename,
struct pgn_game_node* selected_game); struct pgn_game_node* selected_game);
/* Initialize a new game structure with default values and make /* Initialize a new game structure with default values and make
* it ready to store the history of a newly played match * it ready to store the history of a newly played match
*/ */
struct pgn_game_node* pgn_init_game(struct plugin_api* api); struct pgn_game_node* pgn_init_game(const struct plugin_api* api);
/* Add a new ply to the game structure based on the positions */ /* Add a new ply to the game structure based on the positions */
void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game, void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game,
unsigned short ply_player, char *move_buffer, bool is_mate); unsigned short ply_player, char *move_buffer, bool is_mate);
/* Set the result of the game if it was reached during the opponent's ply /* Set the result of the game if it was reached during the opponent's ply
*/ */
void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game, void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game,
bool is_mate); bool is_mate);
/* Store a complete game in the PGN history file /* Store a complete game in the PGN history file
*/ */
void pgn_store_game(struct plugin_api* api, struct pgn_game_node* game); void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game);

View file

@ -64,7 +64,7 @@
#define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) #define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b]))
/* ---- RockBox datatypes and variables */ /* ---- RockBox datatypes and variables */
struct plugin_api* rb; const struct plugin_api* rb;
/* ---- Chess datatypes and variables ---- */ /* ---- Chess datatypes and variables ---- */
struct leaf struct leaf

View file

@ -44,7 +44,7 @@ extern struct TimeControlRec TimeControl;
extern struct GameRec GameList[240]; extern struct GameRec GameList[240];
/* ---- RockBox integration ---- */ /* ---- RockBox integration ---- */
extern struct plugin_api* rb; extern const struct plugin_api* rb;
/* ---- The beginning of a GNUChess v2 APIfication ---- */ /* ---- The beginning of a GNUChess v2 APIfication ---- */
void SetTimeControl(void); void SetTimeControl(void);

View file

@ -224,7 +224,7 @@ PLUGIN_HEADER
/* here is a global api struct pointer. while not strictly necessary, /* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls it's nice not to have to pass the api pointer in all function calls
in the plugin */ in the plugin */
static struct plugin_api* rb; static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb); MEM_FUNCTION_WRAPPERS(rb);
#define MAX_PLAYERS 10 #define MAX_PLAYERS 10
@ -257,7 +257,7 @@ static bool pause;
#define MAX_TIME 7200 #define MAX_TIME 7200
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int i; int i;
bool done; bool done;

View file

@ -24,7 +24,7 @@
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; /* here is a global api struct pointer */ static const struct plugin_api* rb; /* here is a global api struct pointer */
#define EXTERN static #define EXTERN static
#define STATIC static #define STATIC static
@ -1287,7 +1287,7 @@ static void chip8_interrupt (void)
starttimer = newtimer - runtime; starttimer = newtimer - runtime;
} }
static bool chip8_init(char* file) static bool chip8_init(const char* file)
{ {
int numread; int numread;
int fd; int fd;
@ -1307,14 +1307,16 @@ static bool chip8_init(char* file)
rb->close(fd); rb->close(fd);
/* is there a c8k file (chip8 keys) ? */ /* is there a c8k file (chip8 keys) ? */
char c8kname[MAX_PATH];
rb->strcpy(c8kname, file);
for(i=0; i<16; i++) { for(i=0; i<16; i++) {
chip8_virtual_keys[i] = 0; chip8_virtual_keys[i] = 0;
chip8_keymap[i] = i; chip8_keymap[i] = i;
} }
len = rb->strlen(file); len = rb->strlen(c8kname);
file[len-2] = '8'; c8kname[len-2] = '8';
file[len-1] = 'k'; c8kname[len-1] = 'k';
fd = rb->open(file, O_RDONLY); fd = rb->open(c8kname, O_RDONLY);
if (fd!=-1) { if (fd!=-1) {
rb->lcd_puts(0, 6, "File&Keymap OK."); rb->lcd_puts(0, 6, "File&Keymap OK.");
numread = rb->read(fd, chip8_keymap, 16); numread = rb->read(fd, chip8_keymap, 16);
@ -1340,7 +1342,7 @@ static bool chip8_init(char* file)
return true; return true;
} }
bool chip8_run(char* file) bool chip8_run(const char* file)
{ {
int ok; int ok;
@ -1406,9 +1408,9 @@ bool chip8_run(char* file)
/***************** Plugin Entry Point *****************/ /***************** Plugin Entry Point *****************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
char* filename; const char* filename;
rb = api; /* copy to global api pointer */ rb = api; /* copy to global api pointer */

View file

@ -125,7 +125,7 @@ Still To do:
#endif #endif
#endif #endif
static struct plugin_api* rb; static const struct plugin_api* rb;
#define NUMBER_OF_BLOCKS 8 #define NUMBER_OF_BLOCKS 8
#define NUMBER_OF_PARTICLES 3 #define NUMBER_OF_PARTICLES 3
@ -979,7 +979,7 @@ void chopper_load(bool newgame)
} }
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;
rb = api; rb = api;

View file

@ -54,7 +54,7 @@ const struct button_mapping* plugin_contexts[]={
#define ACTION_SKIN_PREV PLA_DEC #define ACTION_SKIN_PREV PLA_DEC
#define ACTION_SKIN_PREV_REPEAT PLA_DEC_REPEAT #define ACTION_SKIN_PREV_REPEAT PLA_DEC_REPEAT
extern struct plugin_api* rb; extern const struct plugin_api* rb;
/************************** /**************************
* Cleanup on plugin return * Cleanup on plugin return
@ -109,7 +109,7 @@ void format_date(char* buffer, struct time* time, enum date_format format){
/********************************************************************** /**********************************************************************
* Plugin starts here * Plugin starts here
**********************************************************************/ **********************************************************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter){
int button; int button;
int last_second = -1; int last_second = -1;
bool redraw=true; bool redraw=true;

View file

@ -20,7 +20,7 @@
#ifndef _CLOCK_ #ifndef _CLOCK_
#define _CLOCK_ #define _CLOCK_
#include "clock_settings.h" #include "clock_settings.h"
extern struct plugin_api* rb; extern const struct plugin_api* rb;
struct time{ struct time{
int year, day, month; int year, day, month;

View file

@ -21,7 +21,7 @@
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
const char* const credits[] = { const char* const credits[] = {
#include "credits.raw" /* generated list of names from docs/CREDITS */ #include "credits.raw" /* generated list of names from docs/CREDITS */
@ -367,7 +367,7 @@ void roll_credits(void)
#endif #endif
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;
rb = api; rb = api;

View file

@ -425,7 +425,7 @@ static long matrice[3][3];
static const int nb_points = 8; static const int nb_points = 8;
static long z_off = 600; static long z_off = 600;
static struct plugin_api* rb; static const struct plugin_api* rb;
static void cube_rotate(int xa, int ya, int za) static void cube_rotate(int xa, int ya, int za)
{ {
@ -580,7 +580,7 @@ void cleanup(void *parameter)
#endif #endif
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
char buffer[30]; char buffer[30];
int t_disp = 0; int t_disp = 0;

View file

@ -65,7 +65,7 @@ struct line_color
/******************************* Globals ***********************************/ /******************************* Globals ***********************************/
static struct plugin_api* rb; /* global api struct pointer */ static const struct plugin_api* rb; /* global api struct pointer */
/* /*
* Compute a new random step to make the point bounce the borders of the screen * Compute a new random step to make the point bounce the borders of the screen
@ -424,7 +424,7 @@ int plugin_main(void)
/*************************** Plugin entry point ****************************/ /*************************** Plugin entry point ****************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int ret; int ret;

View file

@ -44,7 +44,7 @@ struct dices
#define PRINT_BUFFER_LENGTH MAX_DICES*4 #define PRINT_BUFFER_LENGTH MAX_DICES*4
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
static struct dices dice; static struct dices dice;
static int sides_index; static int sides_index;
@ -72,7 +72,7 @@ void dice_print(struct dices* dice, struct screen* display);
bool dice_menu(struct dices* dice); bool dice_menu(struct dices* dice);
/* plugin entry point */ /* plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
(void)parameter; (void)parameter;
rb = api; rb = api;
int i, action; int i, action;

View file

@ -22,7 +22,7 @@
PLUGIN_HEADER PLUGIN_HEADER
/* save the plugin api pointer. */ /* save the plugin api pointer. */
static struct plugin_api* rb; static const struct plugin_api* rb;
/* screen info */ /* screen info */
static int display_columns, display_lines; static int display_columns, display_lines;
@ -138,7 +138,7 @@ long reverse (long N) {
#define DICT_DESC ROCKBOX_DIR "/rocks/apps/dict.desc" #define DICT_DESC ROCKBOX_DIR "/rocks/apps/dict.desc"
/* the main plugin function */ /* the main plugin function */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
char searchword[WORDLEN]; /* word to search for */ char searchword[WORDLEN]; /* word to search for */
char *description; /* pointer to description buffer */ char *description; /* pointer to description buffer */

View file

@ -19,7 +19,7 @@
#include "plugin.h" #include "plugin.h"
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
/* function return values */ /* function return values */
enum tidy_return enum tidy_return
@ -412,7 +412,7 @@ int tidy_lcd_menu(void)
} }
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
enum tidy_system system = TIDY_ALL; enum tidy_system system = TIDY_ALL;
enum tidy_return status; enum tidy_return status;

View file

@ -99,7 +99,7 @@ int my_close(int id)
return 0; return 0;
} }
#endif #endif
struct plugin_api* rb; const struct plugin_api* rb;
#define MAXARGVS 100 #define MAXARGVS 100
bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates bool noprintf=0; // Variable disables printf lcd updates to protect grayscale lib/direct lcd updates
@ -675,7 +675,7 @@ int doom_menu()
extern int systemvol; extern int systemvol;
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
PLUGIN_IRAM_INIT(api) PLUGIN_IRAM_INIT(api)

View file

@ -24,7 +24,7 @@
#include "autoconf.h" #include "autoconf.h"
#include "z_zone.h" #include "z_zone.h"
extern struct plugin_api* rb; extern const struct plugin_api* rb;
extern bool noprintf; extern bool noprintf;
extern bool doomexit; extern bool doomexit;

View file

@ -140,7 +140,7 @@ static unsigned char *abbrev_str[12] = {
static unsigned long heuro,hhome; /*Handles for the new patterns*/ static unsigned long heuro,hhome; /*Handles for the new patterns*/
static struct plugin_api* rb; static const struct plugin_api* rb;
static char *currency_str[12] = { static char *currency_str[12] = {
"France", "France",
@ -402,7 +402,7 @@ static void euro_exit(void *parameter)
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
bool end, pos; bool end, pos;
longlong_t e,h,old_e,old_h; longlong_t e,h,old_e,old_h;

View file

@ -41,7 +41,7 @@
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; /* global api struct pointer */ static const struct plugin_api* rb; /* global api struct pointer */
#ifndef HAVE_LCD_COLOR #ifndef HAVE_LCD_COLOR
GREY_INFO_STRUCT GREY_INFO_STRUCT
@ -344,7 +344,7 @@ int main(void)
/*************************** Plugin entry point ****************************/ /*************************** Plugin entry point ****************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int ret; int ret;

View file

@ -22,7 +22,7 @@
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
/*** /***
* FIREWORKS.C by ZAKK ROBERTS * FIREWORKS.C by ZAKK ROBERTS
@ -385,7 +385,7 @@ void fireworks_menu(void)
} }
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;

View file

@ -126,7 +126,7 @@ typedef struct
char name[32]; char name[32];
} tFlashInfo; } tFlashInfo;
static struct plugin_api* rb; /* here is a global api struct pointer */ static const struct plugin_api* rb; /* here is a global api struct pointer */
#define MASK_ADR 0xFC /* position of hardware mask value in Flash */ #define MASK_ADR 0xFC /* position of hardware mask value in Flash */
#define VERSION_ADR 0xFE /* position of firmware version value in Flash */ #define VERSION_ADR 0xFE /* position of firmware version value in Flash */
@ -1072,7 +1072,7 @@ void DoUserDialog(char* filename)
/***************** Plugin Entry Point *****************/ /***************** Plugin Entry Point *****************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int oldmode; int oldmode;

View file

@ -244,7 +244,7 @@ PLUGIN_HEADER
#endif #endif
#endif #endif
static struct plugin_api* rb; static const struct plugin_api* rb;
static int spots[20]; static int spots[20];
static int toggle[20]; static int toggle[20];
static int cursor_pos, moves; static int cursor_pos, moves;
@ -591,7 +591,7 @@ static bool flipit_loop(void)
} }
/* called function from outside */ /* called function from outside */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int i, rc; int i, rc;

View file

@ -102,7 +102,7 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/ /******************************* Globals ***********************************/
GREY_INFO_STRUCT GREY_INFO_STRUCT
static struct plugin_api* rb; /* global api struct pointer */ static const struct plugin_api* rb; /* global api struct pointer */
static char pbuf[32]; /* global printf buffer */ static char pbuf[32]; /* global printf buffer */
static unsigned char *gbuf; static unsigned char *gbuf;
static size_t gbuf_size = 0; static size_t gbuf_size = 0;
@ -361,7 +361,7 @@ int main(void)
/*************************** Plugin entry point ****************************/ /*************************** Plugin entry point ****************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
rb = api; /* copy to global api pointer */ rb = api; /* copy to global api pointer */
(void)parameter; (void)parameter;

View file

@ -27,10 +27,10 @@ PLUGIN_HEADER
/* here is a global api struct pointer. while not strictly necessary, /* here is a global api struct pointer. while not strictly necessary,
it's nice not to have to pass the api pointer in all function calls it's nice not to have to pass the api pointer in all function calls
in the plugin */ in the plugin */
static struct plugin_api* rb; static const struct plugin_api* rb;
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
/* if you don't use the parameter, you can do like /* if you don't use the parameter, you can do like
this to avoid the compiler warning about it */ this to avoid the compiler warning about it */

View file

@ -595,7 +595,7 @@ unsigned char fire_sprite[FIRE_HEIGHT] = {
#define CYCLETIME 40 #define CYCLETIME 40
static struct plugin_api* rb; static const struct plugin_api* rb;
/* Physical x is at PLAYFIELD_X + LIVES_X + x * ALIEN_SPEED /* Physical x is at PLAYFIELD_X + LIVES_X + x * ALIEN_SPEED
* Physical y is at y * ALIEN_HEIGHT * Physical y is at y * ALIEN_HEIGHT
@ -1785,7 +1785,7 @@ void game_loop(void)
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, UNUSED void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, UNUSED const void* parameter)
{ {
rb = api; rb = api;

View file

@ -54,7 +54,7 @@ struct flash_info
char name[32]; char name[32];
}; };
static struct plugin_api* rb; /* here is a global api struct pointer */ static const struct plugin_api* rb; /* here is a global api struct pointer */
#ifdef IRIVER_H100_SERIES #ifdef IRIVER_H100_SERIES
#define SEC_SIZE 4096 #define SEC_SIZE 4096
@ -802,7 +802,7 @@ void DoUserDialog(char* filename)
/***************** Plugin Entry Point *****************/ /***************** Plugin Entry Point *****************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int oldmode; int oldmode;

View file

@ -25,7 +25,7 @@
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
ssize_t buf_size; ssize_t buf_size;
static char *filename; static char *filename;
@ -130,7 +130,7 @@ static int write_file(void)
return 0; return 0;
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
char *buf; char *buf;
int rc; int rc;

View file

@ -69,7 +69,7 @@ const struct picture jackpot_pictures[]={
#define SLEEP_TIME (HZ/200) #define SLEEP_TIME (HZ/200)
#endif /* HAVE_LCD_CHARCELLS */ #endif /* HAVE_LCD_CHARCELLS */
static struct plugin_api* rb; static const struct plugin_api* rb;
struct jackpot struct jackpot
{ {
@ -290,7 +290,7 @@ void jackpot_play_turn(struct jackpot* game)
jackpot_print_turn_result(game, gain, rb->screens[d]); jackpot_print_turn_result(game, gain, rb->screens[d]);
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
rb = api; rb = api;
int action, i; int action, i;

View file

@ -339,7 +339,7 @@ struct jewels_menu {
}; };
/* global rockbox api */ /* global rockbox api */
static struct plugin_api* rb; static const struct plugin_api* rb;
/* external bitmaps */ /* external bitmaps */
extern const fb_data jewels[]; extern const fb_data jewels[];
@ -1898,7 +1898,7 @@ static int jewels_main(struct game_context* bj) {
/***************************************************************************** /*****************************************************************************
* plugin entry point. * plugin entry point.
******************************************************************************/ ******************************************************************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
struct game_context bj; struct game_context bj;
bool exit = false; bool exit = false;
int position; int position;

View file

@ -279,7 +279,7 @@ GREY_INFO_STRUCT
/******************************* Globals ***********************************/ /******************************* Globals ***********************************/
static struct plugin_api* rb; static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb); MEM_FUNCTION_WRAPPERS(rb);
/* for portability of below JPEG code */ /* for portability of below JPEG code */
@ -3318,7 +3318,7 @@ int load_and_show(char* filename)
/******************** Plugin entry point *********************/ /******************** Plugin entry point *********************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
rb = api; rb = api;

View file

@ -92,7 +92,7 @@ PLUGIN_HEADER
# endif # endif
#endif #endif
static struct plugin_api* rb; /* global api struct pointer */ static const struct plugin_api* rb; /* global api struct pointer */
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
/* RGB color sets */ /* RGB color sets */
@ -102,7 +102,7 @@ static int colorset[NUM_COLORSETS][3] = { { 255, 255, 255 } , /* white */
#endif /* HAVE_LCD_COLOR */ #endif /* HAVE_LCD_COLOR */
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;
rb = api; rb = api;

View file

@ -30,7 +30,7 @@
/** /**
* Save to 24 bit bitmap. * Save to 24 bit bitmap.
*/ */
int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb ) int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb )
{ {
/* I'm not really sure about this one :) */ /* I'm not really sure about this one :) */
int line_width = bm->width*3+((bm->width*3)%4?4-((bm->width*3)%4):0); int line_width = bm->width*3+((bm->width*3)%4?4-((bm->width*3)%4):0);

View file

@ -26,7 +26,7 @@
/** /**
* Save bitmap to file * Save bitmap to file
*/ */
int save_bmp_file( char* filename, struct bitmap *bm, struct plugin_api* rb ); int save_bmp_file( char* filename, struct bitmap *bm, const struct plugin_api* rb );
#endif #endif
/** /**

View file

@ -25,7 +25,7 @@
/* /*
* Print a checkbox * Print a checkbox
*/ */
void checkbox(struct plugin_api *api, int x, int y, int width, int height, bool checked) void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked)
{ {
/* draw box */ /* draw box */
api->lcd_drawrect(x, y, width, height); api->lcd_drawrect(x, y, width, height);

View file

@ -24,6 +24,6 @@
/* /*
* Print a checkbox * Print a checkbox
*/ */
void checkbox(struct plugin_api *api, int x, int y, int width, int height, bool checked); void checkbox(const struct plugin_api *api, int x, int y, int width, int height, bool checked);
#endif #endif

View file

@ -19,9 +19,9 @@
#include "plugin.h" #include "plugin.h"
#include "configfile.h" #include "configfile.h"
static struct plugin_api *cfg_rb; static const struct plugin_api *cfg_rb;
void configfile_init(struct plugin_api* newrb) void configfile_init(const struct plugin_api* newrb)
{ {
cfg_rb = newrb; cfg_rb = newrb;
} }

View file

@ -37,7 +37,7 @@ struct configdata
NULL otherwise */ NULL otherwise */
}; };
void configfile_init(struct plugin_api* newrb); void configfile_init(const struct plugin_api* newrb);
/* configfile_save - Given configdata entries this function will /* configfile_save - Given configdata entries this function will
create a config file with these entries, destroying any create a config file with these entries, destroying any

View file

@ -50,7 +50,7 @@
#define GREY_ON_COP 0x0004 /* Run ISR on COP (PP targets) */ #define GREY_ON_COP 0x0004 /* Run ISR on COP (PP targets) */
/* Library initialisation and release */ /* Library initialisation and release */
bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
unsigned features, int width, int height, long *buf_taken); unsigned features, int width, int height, long *buf_taken);
void grey_release(void); void grey_release(void);
@ -169,7 +169,7 @@ struct _grey_info
int bheight; /* 4-pixel or 8-pixel units */ int bheight; /* 4-pixel or 8-pixel units */
#endif #endif
unsigned long flags; /* various flags, see #defines */ unsigned long flags; /* various flags, see #defines */
struct plugin_api *rb; /* plugin API pointer */ const struct plugin_api *rb; /* plugin API pointer */
unsigned char *values; /* start of greyscale pixel values */ unsigned char *values; /* start of greyscale pixel values */
unsigned char *phases; /* start of greyscale pixel phases */ unsigned char *phases; /* start of greyscale pixel phases */
unsigned char *buffer; /* start of chunky pixel buffer (for buffered mode) */ unsigned char *buffer; /* start of chunky pixel buffer (for buffered mode) */

View file

@ -478,7 +478,7 @@ static void fill_gvalues(void)
The function is authentic regarding memory usage on the simulator, even The function is authentic regarding memory usage on the simulator, even
if it doesn't use all of the allocated memory. */ if it doesn't use all of the allocated memory. */
bool grey_init(struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size, bool grey_init(const struct plugin_api* newrb, unsigned char *gbuf, long gbuf_size,
unsigned features, int width, int height, long *buf_taken) unsigned features, int width, int height, long *buf_taken)
{ {
int bdim, i; int bdim, i;

View file

@ -21,7 +21,7 @@
#include "helper.h" #include "helper.h"
/* Force the backlight on */ /* Force the backlight on */
void backlight_force_on(struct plugin_api* rb) void backlight_force_on(const struct plugin_api* rb)
{ {
if(!rb) if(!rb)
return; return;
@ -34,7 +34,7 @@ void backlight_force_on(struct plugin_api* rb)
} }
/* Reset backlight operation to its settings */ /* Reset backlight operation to its settings */
void backlight_use_settings(struct plugin_api* rb) void backlight_use_settings(const struct plugin_api* rb)
{ {
if (!rb) if (!rb)
return; return;
@ -47,7 +47,7 @@ void backlight_use_settings(struct plugin_api* rb)
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
/* Force the backlight on */ /* Force the backlight on */
void remote_backlight_force_on(struct plugin_api* rb) void remote_backlight_force_on(const struct plugin_api* rb)
{ {
if (!rb) if (!rb)
return; return;
@ -60,7 +60,7 @@ void remote_backlight_force_on(struct plugin_api* rb)
} }
/* Reset backlight operation to its settings */ /* Reset backlight operation to its settings */
void remote_backlight_use_settings(struct plugin_api* rb) void remote_backlight_use_settings(const struct plugin_api* rb)
{ {
if (!rb) if (!rb)
return; return;
@ -75,7 +75,7 @@ void remote_backlight_use_settings(struct plugin_api* rb)
#ifdef HAVE_BUTTON_LIGHT #ifdef HAVE_BUTTON_LIGHT
/* Force the buttonlight on */ /* Force the buttonlight on */
void buttonlight_force_on(struct plugin_api* rb) void buttonlight_force_on(const struct plugin_api* rb)
{ {
if (!rb) if (!rb)
return; return;
@ -84,7 +84,7 @@ void buttonlight_force_on(struct plugin_api* rb)
} }
/* Reset buttonlight operation to its settings */ /* Reset buttonlight operation to its settings */
void buttonlight_use_settings(struct plugin_api* rb) void buttonlight_use_settings(const struct plugin_api* rb)
{ {
if (!rb) if (!rb)
return; return;

View file

@ -24,14 +24,14 @@
/** /**
* Backlight on/off operations * Backlight on/off operations
*/ */
void backlight_force_on(struct plugin_api* rb); void backlight_force_on(const struct plugin_api* rb);
void backlight_use_settings(struct plugin_api* rb); void backlight_use_settings(const struct plugin_api* rb);
#ifdef HAVE_REMOTE_LCD #ifdef HAVE_REMOTE_LCD
void remote_backlight_force_on(struct plugin_api* rb); void remote_backlight_force_on(const struct plugin_api* rb);
void remote_backlight_use_settings(struct plugin_api* rb); void remote_backlight_use_settings(const struct plugin_api* rb);
#endif #endif
#ifdef HAVE_BUTTON_LIGHT #ifdef HAVE_BUTTON_LIGHT
void buttonlight_force_on(struct plugin_api* rb); void buttonlight_force_on(const struct plugin_api* rb);
void buttonlight_use_settings(struct plugin_api* rb); void buttonlight_use_settings(const struct plugin_api* rb);
#endif #endif
#endif #endif

View file

@ -19,9 +19,9 @@
#include "plugin.h" #include "plugin.h"
#include "highscore.h" #include "highscore.h"
static struct plugin_api *rb; static const struct plugin_api *rb;
void highscore_init(struct plugin_api* newrb) void highscore_init(const struct plugin_api* newrb)
{ {
rb = newrb; rb = newrb;
} }

View file

@ -26,7 +26,7 @@ struct highscore
int level; int level;
}; };
void highscore_init(struct plugin_api* newrb); void highscore_init(const struct plugin_api* newrb);
int highscore_save(char *filename, struct highscore *scores, int num_scores); int highscore_save(char *filename, struct highscore *scores, int num_scores);
int highscore_load(char *filename, struct highscore *scores, int num_scores); int highscore_load(char *filename, struct highscore *scores, int num_scores);
int highscore_update(int score, int level, struct highscore *scores, int num_scores); int highscore_update(int score, int level, struct highscore *scores, int num_scores);

View file

@ -27,7 +27,7 @@
#include "plugin.h" #include "plugin.h"
#include "oldmenuapi.h" #include "oldmenuapi.h"
struct plugin_api *rb = NULL; const struct plugin_api *rb = NULL;
struct menu { struct menu {
struct menu_item* items; struct menu_item* items;
@ -65,7 +65,7 @@ static int menu_find_free(void)
return(i); return(i);
} }
int menu_init(struct plugin_api *api, const struct menu_item* mitems, int menu_init(const struct plugin_api *api, const struct menu_item* mitems,
int count, int (*callback)(int, int), int count, int (*callback)(int, int),
const char *button1, const char *button2, const char *button3) const char *button1, const char *button2, const char *button3)
{ {

View file

@ -31,7 +31,7 @@ struct menu_item {
bool (*function) (void); /* return true if USB was connected */ bool (*function) (void); /* return true if USB was connected */
}; };
int menu_init(struct plugin_api *api, const struct menu_item* mitems, int menu_init(const struct plugin_api *api, const struct menu_item* mitems,
int count, int (*callback)(int, int), int count, int (*callback)(int, int),
const char *button1, const char *button2, const char *button3); const char *button1, const char *button2, const char *button3);
void menu_exit(int menu); void menu_exit(int menu);

View file

@ -44,7 +44,7 @@
The linker script for the overlay should use a base address towards the The linker script for the overlay should use a base address towards the
end of the audiobuffer, just low enough to make the overlay fit. */ end of the audiobuffer, just low enough to make the overlay fit. */
enum plugin_status run_overlay(struct plugin_api* rb, void* parameter, enum plugin_status run_overlay(const struct plugin_api* rb, const void* parameter,
unsigned char *filename, unsigned char *name) unsigned char *filename, unsigned char *name)
{ {
int fd, readsize; int fd, readsize;

View file

@ -26,7 +26,7 @@
#include "plugin.h" #include "plugin.h"
/* load and run a plugin linked as an overlay. */ /* load and run a plugin linked as an overlay. */
enum plugin_status run_overlay(struct plugin_api* api, void* parameter, enum plugin_status run_overlay(const struct plugin_api* api, const void* parameter,
unsigned char *filename, unsigned char *name); unsigned char *filename, unsigned char *name);
#endif /* !SIMULATOR */ #endif /* !SIMULATOR */

View file

@ -20,7 +20,7 @@
#include "plugin.h" #include "plugin.h"
#include "playback_control.h" #include "playback_control.h"
struct plugin_api* api = 0; const struct plugin_api* api = 0;
struct viewport *parentvp = NULL; struct viewport *parentvp = NULL;
static bool prevtrack(void) static bool prevtrack(void)
@ -105,14 +105,14 @@ MAKE_MENU(playback_control_menu, "Playback Control", NULL, Icon_NOICON,
&prevtrack_item, &playpause_item, &stop_item, &nexttrack_item, &prevtrack_item, &playpause_item, &stop_item, &nexttrack_item,
&volume_item, &shuffle_item, &repeat_mode_item); &volume_item, &shuffle_item, &repeat_mode_item);
void playback_control_init(struct plugin_api* newapi, void playback_control_init(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS]) struct viewport parent[NB_SCREENS])
{ {
api = newapi; api = newapi;
parentvp = parent; parentvp = parent;
} }
bool playback_control(struct plugin_api* newapi, bool playback_control(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS]) struct viewport parent[NB_SCREENS])
{ {
api = newapi; api = newapi;

View file

@ -25,11 +25,11 @@
So, make sure you use the same viewport for the rb->do_menu() call So, make sure you use the same viewport for the rb->do_menu() call
that you use in the playback_control_init() call that you use in the playback_control_init() call
*/ */
void playback_control_init(struct plugin_api* newapi, void playback_control_init(const struct plugin_api* newapi,
struct viewport parent[NB_SCREENS]); struct viewport parent[NB_SCREENS]);
/* Use this if your menu still uses the old menu api */ /* Use this if your menu still uses the old menu api */
bool playback_control(struct plugin_api* api, bool playback_control(const struct plugin_api* api,
struct viewport parent[NB_SCREENS]); struct viewport parent[NB_SCREENS]);
#endif /* __PLAYBACK_CONTROL_H__ */ #endif /* __PLAYBACK_CONTROL_H__ */

View file

@ -26,7 +26,7 @@
/*** globals ***/ /*** globals ***/
static struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */ static const struct plugin_api *pgfx_rb = NULL; /* global api struct pointer */
static int char_width; static int char_width;
static int char_height; static int char_height;
static int pixel_height; static int pixel_height;
@ -38,7 +38,7 @@ static int drawmode = DRMODE_SOLID;
/*** Special functions ***/ /*** Special functions ***/
/* library init */ /* library init */
bool pgfx_init(struct plugin_api* newrb, int cwidth, int cheight) bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight)
{ {
int i; int i;

View file

@ -26,7 +26,7 @@
#ifdef HAVE_LCD_CHARCELLS /* Player only :) */ #ifdef HAVE_LCD_CHARCELLS /* Player only :) */
bool pgfx_init(struct plugin_api* newrb, int cwidth, int cheight); bool pgfx_init(const struct plugin_api* newrb, int cwidth, int cheight);
void pgfx_release(void); void pgfx_release(void);
void pgfx_display(int cx, int cy); void pgfx_display(int cx, int cy);
void pgfx_display_block(int cx, int cy, int x, int y); void pgfx_display_block(int cx, int cy, int x, int y);

View file

@ -464,7 +464,7 @@ static const struct button_mapping* get_context_map(int context)
else return NULL; else return NULL;
} }
int pluginlib_getaction(struct plugin_api *api,int timeout, int pluginlib_getaction(const struct plugin_api *api,int timeout,
const struct button_mapping *plugin_contexts[], const struct button_mapping *plugin_contexts[],
int count) int count)
{ {

View file

@ -58,7 +58,7 @@ extern const struct button_mapping generic_left_right_fire[];
extern const struct button_mapping generic_actions[]; extern const struct button_mapping generic_actions[];
extern const struct button_mapping generic_increase_decrease[]; extern const struct button_mapping generic_increase_decrease[];
int pluginlib_getaction(struct plugin_api *api,int timeout, int pluginlib_getaction(const struct plugin_api *api,int timeout,
const struct button_mapping *plugin_contexts[], const struct button_mapping *plugin_contexts[],
int count); int count);

View file

@ -21,9 +21,9 @@
#include "plugin.h" #include "plugin.h"
static struct plugin_api *local_rb = NULL; /* global api struct pointer */ static const struct plugin_api *local_rb = NULL; /* global api struct pointer */
void profile_init(struct plugin_api* pa) void profile_init(const struct plugin_api* pa)
{ {
local_rb = pa; local_rb = pa;
} }

View file

@ -24,7 +24,7 @@
#include "plugin.h" #include "plugin.h"
void profile_init(struct plugin_api* pa); void profile_init(const struct plugin_api* pa);
void __cyg_profile_func_enter(void *this_fn, void *call_site) void __cyg_profile_func_enter(void *this_fn, void *call_site)
NO_PROF_ATTR ICODE_ATTR; NO_PROF_ATTR ICODE_ATTR;

View file

@ -26,7 +26,7 @@
#ifdef HAVE_LCD_BITMAP #ifdef HAVE_LCD_BITMAP
void xlcd_init(struct plugin_api* newrb); void xlcd_init(const struct plugin_api* newrb);
void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3); void xlcd_filltriangle(int x1, int y1, int x2, int y2, int x3, int y3);
void xlcd_filltriangle_screen(struct screen* display, void xlcd_filltriangle_screen(struct screen* display,
int x1, int y1, int x2, int y2, int x3, int y3); int x1, int y1, int x2, int y2, int x3, int y3);
@ -49,7 +49,7 @@ void xlcd_scroll_up(int count);
void xlcd_scroll_down(int count); void xlcd_scroll_down(int count);
/* internal stuff */ /* internal stuff */
extern struct plugin_api *_xlcd_rb; /* global api struct pointer */ extern const struct plugin_api *_xlcd_rb; /* global api struct pointer */
#endif /* HAVE_LCD_BITMAP */ #endif /* HAVE_LCD_BITMAP */
#endif /* __XLCD_H__ */ #endif /* __XLCD_H__ */

View file

@ -27,12 +27,12 @@
/*** globals ***/ /*** globals ***/
struct plugin_api *_xlcd_rb = NULL; /* global api struct pointer */ const struct plugin_api *_xlcd_rb = NULL; /* global api struct pointer */
/*** functions ***/ /*** functions ***/
/* library init */ /* library init */
void xlcd_init(struct plugin_api* newrb) void xlcd_init(const struct plugin_api* newrb)
{ {
_xlcd_rb = newrb; _xlcd_rb = newrb;
} }

View file

@ -176,12 +176,12 @@ const unsigned char rockbox16x7[] = {
#endif #endif
#endif #endif
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
int button; int button;
int timer = 10; int timer = 10;
int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2); int x = (DISPLAY_WIDTH / 2) - (LOGO_WIDTH / 2);
int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2); int y = (DISPLAY_HEIGHT / 2) - (LOGO_HEIGHT / 2);
struct plugin_api* rb = api; const struct plugin_api* rb = api;
int dx; int dx;
int dy; int dy;
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS

View file

@ -273,7 +273,7 @@ PLUGIN_HEADER
#define MYXLCD(fn) xlcd_ ## fn #define MYXLCD(fn) xlcd_ ## fn
#endif #endif
static struct plugin_api* rb; static const struct plugin_api* rb;
/* Fixed point format s5.26: sign, 5 bits integer part, 26 bits fractional part */ /* Fixed point format s5.26: sign, 5 bits integer part, 26 bits fractional part */
static long x_min; static long x_min;
@ -661,7 +661,7 @@ void cleanup(void *parameter)
#define REDRAW_PARTIAL 1 #define REDRAW_PARTIAL 1
#define REDRAW_FULL 2 #define REDRAW_FULL 2
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int button; int button;
int lastbutton = BUTTON_NONE; int lastbutton = BUTTON_NONE;

View file

@ -119,7 +119,7 @@ extern const fb_data matrix_normal[];
#define SLEEP HZ/50 #define SLEEP HZ/50
/* Codec api pointer */ /* Codec api pointer */
static struct plugin_api* rb; static const struct plugin_api* rb;
/* Each position is of this type */ /* Each position is of this type */
typedef struct cmatrix { typedef struct cmatrix {
@ -284,7 +284,7 @@ static void matrix_loop(void)
} }
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
int button; int button;
int sleep = SLEEP; int sleep = SLEEP;
bool frozen = false; bool frozen = false;

View file

@ -79,7 +79,7 @@ PLUGIN_HEADER
#define BORDER_W 0x00000080 #define BORDER_W 0x00000080
#define PATH 0x00000100 #define PATH 0x00000100
static struct plugin_api* rb; static const struct plugin_api* rb;
#ifdef __PLUGINLIB_ACTIONS_H__ #ifdef __PLUGINLIB_ACTIONS_H__
const struct button_mapping *plugin_contexts[] const struct button_mapping *plugin_contexts[]
@ -470,7 +470,7 @@ void maze_move_player_right(struct maze* maze)
/**********************************/ /**********************************/
/* this is the plugin entry point */ /* this is the plugin entry point */
/**********************************/ /**********************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int button, lastbutton = BUTTON_NONE; int button, lastbutton = BUTTON_NONE;
int quit = 0; int quit = 0;

View file

@ -26,7 +26,7 @@
/* Include standard plugin macro */ /* Include standard plugin macro */
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
/* The plugin actions of interest. */ /* The plugin actions of interest. */
const struct button_mapping *plugin_contexts[] const struct button_mapping *plugin_contexts[]
@ -916,7 +916,7 @@ static void main_menu(void)
/***************************************************************************** /*****************************************************************************
* Plugin entry point * Plugin entry point
******************************************************************************/ ******************************************************************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
enum plugin_status plugin_state; enum plugin_status plugin_state;

View file

@ -78,7 +78,7 @@ const struct button_mapping *plugin_contexts[]={
}; };
#define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) #define PLA_ARRAY_COUNT sizeof(plugin_contexts)/sizeof(plugin_contexts[0])
static struct plugin_api* rb; static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb); MEM_FUNCTION_WRAPPERS(rb);
@ -299,7 +299,7 @@ void tap(void)
reset_tap = false; reset_tap = false;
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter){ enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter){
int button; int button;
enum plugin_status status; enum plugin_status status;

View file

@ -26,7 +26,7 @@ int readID(int file);
struct MIDIfile midi_file IBSS_ATTR; struct MIDIfile midi_file IBSS_ATTR;
struct MIDIfile * loadFile(char * filename) struct MIDIfile * loadFile(const char * filename)
{ {
struct MIDIfile * mfload; struct MIDIfile * mfload;
int file = rb->open (filename, O_RDONLY); int file = rb->open (filename, O_RDONLY);

View file

@ -17,5 +17,5 @@
* *
****************************************************************************/ ****************************************************************************/
struct MIDIfile * loadFile(char * filename); struct MIDIfile * loadFile(const char * filename);

View file

@ -191,11 +191,11 @@ int32_t gmbuf[BUF_SIZE*NBUF];
static unsigned int samples_in_buf; static unsigned int samples_in_buf;
int quit=0; int quit=0;
struct plugin_api * rb; const struct plugin_api * rb;
static int midimain(void * filename); static int midimain(const void * filename);
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int retval = 0; int retval = 0;
@ -292,7 +292,7 @@ void get_more(unsigned char** start, size_t* size)
#endif #endif
} }
static int midimain(void * filename) static int midimain(const void * filename)
{ {
int notesUsed = 0; int notesUsed = 0;
int a=0; int a=0;

View file

@ -54,20 +54,14 @@ long bpm;
#include "midi/synth.c" #include "midi/synth.c"
int fd=-1; /* File descriptor where the output is written */ int fd=-1; /* File descriptor where the output is written */
extern long tempo; /* The sequencer keeps track of this */ extern long tempo; /* The sequencer keeps track of this */
const struct plugin_api * rb;
struct plugin_api * rb;
enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
{ {
(void)parameter; (void)parameter;
rb = api; rb = api;

View file

@ -221,7 +221,7 @@ enum minesweeper_status {
* it's nice not to have to pass the api pointer in all function calls * it's nice not to have to pass the api pointer in all function calls
* in the plugin * in the plugin
*/ */
static struct plugin_api *rb; static const struct plugin_api *rb;
extern const fb_data minesweeper_tiles[]; extern const fb_data minesweeper_tiles[];
@ -731,7 +731,7 @@ enum minesweeper_status minesweeper( void )
} }
/* plugin entry point */ /* plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
bool exit = false; bool exit = false;

View file

@ -141,7 +141,7 @@ PLUGIN_HEADER
#endif #endif
#endif #endif
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int button; int button;
int timer = 10; int timer = 10;
@ -149,7 +149,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
int y=0; int y=0;
int sx = 3; int sx = 3;
int sy = 3; int sy = 3;
struct plugin_api* rb = api; const struct plugin_api* rb = api;
(void)parameter; (void)parameter;
#ifdef HAVE_LCD_CHARCELLS #ifdef HAVE_LCD_CHARCELLS

View file

@ -16,7 +16,7 @@
PLUGIN_HEADER PLUGIN_HEADER
PLUGIN_IRAM_DECLARE PLUGIN_IRAM_DECLARE
static struct plugin_api* rb; static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb); MEM_FUNCTION_WRAPPERS(rb);
@ -806,7 +806,7 @@ static const int win_const[18][4] = {
{ 134, -146,-3352,-3072 } }; { 134, -146,-3352,-3072 } };
static char* wav_filename; static const char* wav_filename;
static int mp3file, wavfile, wav_size, frames; static int mp3file, wavfile, wav_size, frames;
static uint32 enc_buffer[16384]; /* storage for 65536 Bytes */ static uint32 enc_buffer[16384]; /* storage for 65536 Bytes */
static int enc_chunk = 0; /* encode chunk counter */ static int enc_chunk = 0; /* encode chunk counter */
@ -2278,7 +2278,7 @@ void compress(void)
int num_file; int num_file;
char mp3_name[80]; char mp3_name[80];
void get_mp3_filename(char *wav_name) void get_mp3_filename(const char *wav_name)
{ {
int slen = rb->strlen(wav_name); int slen = rb->strlen(wav_name);
rb->strncpy(mp3_name, wav_name, 79); rb->strncpy(mp3_name, wav_name, 79);
@ -2353,7 +2353,7 @@ void get_mp3_filename(char *wav_name)
#endif #endif
#endif #endif
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int rat, srat, nrat; /* for rate selection */ int rat, srat, nrat; /* for rate selection */
int cont = 1, butt; int cont = 1, butt;

View file

@ -25,7 +25,7 @@
#include "mpeg2dec_config.h" #include "mpeg2dec_config.h"
extern struct plugin_api* rb; extern const struct plugin_api* rb;
#include "mpeg2.h" #include "mpeg2.h"
#include "attributes.h" #include "attributes.h"

View file

@ -26,7 +26,7 @@
#include "mpeg2dec_config.h" #include "mpeg2dec_config.h"
extern struct plugin_api* rb; extern const struct plugin_api* rb;
#include "mpeg2.h" #include "mpeg2.h"
#include "attributes.h" #include "attributes.h"

View file

@ -257,7 +257,7 @@ PLUGIN_IRAM_DECLARE
#endif #endif
#endif #endif
struct plugin_api* rb; const struct plugin_api* rb;
CACHE_FUNCTION_WRAPPERS(rb); CACHE_FUNCTION_WRAPPERS(rb);
ALIGN_BUFFER_WRAPPER(rb); ALIGN_BUFFER_WRAPPER(rb);
@ -1544,7 +1544,7 @@ static void button_loop(void)
backlight_use_settings(rb); backlight_use_settings(rb);
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int status = PLUGIN_ERROR; /* assume failure */ int status = PLUGIN_ERROR; /* assume failure */
int result; int result;

View file

@ -22,7 +22,7 @@
#define MPEGPLAYER_H #define MPEGPLAYER_H
/* Global API pointer */ /* Global API pointer */
extern struct plugin_api* rb; extern const struct plugin_api* rb;
#ifdef HAVE_SCHEDULER_BOOSTCTRL #ifdef HAVE_SCHEDULER_BOOSTCTRL
#define trigger_cpu_boost rb->trigger_cpu_boost #define trigger_cpu_boost rb->trigger_cpu_boost

View file

@ -59,7 +59,7 @@ static unsigned char str[12]; /*String use to display the first line*/
static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/ static unsigned long hsmile,hcry,h1,h2; /*Handle for the new pattern*/
static bool end; /*If true game is finished*/ static bool end; /*If true game is finished*/
static struct plugin_api* rb; static const struct plugin_api* rb;
/*Display that the action it's impossible*/ /*Display that the action it's impossible*/
@ -138,7 +138,7 @@ static void nim_exit(void *parameter)
} }
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int y,z,button; int y,z,button;
int x,v,min; int x,v,min;

View file

@ -249,7 +249,7 @@ enum { OSC_HORIZ, OSC_VERT, MAX_OSC };
/* global variables */ /* global variables */
struct plugin_api* rb; /* global api struct pointer */ const struct plugin_api* rb; /* global api struct pointer */
/* settings */ /* settings */
struct osc_config { struct osc_config {
@ -650,7 +650,7 @@ void cleanup(void *parameter)
backlight_use_settings(rb); /* backlight control in lib/helper.c */ backlight_use_settings(rb); /* backlight control in lib/helper.c */
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int button, vol; int button, vol;
int lastbutton = BUTTON_NONE; int lastbutton = BUTTON_NONE;

View file

@ -27,7 +27,7 @@
#include <string.h> #include <string.h>
#include "plugin.h" #include "plugin.h"
extern struct plugin_api* rb; extern const struct plugin_api* rb;
#ifndef HAVE_LCD_COLOR #ifndef HAVE_LCD_COLOR
/* Convert RGB888 to 2-bit greyscale - logic taken from bmp2rb.c */ /* Convert RGB888 to 2-bit greyscale - logic taken from bmp2rb.c */

View file

@ -25,7 +25,7 @@
#include "plugin.h" #include "plugin.h"
#include "hardware.h" #include "hardware.h"
extern struct plugin_api* rb; extern const struct plugin_api* rb;
/* The main data for Pacman */ /* The main data for Pacman */

View file

@ -32,7 +32,7 @@
PLUGIN_HEADER PLUGIN_HEADER
PLUGIN_IRAM_DECLARE PLUGIN_IRAM_DECLARE
struct plugin_api* rb; const struct plugin_api* rb;
struct pacman_settings { struct pacman_settings {
int difficulty; int difficulty;
@ -361,7 +361,7 @@ static int gameProc( void )
return 0; return 0;
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;

View file

@ -25,7 +25,7 @@
#endif #endif
#include "pegbox_pieces.h" #include "pegbox_pieces.h"
static struct plugin_api* rb; static const struct plugin_api* rb;
PLUGIN_HEADER PLUGIN_HEADER
@ -1256,7 +1256,7 @@ static int pegbox(struct game_context* pb) {
/***************************************************************************** /*****************************************************************************
* plugin entry point. * plugin entry point.
******************************************************************************/ ******************************************************************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) {
bool exit = false; bool exit = false;
struct game_context pb; struct game_context pb;

View file

@ -34,7 +34,7 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/ /******************************* Globals ***********************************/
static struct plugin_api *rb; /* global api struct pointer */ static const struct plugin_api *rb; /* global api struct pointer */
const struct button_mapping *plugin_contexts[] const struct button_mapping *plugin_contexts[]
= {generic_actions, generic_directions}; = {generic_actions, generic_directions};
@ -2080,7 +2080,7 @@ int main(void)
/*************************** Plugin entry point ****************************/ /*************************** Plugin entry point ****************************/
enum plugin_status plugin_start(struct plugin_api *api, void *parameter) enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter)
{ {
int ret; int ret;

View file

@ -36,7 +36,7 @@ PLUGIN_HEADER
/******************************* Globals ***********************************/ /******************************* Globals ***********************************/
static struct plugin_api* rb; /* global api struct pointer */ static const struct plugin_api* rb; /* global api struct pointer */
static unsigned char wave_array[256]; /* Pre calculated wave array */ static unsigned char wave_array[256]; /* Pre calculated wave array */
#ifdef HAVE_LCD_COLOR #ifdef HAVE_LCD_COLOR
static fb_data colours[256]; /* Smooth transition of shades */ static fb_data colours[256]; /* Smooth transition of shades */
@ -343,7 +343,7 @@ int main(void)
/*************************** Plugin entry point ****************************/ /*************************** Plugin entry point ****************************/
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
int ret; int ret;

View file

@ -174,7 +174,7 @@ PLUGIN_HEADER
#endif #endif
#endif #endif
static struct plugin_api* rb; static const struct plugin_api* rb;
struct pong { struct pong {
int ballx; /* current X*RES position of the ball */ int ballx; /* current X*RES position of the ball */
@ -453,7 +453,7 @@ void showscore(struct pong *p)
} }
/* this is the plugin entry point */ /* this is the plugin entry point */
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
struct pong pong; struct pong pong;
int game = 1; int game = 1;

View file

@ -20,7 +20,7 @@
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
MEM_FUNCTION_WRAPPERS(rb); MEM_FUNCTION_WRAPPERS(rb);
@ -252,21 +252,23 @@ char * get_props(int selected_item, void* data, char *buffer, size_t buffer_len)
return buffer; return buffer;
} }
enum plugin_status plugin_start(struct plugin_api* api, void* file) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
rb = api; rb = api;
struct gui_synclist properties_lists; struct gui_synclist properties_lists;
int button; int button;
bool prev_show_statusbar; bool prev_show_statusbar;
bool quit = false; bool quit = false;
char file[MAX_PATH];
rb->strcpy(file, (const char *) parameter);
/* determine if it's a file or a directory */ /* determine if it's a file or a directory */
bool found = false; bool found = false;
DIR* dir; DIR* dir;
struct dirent* entry; struct dirent* entry;
char* ptr = rb->strrchr((char*)file, '/') + 1; char* ptr = rb->strrchr(file, '/') + 1;
int dirlen = (ptr - (char*)file); int dirlen = (ptr - file);
rb->strncpy(str_dirname, (char*)file, dirlen); rb->strncpy(str_dirname, file, dirlen);
str_dirname[dirlen] = 0; str_dirname[dirlen] = 0;
dir = rb->opendir(str_dirname); dir = rb->opendir(str_dirname);
@ -288,13 +290,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* file)
if(!found) if(!found)
{ {
/* weird: we couldn't find the entry. This Should Never Happen (TM) */ /* weird: we couldn't find the entry. This Should Never Happen (TM) */
rb->splash(0, "File/Dir not found: %s", (char*)file); rb->splash(0, "File/Dir not found: %s", file);
rb->action_userabort(TIMEOUT_BLOCK); rb->action_userabort(TIMEOUT_BLOCK);
return PLUGIN_OK; return PLUGIN_OK;
} }
/* get the info depending on its_a_dir */ /* get the info depending on its_a_dir */
if(!(its_a_dir ? dir_properties((char*)file):file_properties((char*)file))) if(!(its_a_dir ? dir_properties(file) : file_properties(file)))
{ {
/* something went wrong (to do: tell user what it was (nesting,...) */ /* something went wrong (to do: tell user what it was (nesting,...) */
rb->splash(0, "Failed to gather information"); rb->splash(0, "Failed to gather information");

View file

@ -21,7 +21,7 @@
PLUGIN_HEADER PLUGIN_HEADER
static struct plugin_api* rb; static const struct plugin_api* rb;
static bool abort; static bool abort;
static int fd; static int fd;
static int dirs_count; static int dirs_count;
@ -544,7 +544,7 @@ int main_menu(void)
return 0; return 0;
} }
enum plugin_status plugin_start(struct plugin_api* api, void* parameter) enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter)
{ {
(void)parameter; (void)parameter;

View file

@ -58,7 +58,7 @@ typedef struct _reversi_board_t {
*/ */
move_t history[BOARD_SIZE*BOARD_SIZE - INIT_STONES]; move_t history[BOARD_SIZE*BOARD_SIZE - INIT_STONES];
struct plugin_api *rb; const struct plugin_api *rb;
} reversi_board_t; } reversi_board_t;

View file

@ -52,7 +52,7 @@ PLUGIN_HEADER
/* The global api struct pointer. While not strictly necessary, /* The global api struct pointer. While not strictly necessary,
it's nice not to have to pass the api pointer in all function it's nice not to have to pass the api pointer in all function
calls in the plugin */ calls in the plugin */
static struct plugin_api* rb; static const struct plugin_api* rb;
/* Thickness of the grid lines */ /* Thickness of the grid lines */
#define LINE_THCK 1 #define LINE_THCK 1
@ -543,7 +543,7 @@ static void reversi_gui_move_cursor(int new_row, int new_col) {
/* plugin entry point */ /* plugin entry point */
enum plugin_status plugin_start(struct plugin_api *api, void *parameter) { enum plugin_status plugin_start(const struct plugin_api *api, const void *parameter) {
bool exit, draw_screen; bool exit, draw_screen;
int button; int button;
int lastbutton = BUTTON_NONE; int lastbutton = BUTTON_NONE;

Some files were not shown because too many files have changed in this diff Show more