mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-01-22 01:30:35 -05:00
lua -- remove direct rb-> libc calls infavor of macro substitution WIP
there are no functional changes in this patch it just makes it easier to build lua in core app or plugin form -Update moved some things around messing up compilation on Native targets due to *errno Change-Id: I0921df62d72a87516ad95c68e986b5931c35345e
This commit is contained in:
parent
ded29fd751
commit
032a38df4e
12 changed files with 109 additions and 55 deletions
|
|
@ -26,6 +26,8 @@
|
|||
#include <ctype.h>
|
||||
#include "plugin.h"
|
||||
|
||||
#ifndef LUA_LIB
|
||||
|
||||
#if (CONFIG_PLATFORM & PLATFORM_HOSTED)
|
||||
#include <errno.h>
|
||||
#define PREFIX(_x_) sim_ ## _x_
|
||||
|
|
@ -35,14 +37,47 @@ extern int errno;
|
|||
#define ERANGE 34 /* Math result not representable */
|
||||
#define PREFIX
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define __likely LIKELY
|
||||
#define __unlikely UNLIKELY
|
||||
|
||||
#ifdef PLUGIN
|
||||
/* Simple substitutions */
|
||||
#define memcmp rb->memcmp
|
||||
#define strlen rb->strlen
|
||||
#define strrchr rb->strrchr
|
||||
|
||||
#define write(fd,buf,n) rb->write(fd,buf,n)
|
||||
#define read(fd,buf,n) rb->read(fd,buf,n)
|
||||
#define open(...) rb->open(__VA_ARGS__)
|
||||
#define close(fd) rb->close(fd)
|
||||
#define lseek(fd,off,w) rb->lseek(fd,off,w)
|
||||
#define filesize(fd) rb->filesize(fd)
|
||||
#define ftruncate(fd,l) rb->ftruncate(fd,l)
|
||||
#define file_exists(p) rb->file_exists(p)
|
||||
#define remove(f) rb->remove(f)
|
||||
#define rename(old,new) rb->rename(old,new)
|
||||
|
||||
#define mkdir(p) rb->mkdir(p)
|
||||
#define rmdir(p) rb->rmdir(p)
|
||||
#define opendir(p) rb->opendir(p)
|
||||
#define closedir(d) rb->closedir(d)
|
||||
#define readdir(d) rb->readdir(d)
|
||||
#define dir_get_info(d,e) rb->dir_get_info(d,e)
|
||||
|
||||
#else /*ndef PLUGIN*/
|
||||
#define write(fd,buf,n) PREFIX(write)(fd,buf,n)
|
||||
#define read(fd,buf,n) PREFIX(read)(fd,buf,n)
|
||||
#define open(...) PREFIX(open)(__VA_ARGS__)
|
||||
#define close(fd) PREFIX(close)(fd)
|
||||
#define lseek(fd,off,w) PREFIX(lseek)(fd,off,w)
|
||||
#define filesize(fd) PREFIX(filesize)(fd)
|
||||
#define ftruncate(fd,l) PREFIX(ftruncate)(fd,l)
|
||||
#define file_exists(p) PREFIX(file_exists)(p)
|
||||
#define remove(f) PREFIX(remove)(f)
|
||||
#define rename(old,new) PREFIX(rename)(old,new)
|
||||
|
||||
#endif /* def PLUGIN */
|
||||
#endif /* _ROCKLIBC_H_ */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue