Removed the sim_ prefix from the plugin api.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19704 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Björn Stenberg 2009-01-07 09:53:46 +00:00
parent f9329e4c92
commit a36cdf5b37
12 changed files with 37 additions and 69 deletions

View file

@ -55,6 +55,12 @@
#define LOGF_ENABLE
#include "logf.h"
#ifdef SIMULATOR
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX
#endif
#ifdef SIMULATOR
#if CONFIG_CODEC == SWCODEC
unsigned char codecbuf[CODEC_SIZE];

View file

@ -34,7 +34,6 @@
#include <stdbool.h>
#include <stdlib.h>
#include "config.h"
#include "kernel.h"
#include "system.h"
#include "metadata.h"
#include "audio.h"
@ -70,12 +69,6 @@
#endif
#ifdef SIMULATOR
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX(_x_) _x_
#endif
/* magic for normal codecs */
#define CODEC_MAGIC 0x52434F44 /* RCOD */
/* magic for encoder codecs */
@ -160,7 +153,7 @@ struct codec_api {
void (*configure)(int setting, intptr_t value);
/* kernel/ system */
void (*PREFIX(sleep))(int ticks);
void (*sleep)(int ticks);
void (*yield)(void);
#if NUM_CORES > 1
@ -227,10 +220,10 @@ struct codec_api {
size_t (*enc_unget_pcm_data)(size_t size);
/* file */
int (*PREFIX(open))(const char* pathname, int flags);
int (*open)(const char* pathname, int flags);
int (*close)(int fd);
ssize_t (*read)(int fd, void* buf, size_t count);
off_t (*PREFIX(lseek))(int fd, off_t offset, int whence);
off_t (*lseek)(int fd, off_t offset, int whence);
ssize_t (*write)(int fd, const void* buf, size_t count);
int (*round_value_to_list32)(unsigned long value,
const unsigned long list[],

View file

@ -21,7 +21,6 @@
#include "config.h"
#include "codecs.h"
#include "system.h"
#include <sys/types.h>
extern struct codec_api *ci;

View file

@ -51,6 +51,12 @@
#include "bidi.h"
#endif
#ifdef SIMULATOR
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX
#endif
#ifdef SIMULATOR
static unsigned char pluginbuf[PLUGIN_BUFFER_SIZE];
void *sim_plugin_load(char *plugin, void **pd);

View file

@ -123,12 +123,6 @@ void* plugin_get_buffer(size_t *buffer_size);
#endif
#ifdef SIMULATOR
#define PREFIX(_x_) sim_ ## _x_
#else
#define PREFIX(_x_) _x_
#endif
#define PLUGIN_MAGIC 0x526F634B /* RocK */
/* increase this every time the api struct changes */
@ -369,16 +363,16 @@ struct plugin_api {
#endif /* HAVE_BUTTON_LIGHT */
/* file */
int (*PREFIX(open))(const char* pathname, int flags);
int (*PREFIX(close))(int fd);
ssize_t (*PREFIX(read))(int fd, void* buf, size_t count);
off_t (*PREFIX(lseek))(int fd, off_t offset, int whence);
int (*PREFIX(creat))(const char *pathname);
ssize_t (*PREFIX(write))(int fd, const void* buf, size_t count);
int (*PREFIX(remove))(const char* pathname);
int (*PREFIX(rename))(const char* path, const char* newname);
int (*PREFIX(ftruncate))(int fd, off_t length);
off_t (*PREFIX(filesize))(int fd);
int (*open)(const char* pathname, int flags);
int (*close)(int fd);
ssize_t (*read)(int fd, void* buf, size_t count);
off_t (*lseek)(int fd, off_t offset, int whence);
int (*creat)(const char *pathname);
ssize_t (*write)(int fd, const void* buf, size_t count);
int (*remove)(const char* pathname);
int (*rename)(const char* path, const char* newname);
int (*ftruncate)(int fd, off_t length);
off_t (*filesize)(int fd);
int (*fdprintf)(int fd, const char *fmt, ...) ATTRIBUTE_PRINTF(2, 3);
int (*read_line)(int fd, char* buffer, int buffer_size);
bool (*settings_parseline)(char* line, char** name, char** value);
@ -405,7 +399,7 @@ struct plugin_api {
bool (*dir_exists)(const char *path);
/* kernel/ system */
void (*PREFIX(sleep))(int ticks);
void (*sleep)(int ticks);
void (*yield)(void);
volatile long* current_tick;
long (*default_event_handler)(long event);
@ -577,7 +571,7 @@ struct plugin_api {
int (*playlist_amount)(void);
int (*playlist_resume)(void);
int (*playlist_start)(int start_index, int offset);
void (*PREFIX(audio_play))(long offset);
void (*audio_play)(long offset);
void (*audio_stop)(void);
void (*audio_pause)(void);
void (*audio_resume)(void);

View file

@ -41,28 +41,12 @@ char *my_strtok( char * s, const char * delim );
#define vsnprintf(...) rb->vsnprintf(__VA_ARGS__)
#define read_line(a,b,c) rb->read_line((a),(b),(c))
#ifdef SIMULATOR
#undef open
#undef close
#undef lseek
#undef filesize
#undef read
#undef write
#define open(a,b) rb->sim_open((a),(b))
#define close(a) rb->sim_close((a))
#define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
#define filesize(a) rb->sim_filesize((a))
#define read(a,b,c) rb->sim_read((a),(b),(c))
#define write(a,b,c) rb->sim_write((a),(b),(c))
#else /* !SIMULATOR */
#define open(a,b) my_open((a),(b))
#define close(a) my_close((a))
#define lseek(a,b,c) rb->lseek((a),(b),(c))
#define filesize(a) rb->filesize((a))
#define read(a,b,c) rb->read((a),(b),(c))
#define write(a,b,c) rb->write((a),(b),(c))
#endif /* !SIMULATOR */
#define strtok(a,b) my_strtok((a),(b))
#define strcat(a,b) rb->strcat((a),(b))
#define memset(a,b,c) rb->memset((a),(b),(c))

View file

@ -60,25 +60,11 @@ void dynamic_recompile (struct dynarec_block *newblock);
#define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z')))
#define isalnum(c) (isdigit(c) || (isalpha(c)))
#ifdef SIMULATOR
#undef open
#define open(a,b) rb->sim_open((a),(b))
#undef lseek
#define lseek(a,b,c) rb->sim_lseek((a),(b),(c))
#undef close
#define close(a) rb->sim_close((a))
#undef read
#define read(a,b,c) rb->sim_read((a),(b),(c))
#undef write
#define write(a,b,c) rb->sim_write((a),(b),(c))
#else /* !SIMULATOR */
#define open(a,b) rb->open((a),(b))
#define lseek(a,b,c) rb->lseek((a),(b),(c))
#define close(a) rb->close((a))
#define read(a,b,c) rb->read((a),(b),(c))
#define write(a,b,c) rb->write((a),(b),(c))
#endif /* !SIMULATOR */
#define strcat(a,b) rb->strcat((a),(b))
#define memset(a,b,c) rb->memset((a),(b),(c))
#define strcpy(a,b) rb->strcpy((a),(b))

View file

@ -1305,7 +1305,7 @@ void delete_save_file( void )
int save_write( int fd, const void *buf, size_t count, int *checksum )
{
size_t i;
if( rb->PREFIX(write)( fd, buf, count ) < (ssize_t)count )
if( rb->write( fd, buf, count ) < (ssize_t)count )
return 1;
for( i = 0; i < count; i++ )
*checksum += (int)(((const char *)buf)[i]);
@ -1318,7 +1318,7 @@ int save_write( int fd, const void *buf, size_t count, int *checksum )
int save_read( int fd, void *buf, size_t count, int *checksum )
{
size_t i;
if( rb->PREFIX(read)( fd, buf, count ) < (ssize_t)count )
if( rb->read( fd, buf, count ) < (ssize_t)count )
return 1;
for( i = 0; i < count; i++ )
*checksum -= (int)(((const char *)buf)[i]);
@ -1341,7 +1341,7 @@ int save_game( void )
|| save_write( fd, &cards_per_draw, sizeof( int ), &checksum )
|| save_write( fd, cols, COL_NUM * sizeof( int ), &checksum )
|| save_write( fd, stacks, SUITS * sizeof( int ), &checksum )
|| ( rb->PREFIX(write)( fd, &checksum, sizeof( int ) ) < (ssize_t)(sizeof( int ) ) ) )
|| ( rb->write( fd, &checksum, sizeof( int ) ) < (ssize_t)(sizeof( int ) ) ) )
{
rb->close( fd );
rb->splash( 2*HZ, "Error while saving game. Aborting." );
@ -1357,9 +1357,9 @@ int load_game( void )
int checksum;
if( fd < 0 )
return -1;
if( ( rb->PREFIX(lseek)( fd, -sizeof( int ), SEEK_END ) == -((ssize_t)sizeof( int ))-1 )
|| ( rb->PREFIX(read)( fd, &checksum, sizeof( int ) ) < ((ssize_t)sizeof( int )) )
|| ( rb->PREFIX(lseek)( fd, 0, SEEK_SET ) == -1 )
if( ( rb->lseek( fd, -sizeof( int ), SEEK_END ) == -((ssize_t)sizeof( int ))-1 )
|| ( rb->read( fd, &checksum, sizeof( int ) ) < ((ssize_t)sizeof( int )) )
|| ( rb->lseek( fd, 0, SEEK_SET ) == -1 )
|| save_read( fd, &cur_card, sizeof( int ), &checksum )
|| save_read( fd, &cur_col, sizeof( int ), &checksum )
|| save_read( fd, &sel_card, sizeof( int ), &checksum )

View file

@ -141,7 +141,7 @@ int get_eol_string(char* fn)
return 0;
else if (!fn[0])
return 0;
fd = rb->PREFIX(open(fn,O_RDONLY));
fd = rb->open(fn,O_RDONLY);
if (fd<0)
return 0;
eol[0] = '\0';

View file

@ -1310,7 +1310,7 @@ static void viewer_save_settings(void)/* same name as global, but not the same f
b.top_ptr_pos = 0; /* this is only kept for legassy reasons */
rb->memset(&b.filename[0],0,MAX_PATH);
rb->strcpy(b.filename,file_name);
rb->PREFIX(lseek)(settings_fd,sizeof(signed int),SEEK_SET);
rb->lseek(settings_fd,sizeof(signed int),SEEK_SET);
rb->write (settings_fd, &b, sizeof(struct bookmarked_file_info));
rb->close(settings_fd);
}

View file

@ -213,7 +213,7 @@ static inline void call_tick_tasks(void)
}
#endif
#ifdef SIMULATOR
#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
#define sleep(x) sim_sleep(x)
#endif

View file

@ -48,7 +48,7 @@
#define O_TRUNC 0x10
#endif
#ifdef SIMULATOR
#if defined(SIMULATOR) && !defined(PLUGIN) && !defined(CODEC)
#define open(x,y) sim_open(x,y)
#define creat(x) sim_creat(x)
#define remove(x) sim_remove(x)