summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-13 14:01:41 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-13 14:01:41 +0000
commit0c458c043a2e95cfed15d143ff0053b44b6a425c (patch)
tree3f4cdfa76f06d593322c64b34cbdc9d889e02f6c
parentae9b319ec555fd9b33c5c37b68b5578442e9de9f (diff)
downloadrockbox-0c458c043a2e95cfed15d143ff0053b44b6a425c.tar.gz
rockbox-0c458c043a2e95cfed15d143ff0053b44b6a425c.zip
The plugin API now supports ctype macros like tolower() and friends
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4872 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/plugin.c9
-rw-r--r--apps/plugin.h12
-rw-r--r--apps/plugins/viewer.c9
-rw-r--r--firmware/include/ctype.h4
4 files changed, 17 insertions, 17 deletions
diff --git a/apps/plugin.c b/apps/plugin.c
index e9c538fd78..983e4991b9 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -21,6 +21,7 @@
21#include <stdio.h> 21#include <stdio.h>
22#include <atoi.h> 22#include <atoi.h>
23#include <timefuncs.h> 23#include <timefuncs.h>
24#include <ctype.h>
24#include "debug.h" 25#include "debug.h"
25#include "button.h" 26#include "button.h"
26#include "lcd.h" 27#include "lcd.h"
@@ -147,6 +148,9 @@ static struct plugin_api rockbox_api = {
147 strlen, 148 strlen,
148 memset, 149 memset,
149 memcpy, 150 memcpy,
151#ifndef SIMULATOR
152 _ctype_,
153#endif
150 154
151 /* sound */ 155 /* sound */
152#ifndef SIMULATOR 156#ifndef SIMULATOR
@@ -209,6 +213,7 @@ static struct plugin_api rockbox_api = {
209 mpeg_next_track, 213 mpeg_next_track,
210 playlist_amount, 214 playlist_amount,
211 mpeg_status, 215 mpeg_status,
216 mpeg_has_changed_track,
212#ifdef HAVE_LCD_BITMAP 217#ifdef HAVE_LCD_BITMAP
213 font_get, 218 font_get,
214#endif 219#endif
@@ -230,6 +235,7 @@ static struct plugin_api rockbox_api = {
230#endif 235#endif
231 battery_level, 236 battery_level,
232 set_time, 237 set_time,
238 reset_poweroff_timer,
233 239
234 backlight_on, 240 backlight_on,
235 backlight_off, 241 backlight_off,
@@ -237,9 +243,6 @@ static struct plugin_api rockbox_api = {
237#ifdef HAVE_LCD_CHARCELLS 243#ifdef HAVE_LCD_CHARCELLS
238 lcd_icon, 244 lcd_icon,
239#endif 245#endif
240
241 reset_poweroff_timer,
242 mpeg_has_changed_track,
243}; 246};
244 247
245int plugin_load(char* plugin, void* parameter) 248int plugin_load(char* plugin, void* parameter)
diff --git a/apps/plugin.h b/apps/plugin.h
index 5b3193c42b..d9b32055d6 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -60,12 +60,12 @@
60#endif 60#endif
61 61
62/* increase this every time the api struct changes */ 62/* increase this every time the api struct changes */
63#define PLUGIN_API_VERSION 18 63#define PLUGIN_API_VERSION 19
64 64
65/* update this to latest version if a change to the api struct breaks 65/* update this to latest version if a change to the api struct breaks
66 backwards compatibility (and please take the opportunity to sort in any 66 backwards compatibility (and please take the opportunity to sort in any
67 new function which are "waiting" at the end of the function table) */ 67 new function which are "waiting" at the end of the function table) */
68#define PLUGIN_MIN_API_VERSION 18 68#define PLUGIN_MIN_API_VERSION 19
69 69
70/* plugin return codes */ 70/* plugin return codes */
71enum plugin_status { 71enum plugin_status {
@@ -176,6 +176,9 @@ struct plugin_api {
176 size_t (*strlen)(const char *str); 176 size_t (*strlen)(const char *str);
177 void* (*memset)(void *dst, int c, size_t length); 177 void* (*memset)(void *dst, int c, size_t length);
178 void* (*memcpy)(void *out, const void *in, size_t n); 178 void* (*memcpy)(void *out, const void *in, size_t n);
179#ifndef SIMULATOR
180 char *_ctype_;
181#endif
179 182
180 /* sound */ 183 /* sound */
181#ifndef SIMULATOR 184#ifndef SIMULATOR
@@ -240,6 +243,7 @@ struct plugin_api {
240 struct mp3entry* (*mpeg_next_track)(void); 243 struct mp3entry* (*mpeg_next_track)(void);
241 int (*playlist_amount)(void); 244 int (*playlist_amount)(void);
242 int (*mpeg_status)(void); 245 int (*mpeg_status)(void);
246 bool (*mpeg_has_changed_track)(void);
243 247
244#ifdef HAVE_LCD_BITMAP 248#ifdef HAVE_LCD_BITMAP
245 struct font* (*font_get)(int font); 249 struct font* (*font_get)(int font);
@@ -267,6 +271,7 @@ struct plugin_api {
267#endif 271#endif
268 int (*battery_level)(void); 272 int (*battery_level)(void);
269 int (*set_time)(struct tm *tm); 273 int (*set_time)(struct tm *tm);
274 void (*reset_poweroff_timer)(void);
270 275
271 void (*backlight_on)(void); 276 void (*backlight_on)(void);
272 void (*backlight_off)(void); 277 void (*backlight_off)(void);
@@ -274,9 +279,6 @@ struct plugin_api {
274#ifdef HAVE_LCD_CHARCELLS 279#ifdef HAVE_LCD_CHARCELLS
275 void (*lcd_icon)(int icon, bool enable); 280 void (*lcd_icon)(int icon, bool enable);
276#endif 281#endif
277
278 void (*reset_poweroff_timer)(void);
279 bool (*mpeg_has_changed_track)(void);
280}; 282};
281 283
282/* defined by the plugin loader (plugin.c) */ 284/* defined by the plugin loader (plugin.c) */
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c
index d8d6b516bd..a593da28e7 100644
--- a/apps/plugins/viewer.c
+++ b/apps/plugins/viewer.c
@@ -18,17 +18,8 @@
18 * 18 *
19 ****************************************************************************/ 19 ****************************************************************************/
20#include "plugin.h" 20#include "plugin.h"
21
22#ifdef HAVE_LCD_BITMAP
23#include "recorder/widgets.h"
24#endif
25
26#include <ctype.h> 21#include <ctype.h>
27 22
28#ifndef SIMULATOR
29#include <ctype.c>
30#endif
31
32#if PLUGIN_API_VERSION < 3 23#if PLUGIN_API_VERSION < 3
33#error Scrollbar function requires PLUGIN_API_VERSION 3 at least 24#error Scrollbar function requires PLUGIN_API_VERSION 3 at least
34#endif 25#endif
diff --git a/firmware/include/ctype.h b/firmware/include/ctype.h
index b6d8a43492..c72a256e4b 100644
--- a/firmware/include/ctype.h
+++ b/firmware/include/ctype.h
@@ -36,7 +36,11 @@ int _EXFUN(_toupper, (int __c));
36#define _X 0100 36#define _X 0100
37#define _B 0200 37#define _B 0200
38 38
39#ifdef PLUGIN
40#define _ctype_ (rb->_ctype_)
41#else
39extern char _ctype_[]; 42extern char _ctype_[];
43#endif
40 44
41#ifndef __cplusplus 45#ifndef __cplusplus
42#define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L)) 46#define isalpha(c) ((_ctype_+1)[(unsigned)(c)]&(_U|_L))