1
0
mirror of https://github.com/elua/elua.git synced 2025-01-08 20:56:17 +08:00

Lua, eLua - Add function prototypes, fix shellh_ask_yes_no prototype

This commit is contained in:
ecdr 2013-10-30 00:44:15 -08:00
parent 4990f27486
commit 9f81cca6b8
5 changed files with 43 additions and 13 deletions

View File

@ -31,7 +31,7 @@ void shellh_show_help( const char *cmd, const char *helptext );
#define SHELL_SHOW_HELP( cmd ) shellh_show_help( #cmd, shell_help_##cmd )
// Helpers for various functions
int shellh_ask_yes_no( void );
int shellh_ask_yes_no( const char *prompt );
// Flags for various operations
#define SHELL_F_RECURSIVE 1
@ -41,5 +41,21 @@ int shellh_ask_yes_no( void );
#define SHELL_F_SILENT 16
#define SHELL_F_MOVE 32
// External shell function declaration
#define SHELL_FUNC( func ) extern void func( int argc, char **argv )
// Extern implementations of shell functions
SHELL_FUNC( shell_ls );
SHELL_FUNC( shell_cp );
SHELL_FUNC( shell_adv_mv );
SHELL_FUNC( shell_adv_rm );
SHELL_FUNC( shell_recv );
SHELL_FUNC( shell_help );
SHELL_FUNC( shell_cat );
SHELL_FUNC( shell_lua );
SHELL_FUNC( shell_ver );
SHELL_FUNC( shell_mkdir );
SHELL_FUNC( shell_wofmt );
#endif // #ifndef __SHELL_H__

View File

@ -22,11 +22,14 @@
#include "desktop_conf.h"
#endif
// Dummy open function
int luaopen_dummy(lua_State *L)
{
return 0;
}
LUALIB_API int luaopen_platform (lua_State *L);
// Declare table
#if defined(LUA_PLATFORM_LIBS_ROM) && LUA_OPTIMIZE_MEMORY == 2
#undef _ROM
#define _ROM( name, openf, table ) extern const luaR_entry table[];
LUA_PLATFORM_LIBS_ROM;
#endif
// ****************************************************************************
// Platform module handling
@ -121,11 +124,6 @@ static const luaL_Reg lualibs[] = {
{NULL, NULL}
};
#if defined(LUA_PLATFORM_LIBS_ROM) && LUA_OPTIMIZE_MEMORY == 2
#undef _ROM
#define _ROM( name, openf, table ) extern const luaR_entry table[];
LUA_PLATFORM_LIBS_ROM;
#endif
const luaR_table lua_rotable[] =
{
#if defined(LUA_PLATFORM_LIBS_ROM) && LUA_OPTIMIZE_MEMORY == 2
@ -146,3 +144,10 @@ LUALIB_API void luaL_openlibs (lua_State *L) {
}
}
// Dummy open function
int luaopen_dummy(lua_State *L)
{
return 0;
}

View File

@ -10,6 +10,9 @@
// Buffer for async dispatch
int adispatch_buff = -1;
void set_adispatch_buff( int i );
int transport_get_char(Transport *t);
void set_adispatch_buff( int i )
{
adispatch_buff = i;

View File

@ -22,6 +22,10 @@
#include <malloc.h>
#endif
int open( const char *name, int flags, mode_t mode );
int _kill( int pid, int sig );
pid_t _getpid( void );
// Utility function: look in the device manager table and find the index
// for the given name. Returns an index into the device structure, -1 if error.
// Also returns a pointer to the actual file name (without the device part)
@ -342,13 +346,13 @@ int isatty( int fd )
#include <sys/types.h>
#include <unistd.h>
pid_t _getpid()
pid_t _getpid( void )
{
return 0;
}
// For some very strange reason, the next function is required by the i386 platform...
pid_t getpid()
pid_t getpid( void )
{
return 0;
}

View File

@ -15,6 +15,8 @@
#endif
#include <stdio.h>
#include "elua_rfs.h"
#ifdef BUILD_RFS
// [TODO] the new builder should automatically do this