From 652657781805d9cc10d744a49fb23eb17019fbbf Mon Sep 17 00:00:00 2001 From: Steve Bavin Date: Tue, 13 May 2008 09:57:56 +0000 Subject: Plugin parameters should be const. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17492 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/chessbox/chessbox.c | 2 +- apps/plugins/chessbox/chessbox_pgn.c | 16 ++++++++-------- apps/plugins/chessbox/chessbox_pgn.h | 14 +++++++------- apps/plugins/chessbox/gnuchess.c | 2 +- apps/plugins/chessbox/gnuchess.h | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) (limited to 'apps/plugins/chessbox') diff --git a/apps/plugins/chessbox/chessbox.c b/apps/plugins/chessbox/chessbox.c index f9e1020461..a90ddd68cb 100644 --- a/apps/plugins/chessbox/chessbox.c +++ b/apps/plugins/chessbox/chessbox.c @@ -902,7 +902,7 @@ void cb_play_game(void) { /***************************************************************************** * 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 */ diff --git a/apps/plugins/chessbox/chessbox_pgn.c b/apps/plugins/chessbox/chessbox_pgn.c index 94bda2eaaa..a2b05af255 100644 --- a/apps/plugins/chessbox/chessbox_pgn.c +++ b/apps/plugins/chessbox/chessbox_pgn.c @@ -24,7 +24,7 @@ #define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log" 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 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 ---- */ -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; char line_buffer[128]; 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; } -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){ int curr_selection = 0; 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_ply_node size_ply, *first_ply = 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); } -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_ply_node ply_size, *ply; struct tm *current_time; @@ -767,7 +767,7 @@ struct pgn_game_node* pgn_init_game(struct plugin_api* api){ 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){ 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; } -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){ 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; struct pgn_ply_node *ply; unsigned ply_count; diff --git a/apps/plugins/chessbox/chessbox_pgn.h b/apps/plugins/chessbox/chessbox_pgn.h index 672bacaf6e..a457619887 100644 --- a/apps/plugins/chessbox/chessbox_pgn.h +++ b/apps/plugins/chessbox/chessbox_pgn.h @@ -350,35 +350,35 @@ struct pgn_game_node { * the user selects a game, that obviously saves processing * 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); /* Show the list of games found in a file and allow the user * 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); /* Parse the pgn string of a game and assign it to the move * 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); /* Initialize a new game structure with default values and make * 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 */ -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); /* 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); /* 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); diff --git a/apps/plugins/chessbox/gnuchess.c b/apps/plugins/chessbox/gnuchess.c index 3574dd6fbe..51e200d0f2 100644 --- a/apps/plugins/chessbox/gnuchess.c +++ b/apps/plugins/chessbox/gnuchess.c @@ -64,7 +64,7 @@ #define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) /* ---- RockBox datatypes and variables */ -struct plugin_api* rb; +const struct plugin_api* rb; /* ---- Chess datatypes and variables ---- */ struct leaf diff --git a/apps/plugins/chessbox/gnuchess.h b/apps/plugins/chessbox/gnuchess.h index 6a4a6bdd4e..b80647a287 100644 --- a/apps/plugins/chessbox/gnuchess.h +++ b/apps/plugins/chessbox/gnuchess.h @@ -44,7 +44,7 @@ extern struct TimeControlRec TimeControl; extern struct GameRec GameList[240]; /* ---- RockBox integration ---- */ -extern struct plugin_api* rb; +extern const struct plugin_api* rb; /* ---- The beginning of a GNUChess v2 APIfication ---- */ void SetTimeControl(void); -- cgit v1.2.3