diff options
author | Steve Bavin <pondlife@pondlife.me> | 2008-05-13 09:57:56 +0000 |
---|---|---|
committer | Steve Bavin <pondlife@pondlife.me> | 2008-05-13 09:57:56 +0000 |
commit | 652657781805d9cc10d744a49fb23eb17019fbbf (patch) | |
tree | 2d1a6ae597a17531f726b57fd9f8cbaa2a46a07f /apps/plugins/chessbox | |
parent | a94e40d5153ab698fa8a1b6b57d91fcb6acc905e (diff) | |
download | rockbox-652657781805d9cc10d744a49fb23eb17019fbbf.tar.gz rockbox-652657781805d9cc10d744a49fb23eb17019fbbf.zip |
Plugin parameters should be const.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17492 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/chessbox')
-rw-r--r-- | apps/plugins/chessbox/chessbox.c | 2 | ||||
-rw-r--r-- | apps/plugins/chessbox/chessbox_pgn.c | 16 | ||||
-rw-r--r-- | apps/plugins/chessbox/chessbox_pgn.h | 14 | ||||
-rw-r--r-- | apps/plugins/chessbox/gnuchess.c | 2 | ||||
-rw-r--r-- | apps/plugins/chessbox/gnuchess.h | 2 |
5 files changed, 18 insertions, 18 deletions
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) { | |||
902 | /***************************************************************************** | 902 | /***************************************************************************** |
903 | * plugin entry point. | 903 | * plugin entry point. |
904 | ******************************************************************************/ | 904 | ******************************************************************************/ |
905 | enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { | 905 | enum plugin_status plugin_start(const struct plugin_api* api, const void* parameter) { |
906 | 906 | ||
907 | /* plugin init */ | 907 | /* plugin init */ |
908 | 908 | ||
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 @@ | |||
24 | #define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log" | 24 | #define LOG_FILE PLUGIN_GAMES_DIR "/chessbox.log" |
25 | int loghandler; | 25 | int loghandler; |
26 | 26 | ||
27 | struct plugin_api* rb; | 27 | const struct plugin_api* rb; |
28 | 28 | ||
29 | short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}}; | 29 | short kn_offs[8][2] = {{2,1},{2,-1},{-2,1},{-2,-1},{1,2},{1,-2},{-1,2},{-1,-2}}; |
30 | short rk_offs[4][2] = {{1,0},{-1,0},{0,1},{0,-1}}; | 30 | 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){ | |||
556 | } | 556 | } |
557 | 557 | ||
558 | /* ---- api functions ---- */ | 558 | /* ---- api functions ---- */ |
559 | struct pgn_game_node* pgn_list_games(struct plugin_api* api,const char* filename){ | 559 | struct pgn_game_node* pgn_list_games(const struct plugin_api* api,const char* filename){ |
560 | int fhandler; | 560 | int fhandler; |
561 | char line_buffer[128]; | 561 | char line_buffer[128]; |
562 | struct pgn_game_node size_node, *first_game = NULL; | 562 | 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 | |||
614 | return first_game; | 614 | return first_game; |
615 | } | 615 | } |
616 | 616 | ||
617 | struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, | 617 | struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api, |
618 | struct pgn_game_node* first_game){ | 618 | struct pgn_game_node* first_game){ |
619 | int curr_selection = 0; | 619 | int curr_selection = 0; |
620 | int button; | 620 | int button; |
@@ -659,7 +659,7 @@ struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, | |||
659 | } | 659 | } |
660 | } | 660 | } |
661 | 661 | ||
662 | void pgn_parse_game(struct plugin_api* api, const char* filename, | 662 | void pgn_parse_game(const struct plugin_api* api, const char* filename, |
663 | struct pgn_game_node* selected_game){ | 663 | struct pgn_game_node* selected_game){ |
664 | struct pgn_ply_node size_ply, *first_ply = NULL; | 664 | struct pgn_ply_node size_ply, *first_ply = NULL; |
665 | struct pgn_ply_node *temp_ply = NULL, *curr_node = NULL; | 665 | 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, | |||
729 | rb->close(fhandler); | 729 | rb->close(fhandler); |
730 | } | 730 | } |
731 | 731 | ||
732 | struct pgn_game_node* pgn_init_game(struct plugin_api* api){ | 732 | struct pgn_game_node* pgn_init_game(const struct plugin_api* api){ |
733 | struct pgn_game_node game_size, *game; | 733 | struct pgn_game_node game_size, *game; |
734 | struct pgn_ply_node ply_size, *ply; | 734 | struct pgn_ply_node ply_size, *ply; |
735 | struct tm *current_time; | 735 | struct tm *current_time; |
@@ -767,7 +767,7 @@ struct pgn_game_node* pgn_init_game(struct plugin_api* api){ | |||
767 | return game; | 767 | return game; |
768 | } | 768 | } |
769 | 769 | ||
770 | void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game, | 770 | void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game, |
771 | unsigned short ply_player, char *move_buffer, bool is_mate){ | 771 | unsigned short ply_player, char *move_buffer, bool is_mate){ |
772 | struct pgn_ply_node ply_size, *ply, *temp; | 772 | struct pgn_ply_node ply_size, *ply, *temp; |
773 | 773 | ||
@@ -801,7 +801,7 @@ void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game, | |||
801 | temp->prev_node = ply; | 801 | temp->prev_node = ply; |
802 | } | 802 | } |
803 | 803 | ||
804 | void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game, | 804 | void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game, |
805 | bool is_mate){ | 805 | bool is_mate){ |
806 | 806 | ||
807 | rb = api; | 807 | rb = api; |
@@ -815,7 +815,7 @@ void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game, | |||
815 | } | 815 | } |
816 | } | 816 | } |
817 | 817 | ||
818 | void pgn_store_game(struct plugin_api* api, struct pgn_game_node* game){ | 818 | void pgn_store_game(const struct plugin_api* api, struct pgn_game_node* game){ |
819 | int fhandler; | 819 | int fhandler; |
820 | struct pgn_ply_node *ply; | 820 | struct pgn_ply_node *ply; |
821 | unsigned ply_count; | 821 | 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 { | |||
350 | * the user selects a game, that obviously saves processing | 350 | * the user selects a game, that obviously saves processing |
351 | * and speeds up response when the user selects the file | 351 | * and speeds up response when the user selects the file |
352 | */ | 352 | */ |
353 | struct pgn_game_node* pgn_list_games(struct plugin_api* api, | 353 | struct pgn_game_node* pgn_list_games(const struct plugin_api* api, |
354 | const char* filename); | 354 | const char* filename); |
355 | 355 | ||
356 | /* Show the list of games found in a file and allow the user | 356 | /* Show the list of games found in a file and allow the user |
357 | * to select a game to be parsed and showed | 357 | * to select a game to be parsed and showed |
358 | */ | 358 | */ |
359 | struct pgn_game_node* pgn_show_game_list(struct plugin_api* api, | 359 | struct pgn_game_node* pgn_show_game_list(const struct plugin_api* api, |
360 | struct pgn_game_node* first_game); | 360 | struct pgn_game_node* first_game); |
361 | 361 | ||
362 | /* Parse the pgn string of a game and assign it to the move | 362 | /* Parse the pgn string of a game and assign it to the move |
363 | * list in the structure | 363 | * list in the structure |
364 | */ | 364 | */ |
365 | void pgn_parse_game(struct plugin_api* api, const char* filename, | 365 | void pgn_parse_game(const struct plugin_api* api, const char* filename, |
366 | struct pgn_game_node* selected_game); | 366 | struct pgn_game_node* selected_game); |
367 | 367 | ||
368 | /* Initialize a new game structure with default values and make | 368 | /* Initialize a new game structure with default values and make |
369 | * it ready to store the history of a newly played match | 369 | * it ready to store the history of a newly played match |
370 | */ | 370 | */ |
371 | struct pgn_game_node* pgn_init_game(struct plugin_api* api); | 371 | struct pgn_game_node* pgn_init_game(const struct plugin_api* api); |
372 | 372 | ||
373 | /* Add a new ply to the game structure based on the positions */ | 373 | /* Add a new ply to the game structure based on the positions */ |
374 | void pgn_append_ply(struct plugin_api* api, struct pgn_game_node* game, | 374 | void pgn_append_ply(const struct plugin_api* api, struct pgn_game_node* game, |
375 | unsigned short ply_player, char *move_buffer, bool is_mate); | 375 | unsigned short ply_player, char *move_buffer, bool is_mate); |
376 | 376 | ||
377 | /* Set the result of the game if it was reached during the opponent's ply | 377 | /* Set the result of the game if it was reached during the opponent's ply |
378 | */ | 378 | */ |
379 | void pgn_set_result(struct plugin_api* api, struct pgn_game_node* game, | 379 | void pgn_set_result(const struct plugin_api* api, struct pgn_game_node* game, |
380 | bool is_mate); | 380 | bool is_mate); |
381 | 381 | ||
382 | /* Store a complete game in the PGN history file | 382 | /* Store a complete game in the PGN history file |
383 | */ | 383 | */ |
384 | void pgn_store_game(struct plugin_api* api, struct pgn_game_node* game); | 384 | 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 @@ | |||
64 | #define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) | 64 | #define taxicab(a,b) (abs(column[a]-column[b]) + abs(row[a]-row[b])) |
65 | 65 | ||
66 | /* ---- RockBox datatypes and variables */ | 66 | /* ---- RockBox datatypes and variables */ |
67 | struct plugin_api* rb; | 67 | const struct plugin_api* rb; |
68 | 68 | ||
69 | /* ---- Chess datatypes and variables ---- */ | 69 | /* ---- Chess datatypes and variables ---- */ |
70 | struct leaf | 70 | 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; | |||
44 | extern struct GameRec GameList[240]; | 44 | extern struct GameRec GameList[240]; |
45 | 45 | ||
46 | /* ---- RockBox integration ---- */ | 46 | /* ---- RockBox integration ---- */ |
47 | extern struct plugin_api* rb; | 47 | extern const struct plugin_api* rb; |
48 | 48 | ||
49 | /* ---- The beginning of a GNUChess v2 APIfication ---- */ | 49 | /* ---- The beginning of a GNUChess v2 APIfication ---- */ |
50 | void SetTimeControl(void); | 50 | void SetTimeControl(void); |