diff --git a/app/Makefile b/app/Makefile index 68c3e79e..b5d9c4b8 100644 --- a/app/Makefile +++ b/app/Makefile @@ -41,7 +41,38 @@ endif # } PDIR APPDIR = . LDDIR = ../ld -CCFLAGS += -Os +ifeq ($(OS),Windows_NT) +# WIN32 +# We are under windows. Assume using xcc. + CCFLAGS += -Os --rename-section .text=.irom0.text --rename-section .literal=.irom0.literal + ifeq ($(PROCESSOR_ARCHITECTURE),AMD64) +# ->AMD64 + endif + ifeq ($(PROCESSOR_ARCHITECTURE),x86) +# ->IA32 + endif +else +# We are under other system, may be Linux. Assume using gcc. +# Can we use -fdata-sections? + CCFLAGS += -Os -ffunction-sections -fno-jump-tables + UNAME_S := $(shell uname -s) + ifeq ($(UNAME_S),Linux) +# LINUX + endif + ifeq ($(UNAME_S),Darwin) +# OSX + endif + UNAME_P := $(shell uname -p) + ifeq ($(UNAME_P),x86_64) +# ->AMD64 + endif + ifneq ($(filter %86,$(UNAME_P)),) +# ->IA32 + endif + ifneq ($(filter arm%,$(UNAME_P)),) +# ->ARM + endif +endif TARGET_LDFLAGS = \ -nostdlib \ @@ -49,6 +80,7 @@ TARGET_LDFLAGS = \ --longcalls \ --text-section-literals + ifeq ($(FLAVOR),debug) TARGET_LDFLAGS += -g -O2 endif diff --git a/app/driver/onewire.c b/app/driver/onewire.c index 552f3b67..18f46dca 100644 --- a/app/driver/onewire.c +++ b/app/driver/onewire.c @@ -72,7 +72,7 @@ static uint8_t LastFamilyDiscrepancy[NUM_OW]; static uint8_t LastDeviceFlag[NUM_OW]; #endif -void ICACHE_FLASH_ATTR onewire_init(uint8_t pin) +void onewire_init(uint8_t pin) { // pinMode(pin, INPUT); platform_gpio_mode(pin, PLATFORM_GPIO_INPUT, PLATFORM_GPIO_PULLUP); @@ -88,7 +88,7 @@ void ICACHE_FLASH_ATTR onewire_init(uint8_t pin) // // Returns 1 if a device asserted a presence pulse, 0 otherwise. // -uint8_t ICACHE_FLASH_ATTR onewire_reset(uint8_t pin) +uint8_t onewire_reset(uint8_t pin) { uint8_t r; uint8_t retries = 125; @@ -120,7 +120,7 @@ uint8_t ICACHE_FLASH_ATTR onewire_reset(uint8_t pin) // Write a bit. Port and bit is used to cut lookup time and provide // more certain timing. // -static void ICACHE_FLASH_ATTR onewire_write_bit(uint8_t pin, uint8_t v) +static void onewire_write_bit(uint8_t pin, uint8_t v) { if (v & 1) { noInterrupts(); @@ -145,7 +145,7 @@ static void ICACHE_FLASH_ATTR onewire_write_bit(uint8_t pin, uint8_t v) // Read a bit. Port and bit is used to cut lookup time and provide // more certain timing. // -static uint8_t ICACHE_FLASH_ATTR onewire_read_bit(uint8_t pin) +static uint8_t onewire_read_bit(uint8_t pin) { uint8_t r; @@ -168,7 +168,7 @@ static uint8_t ICACHE_FLASH_ATTR onewire_read_bit(uint8_t pin) // go tri-state at the end of the write to avoid heating in a short or // other mishap. // -void ICACHE_FLASH_ATTR onewire_write(uint8_t pin, uint8_t v, uint8_t power /* = 0 */) { +void onewire_write(uint8_t pin, uint8_t v, uint8_t power /* = 0 */) { uint8_t bitMask; for (bitMask = 0x01; bitMask; bitMask <<= 1) { @@ -182,7 +182,7 @@ void ICACHE_FLASH_ATTR onewire_write(uint8_t pin, uint8_t v, uint8_t power /* = } } -void ICACHE_FLASH_ATTR onewire_write_bytes(uint8_t pin, const uint8_t *buf, uint16_t count, bool power /* = 0 */) { +void onewire_write_bytes(uint8_t pin, const uint8_t *buf, uint16_t count, bool power /* = 0 */) { uint16_t i; for (i = 0 ; i < count ; i++) onewire_write(pin, buf[i], 0); @@ -197,7 +197,7 @@ void ICACHE_FLASH_ATTR onewire_write_bytes(uint8_t pin, const uint8_t *buf, uint // // Read a byte // -uint8_t ICACHE_FLASH_ATTR onewire_read(uint8_t pin) { +uint8_t onewire_read(uint8_t pin) { uint8_t bitMask; uint8_t r = 0; @@ -207,7 +207,7 @@ uint8_t ICACHE_FLASH_ATTR onewire_read(uint8_t pin) { return r; } -void ICACHE_FLASH_ATTR onewire_read_bytes(uint8_t pin, uint8_t *buf, uint16_t count) { +void onewire_read_bytes(uint8_t pin, uint8_t *buf, uint16_t count) { uint16_t i; for (i = 0 ; i < count ; i++) buf[i] = onewire_read(pin); @@ -216,7 +216,7 @@ void ICACHE_FLASH_ATTR onewire_read_bytes(uint8_t pin, uint8_t *buf, uint16_t co // // Do a ROM select // -void ICACHE_FLASH_ATTR onewire_select(uint8_t pin, const uint8_t rom[8]) +void onewire_select(uint8_t pin, const uint8_t rom[8]) { uint8_t i; @@ -228,12 +228,12 @@ void ICACHE_FLASH_ATTR onewire_select(uint8_t pin, const uint8_t rom[8]) // // Do a ROM skip // -void ICACHE_FLASH_ATTR onewire_skip(uint8_t pin) +void onewire_skip(uint8_t pin) { onewire_write(pin, 0xCC, 0); // Skip ROM } -void ICACHE_FLASH_ATTR onewire_depower(uint8_t pin) +void onewire_depower(uint8_t pin) { noInterrupts(); DIRECT_MODE_INPUT(pin); @@ -246,7 +246,7 @@ void ICACHE_FLASH_ATTR onewire_depower(uint8_t pin) // You need to use this function to start a search again from the beginning. // You do not need to do it for the first search, though you could. // -void ICACHE_FLASH_ATTR onewire_reset_search(uint8_t pin) +void onewire_reset_search(uint8_t pin) { // reset the search state LastDiscrepancy[pin] = 0; @@ -262,7 +262,7 @@ void ICACHE_FLASH_ATTR onewire_reset_search(uint8_t pin) // Setup the search to find the device type 'family_code' on the next call // to search(*newAddr) if it is present. // -void ICACHE_FLASH_ATTR onewire_target_search(uint8_t pin, uint8_t family_code) +void onewire_target_search(uint8_t pin, uint8_t family_code) { // set the search state to find SearchFamily type devices ROM_NO[pin][0] = family_code; @@ -290,7 +290,7 @@ void ICACHE_FLASH_ATTR onewire_target_search(uint8_t pin, uint8_t family_code) // Return TRUE : device found, ROM number in ROM_NO buffer // FALSE : device not found, end of search // -uint8_t ICACHE_FLASH_ATTR onewire_search(uint8_t pin, uint8_t *newAddr) +uint8_t onewire_search(uint8_t pin, uint8_t *newAddr) { uint8_t id_bit_number; uint8_t last_zero, rom_byte_number, search_result; @@ -449,7 +449,7 @@ static const uint8_t dscrc_table[] = { // compared to all those delayMicrosecond() calls. But I got // confused, so I use this table from the examples.) // -uint8_t ICACHE_FLASH_ATTR onewire_crc8(const uint8_t *addr, uint8_t len) +uint8_t onewire_crc8(const uint8_t *addr, uint8_t len) { uint8_t crc = 0; @@ -463,7 +463,7 @@ uint8_t ICACHE_FLASH_ATTR onewire_crc8(const uint8_t *addr, uint8_t len) // Compute a Dallas Semiconductor 8 bit CRC directly. // this is much slower, but much smaller, than the lookup table. // -uint8_t ICACHE_FLASH_ATTR onewire_crc8(const uint8_t *addr, uint8_t len) +uint8_t onewire_crc8(const uint8_t *addr, uint8_t len) { uint8_t crc = 0; @@ -501,7 +501,7 @@ uint8_t ICACHE_FLASH_ATTR onewire_crc8(const uint8_t *addr, uint8_t len) // *not* at a 16-bit integer. // @param crc - The crc starting value (optional) // @return True, iff the CRC matches. -bool ICACHE_FLASH_ATTR onewire_check_crc16(const uint8_t* input, uint16_t len, const uint8_t* inverted_crc, uint16_t crc) +bool onewire_check_crc16(const uint8_t* input, uint16_t len, const uint8_t* inverted_crc, uint16_t crc) { crc = ~onewire_crc16(input, len, crc); return (crc & 0xFF) == inverted_crc[0] && (crc >> 8) == inverted_crc[1]; @@ -519,7 +519,7 @@ bool ICACHE_FLASH_ATTR onewire_check_crc16(const uint8_t* input, uint16_t len, c // @param len - How many bytes to use. // @param crc - The crc starting value (optional) // @return The CRC16, as defined by Dallas Semiconductor. -uint16_t ICACHE_FLASH_ATTR onewire_crc16(const uint8_t* input, uint16_t len, uint16_t crc) +uint16_t onewire_crc16(const uint8_t* input, uint16_t len, uint16_t crc) { static const uint8_t oddparity[16] = { 0, 1, 1, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0 }; diff --git a/app/driver/pwm.c b/app/driver/pwm.c index e292ff63..7e1728fd 100644 --- a/app/driver/pwm.c +++ b/app/driver/pwm.c @@ -305,7 +305,7 @@ pwm_get_freq(uint8 channel) * Parameters : NONE * Returns : NONE *******************************************************************************/ -LOCAL void +LOCAL void ICACHE_RAM_ATTR pwm_tim1_intr_handler(void) { uint8 local_toggle = pwm_toggle; // pwm_toggle may change outside diff --git a/app/driver/readline.c b/app/driver/readline.c index 7d755d5d..64cd0d08 100644 --- a/app/driver/readline.c +++ b/app/driver/readline.c @@ -11,7 +11,7 @@ extern UartDevice UartDev; #define uart_putc uart0_putc -bool ICACHE_FLASH_ATTR uart_getc(char *c){ +bool uart_getc(char *c){ RcvMsgBuff *pRxBuff = &(UartDev.rcv_buff); if(pRxBuff->pWritePos == pRxBuff->pReadPos){ // empty return false; @@ -30,7 +30,7 @@ bool ICACHE_FLASH_ATTR uart_getc(char *c){ } #if 0 -int ICACHE_FLASH_ATTR readline4lua(const char *prompt, char *buffer, int length){ +int readline4lua(const char *prompt, char *buffer, int length){ char ch; int line_position; diff --git a/app/driver/uart.c b/app/driver/uart.c index 76a70933..9e773054 100644 --- a/app/driver/uart.c +++ b/app/driver/uart.c @@ -20,7 +20,8 @@ // UartDev is defined and initialized in rom code. extern UartDevice UartDev; -LOCAL void uart0_rx_intr_handler(void *para); +LOCAL void ICACHE_RAM_ATTR +uart0_rx_intr_handler(void *para); /****************************************************************************** * FunctionName : uart_config diff --git a/app/include/user_config.h b/app/include/user_config.h index e0c04807..cf7b9687 100644 --- a/app/include/user_config.h +++ b/app/include/user_config.h @@ -3,11 +3,11 @@ #define NODE_VERSION_MAJOR 0U #define NODE_VERSION_MINOR 9U -#define NODE_VERSION_REVISION 4U +#define NODE_VERSION_REVISION 5U #define NODE_VERSION_INTERNAL 0U -#define NODE_VERSION "NodeMcu 0.9.4" -#define BUILD_DATE "build 20150101" +#define NODE_VERSION "NodeMcu 0.9.5" +#define BUILD_DATE "build 20150105" // #define FLASH_512K // #define FLASH_1M @@ -35,8 +35,9 @@ #define NODE_ERR #endif /* NODE_ERROR */ -#define NODE_STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed)) -#define NODE_STORE_ATTR __attribute__((aligned(4))) +#define ICACHE_STORE_TYPEDEF_ATTR __attribute__((aligned(4),packed)) +#define ICACHE_STORE_ATTR __attribute__((aligned(4))) +#define ICACHE_RAM_ATTR __attribute__((section(".iram0.text"))) #define CLIENT_SSL_ENABLE #define GPIO_INTERRUPT_ENABLE diff --git a/app/libc/c_ctype.c b/app/libc/c_ctype.c index a3683fd7..90f8d709 100644 --- a/app/libc/c_ctype.c +++ b/app/libc/c_ctype.c @@ -1,16 +1,16 @@ #include "c_ctype.h" #include "c_types.h" -// int ICACHE_FLASH_ATTR isalnum(int c){} -// int ICACHE_FLASH_ATTR isalpha(int c){} -// int ICACHE_FLASH_ATTR iscntrl(int c){} -// int ICACHE_FLASH_ATTR isdigit(int c){} -// // int ICACHE_FLASH_ATTR isgraph(int c){} -// int ICACHE_FLASH_ATTR islower(int c){} -// int ICACHE_FLASH_ATTR isprint(int c){} -// int ICACHE_FLASH_ATTR ispunct(int c){} -// int ICACHE_FLASH_ATTR isspace(int c){} -// int ICACHE_FLASH_ATTR isupper(int c){} -// int ICACHE_FLASH_ATTR isxdigit(int c){} -// int ICACHE_FLASH_ATTR tolower(int c){} -// int ICACHE_FLASH_ATTR toupper(int c){} +// int isalnum(int c){} +// int isalpha(int c){} +// int iscntrl(int c){} +// int isdigit(int c){} +// // int isgraph(int c){} +// int islower(int c){} +// int isprint(int c){} +// int ispunct(int c){} +// int isspace(int c){} +// int isupper(int c){} +// int isxdigit(int c){} +// int tolower(int c){} +// int toupper(int c){} diff --git a/app/libc/c_math.c b/app/libc/c_math.c index 5e18a4d1..185e5691 100644 --- a/app/libc/c_math.c +++ b/app/libc/c_math.c @@ -3,34 +3,34 @@ #if 0 #ifndef __math_68881 -double ICACHE_FLASH_ATTR atan(double x){ +double atan(double x){ return x; } -double ICACHE_FLASH_ATTR cos(double x){ +double cos(double x){ return x; } -double ICACHE_FLASH_ATTR sin(double x){ +double sin(double x){ return x; } -double ICACHE_FLASH_ATTR tan(double x){ +double tan(double x){ return x; } -double ICACHE_FLASH_ATTR tanh(double x){ +double tanh(double x){ return x; } -double ICACHE_FLASH_ATTR frexp(double x, int *y){ +double frexp(double x, int *y){ return x; } -double ICACHE_FLASH_ATTR modf(double x, double *y){ +double modf(double x, double *y){ return x; } -double ICACHE_FLASH_ATTR ceil(double x){ +double ceil(double x){ return x; } -double ICACHE_FLASH_ATTR fabs(double x){ +double fabs(double x){ return x; } -double ICACHE_FLASH_ATTR floor(double x){ +double floor(double x){ return x; } #endif /* ! defined (__math_68881) */ @@ -39,40 +39,40 @@ double ICACHE_FLASH_ATTR floor(double x){ #ifndef _REENT_ONLY #ifndef __math_68881 -double ICACHE_FLASH_ATTR acos(double x){ +double acos(double x){ return x; } -double ICACHE_FLASH_ATTR asin(double x){ +double asin(double x){ return x; } -double ICACHE_FLASH_ATTR atan2(double x, double y){ +double atan2(double x, double y){ return x; } -double ICACHE_FLASH_ATTR cosh(double x){ +double cosh(double x){ return x; } -double ICACHE_FLASH_ATTR sinh(double x){ +double sinh(double x){ return x; } -double ICACHE_FLASH_ATTR exp(double x){ +double exp(double x){ return x; } -double ICACHE_FLASH_ATTR ldexp(double x, int y){ +double ldexp(double x, int y){ return x; } -double ICACHE_FLASH_ATTR log(double x){ +double log(double x){ return x; } -double ICACHE_FLASH_ATTR log10(double x){ +double log10(double x){ return x; } -double ICACHE_FLASH_ATTR pow(double x, double y){ +double pow(double x, double y){ return x; } -double ICACHE_FLASH_ATTR sqrt(double x){ +double sqrt(double x){ return x; } -double ICACHE_FLASH_ATTR fmod(double x, double y){ +double fmod(double x, double y){ return x; } #endif /* ! defined (__math_68881) */ diff --git a/app/libc/c_stdlib.c b/app/libc/c_stdlib.c index e1598392..7115914d 100644 --- a/app/libc/c_stdlib.c +++ b/app/libc/c_stdlib.c @@ -7,12 +7,12 @@ // const char *lua_init_value = "print(\"Hello world\")"; const char *lua_init_value = "@init.lua"; -// int ICACHE_FLASH_ATTR c_abs(int x){ +// int c_abs(int x){ // return x>0?x:0-x; // } -// void ICACHE_FLASH_ATTR c_exit(int e){ +// void c_exit(int e){ // } -const char *ICACHE_FLASH_ATTR c_getenv(const char *__string){ +const char *c_getenv(const char *__string){ if (c_strcmp(__string, "LUA_INIT") == 0){ return lua_init_value; } @@ -20,7 +20,7 @@ const char *ICACHE_FLASH_ATTR c_getenv(const char *__string){ } // make sure there is enough memory before real malloc, otherwise malloc will panic and reset -void *ICACHE_FLASH_ATTR c_malloc(size_t __size){ +void *c_malloc(size_t __size){ if(__size>system_get_free_heap_size()){ NODE_ERR("malloc: not enough memory\n"); return NULL; @@ -28,7 +28,7 @@ void *ICACHE_FLASH_ATTR c_malloc(size_t __size){ return (void *)os_malloc(__size); } -void *ICACHE_FLASH_ATTR c_zalloc(size_t __size){ +void *c_zalloc(size_t __size){ if(__size>system_get_free_heap_size()){ NODE_ERR("zalloc: not enough memory\n"); return NULL; @@ -36,25 +36,25 @@ void *ICACHE_FLASH_ATTR c_zalloc(size_t __size){ return (void *)os_zalloc(__size); } -void ICACHE_FLASH_ATTR c_free(void *p){ +void c_free(void *p){ // NODE_ERR("free1: %d\n", system_get_free_heap_size()); os_free(p); // NODE_ERR("-free1: %d\n", system_get_free_heap_size()); } -// int ICACHE_FLASH_ATTR c_rand(void){ +// int c_rand(void){ // } -// void ICACHE_FLASH_ATTR c_srand(unsigned int __seed){ +// void c_srand(unsigned int __seed){ // } -// int ICACHE_FLASH_ATTR c_atoi(const char *__nptr){ +// int c_atoi(const char *__nptr){ // } -// double ICACHE_FLASH_ATTR c_strtod(const char *__n, char **__end_PTR){ +// double c_strtod(const char *__n, char **__end_PTR){ // } -// long ICACHE_FLASH_ATTR c_strtol(const char *__n, char **__end_PTR, int __base){ +// long c_strtol(const char *__n, char **__end_PTR, int __base){ // } -// unsigned long ICACHE_FLASH_ATTR c_strtoul(const char *__n, char **__end_PTR, int __base){ +// unsigned long c_strtoul(const char *__n, char **__end_PTR, int __base){ // } -// long long ICACHE_FLASH_ATTR c_strtoll(const char *__n, char **__end_PTR, int __base){ +// long long c_strtoll(const char *__n, char **__end_PTR, int __base){ // } diff --git a/app/lua/compiler.h b/app/lua/compiler.h index 6b36f88d..309c49b2 100644 --- a/app/lua/compiler.h +++ b/app/lua/compiler.h @@ -22,15 +22,15 @@ extern char Image$$ER_IROM1$$Limit; //#warning "Please check linker script to ensure rodata is between _stext and _etext." /* symbols defined in linker script */ -extern char _rodata_start; -extern char _rodata_end; -// extern char _irom0_text_start; -// extern char _irom0_text_end; +// extern char _rodata_start; +// extern char _rodata_end; +extern char _irom0_text_start; +extern char _irom0_text_end; // modify linker script to ensure rodata and rodata1 is between _rodata_start and _rodata_end. -#define RODATA_START_ADDRESS (&_rodata_start) -#define RODATA_END_ADDRESS (&_rodata_end) -// #define RODATA_START_ADDRESS (&_irom0_text_start) -// #define RODATA_END_ADDRESS (&_irom0_text_end) +// #define RODATA_START_ADDRESS (&_rodata_start) +// #define RODATA_END_ADDRESS (&_rodata_end) +#define RODATA_START_ADDRESS (&_irom0_text_start) +#define RODATA_END_ADDRESS (&_irom0_text_end) #else // other compilers diff --git a/app/lua/lapi.c b/app/lua/lapi.c index 2e76a4d7..712e0666 100644 --- a/app/lua/lapi.c +++ b/app/lua/lapi.c @@ -46,7 +46,7 @@ const char lua_ident[] = -static TValue *ICACHE_FLASH_ATTR index2adr (lua_State *L, int idx) { +static TValue *index2adr (lua_State *L, int idx) { if (idx > 0) { TValue *o = L->base + (idx - 1); api_check(L, idx <= L->ci->top - L->base); @@ -77,7 +77,7 @@ static TValue *ICACHE_FLASH_ATTR index2adr (lua_State *L, int idx) { } -static Table *ICACHE_FLASH_ATTR getcurrenv (lua_State *L) { +static Table *getcurrenv (lua_State *L) { if (L->ci == L->base_ci) /* no enclosing function? */ return hvalue(gt(L)); /* use global table as environment */ else { @@ -87,13 +87,13 @@ static Table *ICACHE_FLASH_ATTR getcurrenv (lua_State *L) { } -void ICACHE_FLASH_ATTR luaA_pushobject (lua_State *L, const TValue *o) { +void luaA_pushobject (lua_State *L, const TValue *o) { setobj2s(L, L->top, o); api_incr_top(L); } -LUA_API int ICACHE_FLASH_ATTR lua_checkstack (lua_State *L, int size) { +LUA_API int lua_checkstack (lua_State *L, int size) { int res = 1; lua_lock(L); if (size > LUAI_MAXCSTACK || (L->top - L->base + size) > LUAI_MAXCSTACK) @@ -108,7 +108,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_checkstack (lua_State *L, int size) { } -LUA_API void ICACHE_FLASH_ATTR lua_xmove (lua_State *from, lua_State *to, int n) { +LUA_API void lua_xmove (lua_State *from, lua_State *to, int n) { int i; if (from == to) return; lua_lock(to); @@ -123,12 +123,12 @@ LUA_API void ICACHE_FLASH_ATTR lua_xmove (lua_State *from, lua_State *to, int n) } -LUA_API void ICACHE_FLASH_ATTR lua_setlevel (lua_State *from, lua_State *to) { +LUA_API void lua_setlevel (lua_State *from, lua_State *to) { to->nCcalls = from->nCcalls; } -LUA_API lua_CFunction ICACHE_FLASH_ATTR lua_atpanic (lua_State *L, lua_CFunction panicf) { +LUA_API lua_CFunction lua_atpanic (lua_State *L, lua_CFunction panicf) { lua_CFunction old; lua_lock(L); old = G(L)->panic; @@ -138,7 +138,7 @@ LUA_API lua_CFunction ICACHE_FLASH_ATTR lua_atpanic (lua_State *L, lua_CFunction } -LUA_API lua_State *ICACHE_FLASH_ATTR lua_newthread (lua_State *L) { +LUA_API lua_State *lua_newthread (lua_State *L) { lua_State *L1; lua_lock(L); luaC_checkGC(L); @@ -157,12 +157,12 @@ LUA_API lua_State *ICACHE_FLASH_ATTR lua_newthread (lua_State *L) { */ -LUA_API int ICACHE_FLASH_ATTR lua_gettop (lua_State *L) { +LUA_API int lua_gettop (lua_State *L) { return cast_int(L->top - L->base); } -LUA_API void ICACHE_FLASH_ATTR lua_settop (lua_State *L, int idx) { +LUA_API void lua_settop (lua_State *L, int idx) { lua_lock(L); if (idx >= 0) { api_check(L, idx <= L->stack_last - L->base); @@ -178,7 +178,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_settop (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_remove (lua_State *L, int idx) { +LUA_API void lua_remove (lua_State *L, int idx) { StkId p; lua_lock(L); p = index2adr(L, idx); @@ -189,7 +189,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_remove (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_insert (lua_State *L, int idx) { +LUA_API void lua_insert (lua_State *L, int idx) { StkId p; StkId q; lua_lock(L); @@ -201,7 +201,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_insert (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_replace (lua_State *L, int idx) { +LUA_API void lua_replace (lua_State *L, int idx) { StkId o; lua_lock(L); /* explicit test for incompatible code */ @@ -230,7 +230,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_replace (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_pushvalue (lua_State *L, int idx) { +LUA_API void lua_pushvalue (lua_State *L, int idx) { lua_lock(L); setobj2s(L, L->top, index2adr(L, idx)); api_incr_top(L); @@ -244,44 +244,44 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushvalue (lua_State *L, int idx) { */ -LUA_API int ICACHE_FLASH_ATTR lua_type (lua_State *L, int idx) { +LUA_API int lua_type (lua_State *L, int idx) { StkId o = index2adr(L, idx); return (o == luaO_nilobject) ? LUA_TNONE : ttype(o); } -LUA_API const char *ICACHE_FLASH_ATTR lua_typename (lua_State *L, int t) { +LUA_API const char *lua_typename (lua_State *L, int t) { UNUSED(L); return (t == LUA_TNONE) ? "no value" : luaT_typenames[t]; } -LUA_API int ICACHE_FLASH_ATTR lua_iscfunction (lua_State *L, int idx) { +LUA_API int lua_iscfunction (lua_State *L, int idx) { StkId o = index2adr(L, idx); return iscfunction(o); } -LUA_API int ICACHE_FLASH_ATTR lua_isnumber (lua_State *L, int idx) { +LUA_API int lua_isnumber (lua_State *L, int idx) { TValue n; const TValue *o = index2adr(L, idx); return tonumber(o, &n); } -LUA_API int ICACHE_FLASH_ATTR lua_isstring (lua_State *L, int idx) { +LUA_API int lua_isstring (lua_State *L, int idx) { int t = lua_type(L, idx); return (t == LUA_TSTRING || t == LUA_TNUMBER); } -LUA_API int ICACHE_FLASH_ATTR lua_isuserdata (lua_State *L, int idx) { +LUA_API int lua_isuserdata (lua_State *L, int idx) { const TValue *o = index2adr(L, idx); return (ttisuserdata(o) || ttislightuserdata(o)); } -LUA_API int ICACHE_FLASH_ATTR lua_rawequal (lua_State *L, int index1, int index2) { +LUA_API int lua_rawequal (lua_State *L, int index1, int index2) { StkId o1 = index2adr(L, index1); StkId o2 = index2adr(L, index2); return (o1 == luaO_nilobject || o2 == luaO_nilobject) ? 0 @@ -289,7 +289,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_rawequal (lua_State *L, int index1, int index2 } -LUA_API int ICACHE_FLASH_ATTR lua_equal (lua_State *L, int index1, int index2) { +LUA_API int lua_equal (lua_State *L, int index1, int index2) { StkId o1, o2; int i; lua_lock(L); /* may call tag method */ @@ -301,7 +301,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_equal (lua_State *L, int index1, int index2) { } -LUA_API int ICACHE_FLASH_ATTR lua_lessthan (lua_State *L, int index1, int index2) { +LUA_API int lua_lessthan (lua_State *L, int index1, int index2) { StkId o1, o2; int i; lua_lock(L); /* may call tag method */ @@ -315,7 +315,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_lessthan (lua_State *L, int index1, int index2 -LUA_API lua_Number ICACHE_FLASH_ATTR lua_tonumber (lua_State *L, int idx) { +LUA_API lua_Number lua_tonumber (lua_State *L, int idx) { TValue n; const TValue *o = index2adr(L, idx); if (tonumber(o, &n)) @@ -325,7 +325,7 @@ LUA_API lua_Number ICACHE_FLASH_ATTR lua_tonumber (lua_State *L, int idx) { } -LUA_API lua_Integer ICACHE_FLASH_ATTR lua_tointeger (lua_State *L, int idx) { +LUA_API lua_Integer lua_tointeger (lua_State *L, int idx) { TValue n; const TValue *o = index2adr(L, idx); if (tonumber(o, &n)) { @@ -339,13 +339,13 @@ LUA_API lua_Integer ICACHE_FLASH_ATTR lua_tointeger (lua_State *L, int idx) { } -LUA_API int ICACHE_FLASH_ATTR lua_toboolean (lua_State *L, int idx) { +LUA_API int lua_toboolean (lua_State *L, int idx) { const TValue *o = index2adr(L, idx); return !l_isfalse(o); } -LUA_API const char *ICACHE_FLASH_ATTR lua_tolstring (lua_State *L, int idx, size_t *len) { +LUA_API const char *lua_tolstring (lua_State *L, int idx, size_t *len) { StkId o = index2adr(L, idx); if (!ttisstring(o)) { lua_lock(L); /* `luaV_tostring' may create a new string */ @@ -363,7 +363,7 @@ LUA_API const char *ICACHE_FLASH_ATTR lua_tolstring (lua_State *L, int idx, size } -LUA_API size_t ICACHE_FLASH_ATTR lua_objlen (lua_State *L, int idx) { +LUA_API size_t lua_objlen (lua_State *L, int idx) { StkId o = index2adr(L, idx); switch (ttype(o)) { case LUA_TSTRING: return tsvalue(o)->len; @@ -382,13 +382,13 @@ LUA_API size_t ICACHE_FLASH_ATTR lua_objlen (lua_State *L, int idx) { } -LUA_API lua_CFunction ICACHE_FLASH_ATTR lua_tocfunction (lua_State *L, int idx) { +LUA_API lua_CFunction lua_tocfunction (lua_State *L, int idx) { StkId o = index2adr(L, idx); return (!iscfunction(o)) ? NULL : clvalue(o)->c.f; } -LUA_API void *ICACHE_FLASH_ATTR lua_touserdata (lua_State *L, int idx) { +LUA_API void *lua_touserdata (lua_State *L, int idx) { StkId o = index2adr(L, idx); switch (ttype(o)) { case LUA_TUSERDATA: return (rawuvalue(o) + 1); @@ -398,13 +398,13 @@ LUA_API void *ICACHE_FLASH_ATTR lua_touserdata (lua_State *L, int idx) { } -LUA_API lua_State *ICACHE_FLASH_ATTR lua_tothread (lua_State *L, int idx) { +LUA_API lua_State *lua_tothread (lua_State *L, int idx) { StkId o = index2adr(L, idx); return (!ttisthread(o)) ? NULL : thvalue(o); } -LUA_API const void *ICACHE_FLASH_ATTR lua_topointer (lua_State *L, int idx) { +LUA_API const void *lua_topointer (lua_State *L, int idx) { StkId o = index2adr(L, idx); switch (ttype(o)) { case LUA_TTABLE: return hvalue(o); @@ -427,7 +427,7 @@ LUA_API const void *ICACHE_FLASH_ATTR lua_topointer (lua_State *L, int idx) { */ -LUA_API void ICACHE_FLASH_ATTR lua_pushnil (lua_State *L) { +LUA_API void lua_pushnil (lua_State *L) { lua_lock(L); setnilvalue(L->top); api_incr_top(L); @@ -435,7 +435,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushnil (lua_State *L) { } -LUA_API void ICACHE_FLASH_ATTR lua_pushnumber (lua_State *L, lua_Number n) { +LUA_API void lua_pushnumber (lua_State *L, lua_Number n) { lua_lock(L); setnvalue(L->top, n); api_incr_top(L); @@ -443,7 +443,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushnumber (lua_State *L, lua_Number n) { } -LUA_API void ICACHE_FLASH_ATTR lua_pushinteger (lua_State *L, lua_Integer n) { +LUA_API void lua_pushinteger (lua_State *L, lua_Integer n) { lua_lock(L); setnvalue(L->top, cast_num(n)); api_incr_top(L); @@ -451,7 +451,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushinteger (lua_State *L, lua_Integer n) { } -LUA_API void ICACHE_FLASH_ATTR lua_pushlstring (lua_State *L, const char *s, size_t len) { +LUA_API void lua_pushlstring (lua_State *L, const char *s, size_t len) { lua_lock(L); luaC_checkGC(L); setsvalue2s(L, L->top, luaS_newlstr(L, s, len)); @@ -460,7 +460,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushlstring (lua_State *L, const char *s, siz } -LUA_API void ICACHE_FLASH_ATTR lua_pushrolstring (lua_State *L, const char *s, size_t len) { +LUA_API void lua_pushrolstring (lua_State *L, const char *s, size_t len) { lua_lock(L); luaC_checkGC(L); setsvalue2s(L, L->top, luaS_newrolstr(L, s, len)); @@ -469,7 +469,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushrolstring (lua_State *L, const char *s, s } -LUA_API void ICACHE_FLASH_ATTR lua_pushstring (lua_State *L, const char *s) { +LUA_API void lua_pushstring (lua_State *L, const char *s) { if (s == NULL) lua_pushnil(L); else @@ -477,7 +477,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushstring (lua_State *L, const char *s) { } -LUA_API const char *ICACHE_FLASH_ATTR lua_pushvfstring (lua_State *L, const char *fmt, +LUA_API const char *lua_pushvfstring (lua_State *L, const char *fmt, va_list argp) { const char *ret; lua_lock(L); @@ -488,7 +488,7 @@ LUA_API const char *ICACHE_FLASH_ATTR lua_pushvfstring (lua_State *L, const char } -LUA_API const char *ICACHE_FLASH_ATTR lua_pushfstring (lua_State *L, const char *fmt, ...) { +LUA_API const char *lua_pushfstring (lua_State *L, const char *fmt, ...) { const char *ret; va_list argp; lua_lock(L); @@ -501,7 +501,7 @@ LUA_API const char *ICACHE_FLASH_ATTR lua_pushfstring (lua_State *L, const char } -LUA_API void ICACHE_FLASH_ATTR lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { +LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { Closure *cl; lua_lock(L); luaC_checkGC(L); @@ -518,7 +518,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushcclosure (lua_State *L, lua_CFunction fn, } -LUA_API void ICACHE_FLASH_ATTR lua_pushboolean (lua_State *L, int b) { +LUA_API void lua_pushboolean (lua_State *L, int b) { lua_lock(L); setbvalue(L->top, (b != 0)); /* ensure that true is 1 */ api_incr_top(L); @@ -526,21 +526,21 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushboolean (lua_State *L, int b) { } -LUA_API void ICACHE_FLASH_ATTR lua_pushlightuserdata (lua_State *L, void *p) { +LUA_API void lua_pushlightuserdata (lua_State *L, void *p) { lua_lock(L); setpvalue(L->top, p); api_incr_top(L); lua_unlock(L); } -LUA_API void ICACHE_FLASH_ATTR lua_pushrotable (lua_State *L, void *p) { +LUA_API void lua_pushrotable (lua_State *L, void *p) { lua_lock(L); setrvalue(L->top, p); api_incr_top(L); lua_unlock(L); } -LUA_API void ICACHE_FLASH_ATTR lua_pushlightfunction(lua_State *L, void *p) { +LUA_API void lua_pushlightfunction(lua_State *L, void *p) { lua_lock(L); setfvalue(L->top, p); api_incr_top(L); @@ -548,7 +548,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_pushlightfunction(lua_State *L, void *p) { } -LUA_API int ICACHE_FLASH_ATTR lua_pushthread (lua_State *L) { +LUA_API int lua_pushthread (lua_State *L) { lua_lock(L); setthvalue(L, L->top, L); api_incr_top(L); @@ -563,7 +563,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_pushthread (lua_State *L) { */ -LUA_API void ICACHE_FLASH_ATTR lua_gettable (lua_State *L, int idx) { +LUA_API void lua_gettable (lua_State *L, int idx) { StkId t; lua_lock(L); t = index2adr(L, idx); @@ -573,7 +573,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_gettable (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_getfield (lua_State *L, int idx, const char *k) { +LUA_API void lua_getfield (lua_State *L, int idx, const char *k) { StkId t; TValue key; lua_lock(L); @@ -588,7 +588,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_getfield (lua_State *L, int idx, const char * } -LUA_API void ICACHE_FLASH_ATTR lua_rawget (lua_State *L, int idx) { +LUA_API void lua_rawget (lua_State *L, int idx) { StkId t; const TValue *res; lua_lock(L); @@ -600,7 +600,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_rawget (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_rawgeti (lua_State *L, int idx, int n) { +LUA_API void lua_rawgeti (lua_State *L, int idx, int n) { StkId o; lua_lock(L); o = index2adr(L, idx); @@ -611,7 +611,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_rawgeti (lua_State *L, int idx, int n) { } -LUA_API void ICACHE_FLASH_ATTR lua_createtable (lua_State *L, int narray, int nrec) { +LUA_API void lua_createtable (lua_State *L, int narray, int nrec) { lua_lock(L); luaC_checkGC(L); sethvalue(L, L->top, luaH_new(L, narray, nrec)); @@ -620,7 +620,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_createtable (lua_State *L, int narray, int nr } -LUA_API int ICACHE_FLASH_ATTR lua_getmetatable (lua_State *L, int objindex) { +LUA_API int lua_getmetatable (lua_State *L, int objindex) { const TValue *obj; Table *mt = NULL; int res; @@ -655,7 +655,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_getmetatable (lua_State *L, int objindex) { } -LUA_API void ICACHE_FLASH_ATTR lua_getfenv (lua_State *L, int idx) { +LUA_API void lua_getfenv (lua_State *L, int idx) { StkId o; lua_lock(L); o = index2adr(L, idx); @@ -684,7 +684,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_getfenv (lua_State *L, int idx) { */ -LUA_API void ICACHE_FLASH_ATTR lua_settable (lua_State *L, int idx) { +LUA_API void lua_settable (lua_State *L, int idx) { StkId t; lua_lock(L); api_checknelems(L, 2); @@ -696,7 +696,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_settable (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_setfield (lua_State *L, int idx, const char *k) { +LUA_API void lua_setfield (lua_State *L, int idx, const char *k) { StkId t; lua_lock(L); api_checknelems(L, 1); @@ -710,7 +710,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_setfield (lua_State *L, int idx, const char * } -LUA_API void ICACHE_FLASH_ATTR lua_rawset (lua_State *L, int idx) { +LUA_API void lua_rawset (lua_State *L, int idx) { StkId t; lua_lock(L); api_checknelems(L, 2); @@ -725,7 +725,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_rawset (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_rawseti (lua_State *L, int idx, int n) { +LUA_API void lua_rawseti (lua_State *L, int idx, int n) { StkId o; lua_lock(L); api_checknelems(L, 1); @@ -740,7 +740,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_rawseti (lua_State *L, int idx, int n) { } -LUA_API int ICACHE_FLASH_ATTR lua_setmetatable (lua_State *L, int objindex) { +LUA_API int lua_setmetatable (lua_State *L, int objindex) { TValue *obj; Table *mt; int isrometa = 0; @@ -783,7 +783,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_setmetatable (lua_State *L, int objindex) { } -LUA_API int ICACHE_FLASH_ATTR lua_setfenv (lua_State *L, int idx) { +LUA_API int lua_setfenv (lua_State *L, int idx) { StkId o; int res = 1; lua_lock(L); @@ -825,7 +825,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_setfenv (lua_State *L, int idx) { api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) -LUA_API void ICACHE_FLASH_ATTR lua_call (lua_State *L, int nargs, int nresults) { +LUA_API void lua_call (lua_State *L, int nargs, int nresults) { StkId func; lua_lock(L); api_checknelems(L, nargs+1); @@ -847,14 +847,14 @@ struct CallS { /* data to `f_call' */ }; -static void ICACHE_FLASH_ATTR f_call (lua_State *L, void *ud) { +static void f_call (lua_State *L, void *ud) { struct CallS *c = cast(struct CallS *, ud); luaD_call(L, c->func, c->nresults); } -LUA_API int ICACHE_FLASH_ATTR lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { +LUA_API int lua_pcall (lua_State *L, int nargs, int nresults, int errfunc) { struct CallS c; int status; ptrdiff_t func; @@ -886,7 +886,7 @@ struct CCallS { /* data to `f_Ccall' */ }; -static void ICACHE_FLASH_ATTR f_Ccall (lua_State *L, void *ud) { +static void f_Ccall (lua_State *L, void *ud) { struct CCallS *c = cast(struct CCallS *, ud); Closure *cl; cl = luaF_newCclosure(L, 0, getcurrenv(L)); @@ -899,7 +899,7 @@ static void ICACHE_FLASH_ATTR f_Ccall (lua_State *L, void *ud) { } -LUA_API int ICACHE_FLASH_ATTR lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { +LUA_API int lua_cpcall (lua_State *L, lua_CFunction func, void *ud) { struct CCallS c; int status; lua_lock(L); @@ -911,7 +911,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_cpcall (lua_State *L, lua_CFunction func, void } -LUA_API int ICACHE_FLASH_ATTR lua_load (lua_State *L, lua_Reader reader, void *data, +LUA_API int lua_load (lua_State *L, lua_Reader reader, void *data, const char *chunkname) { ZIO z; int status; @@ -924,7 +924,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_load (lua_State *L, lua_Reader reader, void *d } -LUA_API int ICACHE_FLASH_ATTR lua_dump (lua_State *L, lua_Writer writer, void *data) { +LUA_API int lua_dump (lua_State *L, lua_Writer writer, void *data) { int status; TValue *o; lua_lock(L); @@ -939,7 +939,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_dump (lua_State *L, lua_Writer writer, void *d } -LUA_API int ICACHE_FLASH_ATTR lua_status (lua_State *L) { +LUA_API int lua_status (lua_State *L) { return L->status; } @@ -948,7 +948,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_status (lua_State *L) { ** Garbage-collection function */ -LUA_API int ICACHE_FLASH_ATTR lua_gc (lua_State *L, int what, int data) { +LUA_API int lua_gc (lua_State *L, int what, int data) { int res = 0; global_State *g; lua_lock(L); @@ -1035,7 +1035,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_gc (lua_State *L, int what, int data) { */ -LUA_API int ICACHE_FLASH_ATTR lua_error (lua_State *L) { +LUA_API int lua_error (lua_State *L) { lua_lock(L); api_checknelems(L, 1); luaG_errormsg(L); @@ -1044,7 +1044,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_error (lua_State *L) { } -LUA_API int ICACHE_FLASH_ATTR lua_next (lua_State *L, int idx) { +LUA_API int lua_next (lua_State *L, int idx) { StkId t; int more; lua_lock(L); @@ -1061,7 +1061,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_next (lua_State *L, int idx) { } -LUA_API void ICACHE_FLASH_ATTR lua_concat (lua_State *L, int n) { +LUA_API void lua_concat (lua_State *L, int n) { lua_lock(L); api_checknelems(L, n); if (n >= 2) { @@ -1078,7 +1078,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_concat (lua_State *L, int n) { } -LUA_API lua_Alloc ICACHE_FLASH_ATTR lua_getallocf (lua_State *L, void **ud) { +LUA_API lua_Alloc lua_getallocf (lua_State *L, void **ud) { lua_Alloc f; lua_lock(L); if (ud) *ud = G(L)->ud; @@ -1088,7 +1088,7 @@ LUA_API lua_Alloc ICACHE_FLASH_ATTR lua_getallocf (lua_State *L, void **ud) { } -LUA_API void ICACHE_FLASH_ATTR lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { +LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud) { lua_lock(L); G(L)->ud = ud; G(L)->frealloc = f; @@ -1096,7 +1096,7 @@ LUA_API void ICACHE_FLASH_ATTR lua_setallocf (lua_State *L, lua_Alloc f, void *u } -LUA_API void *ICACHE_FLASH_ATTR lua_newuserdata (lua_State *L, size_t size) { +LUA_API void *lua_newuserdata (lua_State *L, size_t size) { Udata *u; lua_lock(L); luaC_checkGC(L); @@ -1110,7 +1110,7 @@ LUA_API void *ICACHE_FLASH_ATTR lua_newuserdata (lua_State *L, size_t size) { -static const char *ICACHE_FLASH_ATTR aux_upvalue (StkId fi, int n, TValue **val) { +static const char *aux_upvalue (StkId fi, int n, TValue **val) { Closure *f; if (!ttisfunction(fi)) return NULL; f = clvalue(fi); @@ -1128,7 +1128,7 @@ static const char *ICACHE_FLASH_ATTR aux_upvalue (StkId fi, int n, TValue **val) } -LUA_API const char *ICACHE_FLASH_ATTR lua_getupvalue (lua_State *L, int funcindex, int n) { +LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n) { const char *name; TValue *val; lua_lock(L); @@ -1142,7 +1142,7 @@ LUA_API const char *ICACHE_FLASH_ATTR lua_getupvalue (lua_State *L, int funcinde } -LUA_API const char *ICACHE_FLASH_ATTR lua_setupvalue (lua_State *L, int funcindex, int n) { +LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n) { const char *name; TValue *val; StkId fi; diff --git a/app/lua/lauxlib.c b/app/lua/lauxlib.c index a7b6f6a6..fedd7c56 100644 --- a/app/lua/lauxlib.c +++ b/app/lua/lauxlib.c @@ -49,7 +49,7 @@ */ -LUALIB_API int ICACHE_FLASH_ATTR luaL_argerror (lua_State *L, int narg, const char *extramsg) { +LUALIB_API int luaL_argerror (lua_State *L, int narg, const char *extramsg) { lua_Debug ar; if (!lua_getstack(L, 0, &ar)) /* no stack frame? */ return luaL_error(L, "bad argument #%d (%s)", narg, extramsg); @@ -67,19 +67,19 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_argerror (lua_State *L, int narg, const ch } -LUALIB_API int ICACHE_FLASH_ATTR luaL_typerror (lua_State *L, int narg, const char *tname) { +LUALIB_API int luaL_typerror (lua_State *L, int narg, const char *tname) { const char *msg = lua_pushfstring(L, "%s expected, got %s", tname, luaL_typename(L, narg)); return luaL_argerror(L, narg, msg); } -static void ICACHE_FLASH_ATTR tag_error (lua_State *L, int narg, int tag) { +static void tag_error (lua_State *L, int narg, int tag) { luaL_typerror(L, narg, lua_typename(L, tag)); } -LUALIB_API void ICACHE_FLASH_ATTR luaL_where (lua_State *L, int level) { +LUALIB_API void luaL_where (lua_State *L, int level) { lua_Debug ar; if (lua_getstack(L, level, &ar)) { /* check function at level */ lua_getinfo(L, "Sl", &ar); /* get info about it */ @@ -92,7 +92,7 @@ LUALIB_API void ICACHE_FLASH_ATTR luaL_where (lua_State *L, int level) { } -LUALIB_API int ICACHE_FLASH_ATTR luaL_error (lua_State *L, const char *fmt, ...) { +LUALIB_API int luaL_error (lua_State *L, const char *fmt, ...) { va_list argp; va_start(argp, fmt); luaL_where(L, 1); @@ -105,7 +105,7 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_error (lua_State *L, const char *fmt, ...) /* }====================================================== */ -LUALIB_API int ICACHE_FLASH_ATTR luaL_checkoption (lua_State *L, int narg, const char *def, +LUALIB_API int luaL_checkoption (lua_State *L, int narg, const char *def, const char *const lst[]) { const char *name = (def) ? luaL_optstring(L, narg, def) : luaL_checkstring(L, narg); @@ -118,7 +118,7 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_checkoption (lua_State *L, int narg, const } -LUALIB_API int ICACHE_FLASH_ATTR luaL_newmetatable (lua_State *L, const char *tname) { +LUALIB_API int luaL_newmetatable (lua_State *L, const char *tname) { lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ if (!lua_isnil(L, -1)) /* name already in use? */ return 0; /* leave previous value on top, but return 0 */ @@ -129,7 +129,7 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_newmetatable (lua_State *L, const char *tn return 1; } -LUALIB_API int ICACHE_FLASH_ATTR luaL_rometatable (lua_State *L, const char* tname, void *p) { +LUALIB_API int luaL_rometatable (lua_State *L, const char* tname, void *p) { lua_getfield(L, LUA_REGISTRYINDEX, tname); /* get registry.name */ if (!lua_isnil(L, -1)) /* name already in use? */ return 0; /* leave previous value on top, but return 0 */ @@ -140,7 +140,7 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_rometatable (lua_State *L, const char* tna return 1; } -LUALIB_API void *ICACHE_FLASH_ATTR luaL_checkudata (lua_State *L, int ud, const char *tname) { +LUALIB_API void *luaL_checkudata (lua_State *L, int ud, const char *tname) { void *p = lua_touserdata(L, ud); if (p != NULL) { /* value is a userdata? */ if (lua_getmetatable(L, ud)) { /* does it have a metatable? */ @@ -156,18 +156,18 @@ LUALIB_API void *ICACHE_FLASH_ATTR luaL_checkudata (lua_State *L, int ud, const } -LUALIB_API void ICACHE_FLASH_ATTR luaL_checkstack (lua_State *L, int space, const char *mes) { +LUALIB_API void luaL_checkstack (lua_State *L, int space, const char *mes) { if (!lua_checkstack(L, space)) luaL_error(L, "stack overflow (%s)", mes); } -LUALIB_API void ICACHE_FLASH_ATTR luaL_checktype (lua_State *L, int narg, int t) { +LUALIB_API void luaL_checktype (lua_State *L, int narg, int t) { if (lua_type(L, narg) != t) tag_error(L, narg, t); } -LUALIB_API void ICACHE_FLASH_ATTR luaL_checkanyfunction (lua_State *L, int narg) { +LUALIB_API void luaL_checkanyfunction (lua_State *L, int narg) { if (lua_type(L, narg) != LUA_TFUNCTION && lua_type(L, narg) != LUA_TLIGHTFUNCTION) { const char *msg = lua_pushfstring(L, "function or lightfunction expected, got %s", luaL_typename(L, narg)); @@ -175,7 +175,7 @@ LUALIB_API void ICACHE_FLASH_ATTR luaL_checkanyfunction (lua_State *L, int narg) } } -LUALIB_API void ICACHE_FLASH_ATTR luaL_checkanytable (lua_State *L, int narg) { +LUALIB_API void luaL_checkanytable (lua_State *L, int narg) { if (lua_type(L, narg) != LUA_TTABLE && lua_type(L, narg) != LUA_TROTABLE) { const char *msg = lua_pushfstring(L, "table or rotable expected, got %s", luaL_typename(L, narg)); @@ -184,20 +184,20 @@ LUALIB_API void ICACHE_FLASH_ATTR luaL_checkanytable (lua_State *L, int narg) { } -LUALIB_API void ICACHE_FLASH_ATTR luaL_checkany (lua_State *L, int narg) { +LUALIB_API void luaL_checkany (lua_State *L, int narg) { if (lua_type(L, narg) == LUA_TNONE) luaL_argerror(L, narg, "value expected"); } -LUALIB_API const char *ICACHE_FLASH_ATTR luaL_checklstring (lua_State *L, int narg, size_t *len) { +LUALIB_API const char *luaL_checklstring (lua_State *L, int narg, size_t *len) { const char *s = lua_tolstring(L, narg, len); if (!s) tag_error(L, narg, LUA_TSTRING); return s; } -LUALIB_API const char *ICACHE_FLASH_ATTR luaL_optlstring (lua_State *L, int narg, +LUALIB_API const char *luaL_optlstring (lua_State *L, int narg, const char *def, size_t *len) { if (lua_isnoneornil(L, narg)) { if (len) @@ -208,7 +208,7 @@ LUALIB_API const char *ICACHE_FLASH_ATTR luaL_optlstring (lua_State *L, int narg } -LUALIB_API lua_Number ICACHE_FLASH_ATTR luaL_checknumber (lua_State *L, int narg) { +LUALIB_API lua_Number luaL_checknumber (lua_State *L, int narg) { lua_Number d = lua_tonumber(L, narg); if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ tag_error(L, narg, LUA_TNUMBER); @@ -216,12 +216,12 @@ LUALIB_API lua_Number ICACHE_FLASH_ATTR luaL_checknumber (lua_State *L, int narg } -LUALIB_API lua_Number ICACHE_FLASH_ATTR luaL_optnumber (lua_State *L, int narg, lua_Number def) { +LUALIB_API lua_Number luaL_optnumber (lua_State *L, int narg, lua_Number def) { return luaL_opt(L, luaL_checknumber, narg, def); } -LUALIB_API lua_Integer ICACHE_FLASH_ATTR luaL_checkinteger (lua_State *L, int narg) { +LUALIB_API lua_Integer luaL_checkinteger (lua_State *L, int narg) { lua_Integer d = lua_tointeger(L, narg); if (d == 0 && !lua_isnumber(L, narg)) /* avoid extra test when d is not 0 */ tag_error(L, narg, LUA_TNUMBER); @@ -229,13 +229,13 @@ LUALIB_API lua_Integer ICACHE_FLASH_ATTR luaL_checkinteger (lua_State *L, int na } -LUALIB_API lua_Integer ICACHE_FLASH_ATTR luaL_optinteger (lua_State *L, int narg, +LUALIB_API lua_Integer luaL_optinteger (lua_State *L, int narg, lua_Integer def) { return luaL_opt(L, luaL_checkinteger, narg, def); } -LUALIB_API int ICACHE_FLASH_ATTR luaL_getmetafield (lua_State *L, int obj, const char *event) { +LUALIB_API int luaL_getmetafield (lua_State *L, int obj, const char *event) { if (!lua_getmetatable(L, obj)) /* no metatable? */ return 0; lua_pushstring(L, event); @@ -251,7 +251,7 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_getmetafield (lua_State *L, int obj, const } -LUALIB_API int ICACHE_FLASH_ATTR luaL_callmeta (lua_State *L, int obj, const char *event) { +LUALIB_API int luaL_callmeta (lua_State *L, int obj, const char *event) { obj = abs_index(L, obj); if (!luaL_getmetafield(L, obj, event)) /* no metafield? */ return 0; @@ -261,12 +261,12 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_callmeta (lua_State *L, int obj, const cha } -LUALIB_API void ICACHE_FLASH_ATTR (luaL_register) (lua_State *L, const char *libname, +LUALIB_API void (luaL_register) (lua_State *L, const char *libname, const luaL_Reg *l) { luaI_openlib(L, libname, l, 0, LUA_USECCLOSURES); } -LUALIB_API void ICACHE_FLASH_ATTR (luaL_register_light) (lua_State *L, const char *libname, +LUALIB_API void (luaL_register_light) (lua_State *L, const char *libname, const luaL_Reg *l) { #if LUA_OPTIMIZE_MEMORY > 0 luaI_openlib(L, libname, l, 0, LUA_USELIGHTFUNCTIONS); @@ -275,14 +275,14 @@ LUALIB_API void ICACHE_FLASH_ATTR (luaL_register_light) (lua_State *L, const cha #endif } -static int ICACHE_FLASH_ATTR libsize (const luaL_Reg *l) { +static int libsize (const luaL_Reg *l) { int size = 0; for (; l->name; l++) size++; return size; } -LUALIB_API void ICACHE_FLASH_ATTR luaI_openlib (lua_State *L, const char *libname, +LUALIB_API void luaI_openlib (lua_State *L, const char *libname, const luaL_Reg *l, int nup, int ftype) { if (libname) { int size = libsize(l); @@ -323,14 +323,14 @@ LUALIB_API void ICACHE_FLASH_ATTR luaI_openlib (lua_State *L, const char *libnam #if defined(LUA_COMPAT_GETN) -static int ICACHE_FLASH_ATTR checkint (lua_State *L, int topop) { +static int checkint (lua_State *L, int topop) { int n = (lua_type(L, -1) == LUA_TNUMBER) ? lua_tointeger(L, -1) : -1; lua_pop(L, topop); return n; } -static void ICACHE_FLASH_ATTR getsizes (lua_State *L) { +static void getsizes (lua_State *L) { lua_getfield(L, LUA_REGISTRYINDEX, "LUA_SIZES"); if (lua_isnil(L, -1)) { /* no `size' table? */ lua_pop(L, 1); /* remove nil */ @@ -345,7 +345,7 @@ static void ICACHE_FLASH_ATTR getsizes (lua_State *L) { } -LUALIB_API void ICACHE_FLASH_ATTR luaL_setn (lua_State *L, int t, int n) { +LUALIB_API void luaL_setn (lua_State *L, int t, int n) { t = abs_index(L, t); lua_pushliteral(L, "n"); lua_rawget(L, t); @@ -364,7 +364,7 @@ LUALIB_API void ICACHE_FLASH_ATTR luaL_setn (lua_State *L, int t, int n) { } -LUALIB_API int ICACHE_FLASH_ATTR luaL_getn (lua_State *L, int t) { +LUALIB_API int luaL_getn (lua_State *L, int t) { int n; t = abs_index(L, t); lua_pushliteral(L, "n"); /* try t.n */ @@ -383,7 +383,7 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_getn (lua_State *L, int t) { -LUALIB_API const char *ICACHE_FLASH_ATTR luaL_gsub (lua_State *L, const char *s, const char *p, +LUALIB_API const char *luaL_gsub (lua_State *L, const char *s, const char *p, const char *r) { const char *wild; size_t l = c_strlen(p); @@ -400,7 +400,7 @@ LUALIB_API const char *ICACHE_FLASH_ATTR luaL_gsub (lua_State *L, const char *s, } -LUALIB_API const char *ICACHE_FLASH_ATTR luaL_findtable (lua_State *L, int idx, +LUALIB_API const char *luaL_findtable (lua_State *L, int idx, const char *fname, int szhint) { const char *e; lua_pushvalue(L, idx); @@ -449,7 +449,7 @@ LUALIB_API const char *ICACHE_FLASH_ATTR luaL_findtable (lua_State *L, int idx, #define LIMIT (LUA_MINSTACK/2) -static int ICACHE_FLASH_ATTR emptybuffer (luaL_Buffer *B) { +static int emptybuffer (luaL_Buffer *B) { size_t l = bufflen(B); if (l == 0) return 0; /* put nothing on stack */ else { @@ -461,7 +461,7 @@ static int ICACHE_FLASH_ATTR emptybuffer (luaL_Buffer *B) { } -static void ICACHE_FLASH_ATTR adjuststack (luaL_Buffer *B) { +static void adjuststack (luaL_Buffer *B) { if (B->lvl > 1) { lua_State *L = B->L; int toget = 1; /* number of levels to concat */ @@ -480,32 +480,32 @@ static void ICACHE_FLASH_ATTR adjuststack (luaL_Buffer *B) { } -LUALIB_API char *ICACHE_FLASH_ATTR luaL_prepbuffer (luaL_Buffer *B) { +LUALIB_API char *luaL_prepbuffer (luaL_Buffer *B) { if (emptybuffer(B)) adjuststack(B); return B->buffer; } -LUALIB_API void ICACHE_FLASH_ATTR luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { +LUALIB_API void luaL_addlstring (luaL_Buffer *B, const char *s, size_t l) { while (l--) luaL_addchar(B, *s++); } -LUALIB_API void ICACHE_FLASH_ATTR luaL_addstring (luaL_Buffer *B, const char *s) { +LUALIB_API void luaL_addstring (luaL_Buffer *B, const char *s) { luaL_addlstring(B, s, c_strlen(s)); } -LUALIB_API void ICACHE_FLASH_ATTR luaL_pushresult (luaL_Buffer *B) { +LUALIB_API void luaL_pushresult (luaL_Buffer *B) { emptybuffer(B); lua_concat(B->L, B->lvl); B->lvl = 1; } -LUALIB_API void ICACHE_FLASH_ATTR luaL_addvalue (luaL_Buffer *B) { +LUALIB_API void luaL_addvalue (luaL_Buffer *B) { lua_State *L = B->L; size_t vl; const char *s = lua_tolstring(L, -1, &vl); @@ -523,7 +523,7 @@ LUALIB_API void ICACHE_FLASH_ATTR luaL_addvalue (luaL_Buffer *B) { } -LUALIB_API void ICACHE_FLASH_ATTR luaL_buffinit (lua_State *L, luaL_Buffer *B) { +LUALIB_API void luaL_buffinit (lua_State *L, luaL_Buffer *B) { B->L = L; B->p = B->buffer; B->lvl = 0; @@ -532,7 +532,7 @@ LUALIB_API void ICACHE_FLASH_ATTR luaL_buffinit (lua_State *L, luaL_Buffer *B) { /* }====================================================== */ -LUALIB_API int ICACHE_FLASH_ATTR luaL_ref (lua_State *L, int t) { +LUALIB_API int luaL_ref (lua_State *L, int t) { int ref; t = abs_index(L, t); if (lua_isnil(L, -1)) { @@ -555,7 +555,7 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_ref (lua_State *L, int t) { } -LUALIB_API void ICACHE_FLASH_ATTR luaL_unref (lua_State *L, int t, int ref) { +LUALIB_API void luaL_unref (lua_State *L, int t, int ref) { if (ref >= 0) { t = abs_index(L, t); lua_rawgeti(L, t, FREELIST_REF); @@ -582,7 +582,7 @@ typedef struct LoadF { } LoadF; -static const char *ICACHE_FLASH_ATTR getF (lua_State *L, void *ud, size_t *size) { +static const char *getF (lua_State *L, void *ud, size_t *size) { LoadF *lf = (LoadF *)ud; (void)L; if (lf->extraline) { @@ -596,7 +596,7 @@ static const char *ICACHE_FLASH_ATTR getF (lua_State *L, void *ud, size_t *size) } -static int ICACHE_FLASH_ATTR errfile (lua_State *L, const char *what, int fnameindex) { +static int errfile (lua_State *L, const char *what, int fnameindex) { const char *serr = c_strerror(errno); const char *filename = lua_tostring(L, fnameindex) + 1; lua_pushfstring(L, "cannot %s %s: %s", what, filename, serr); @@ -605,7 +605,7 @@ static int ICACHE_FLASH_ATTR errfile (lua_State *L, const char *what, int fnamei } -LUALIB_API int ICACHE_FLASH_ATTR luaL_loadfile (lua_State *L, const char *filename) { +LUALIB_API int luaL_loadfile (lua_State *L, const char *filename) { LoadF lf; int status, readstatus; int c; @@ -656,7 +656,7 @@ typedef struct LoadFSF { } LoadFSF; -static const char *ICACHE_FLASH_ATTR getFSF (lua_State *L, void *ud, size_t *size) { +static const char *getFSF (lua_State *L, void *ud, size_t *size) { LoadFSF *lf = (LoadFSF *)ud; (void)L; if (lf->extraline) { @@ -670,7 +670,7 @@ static const char *ICACHE_FLASH_ATTR getFSF (lua_State *L, void *ud, size_t *siz } -static int ICACHE_FLASH_ATTR errfsfile (lua_State *L, const char *what, int fnameindex) { +static int errfsfile (lua_State *L, const char *what, int fnameindex) { const char *filename = lua_tostring(L, fnameindex) + 1; lua_pushfstring(L, "cannot %s %s", what, filename); lua_remove(L, fnameindex); @@ -678,7 +678,7 @@ static int ICACHE_FLASH_ATTR errfsfile (lua_State *L, const char *what, int fnam } -LUALIB_API int ICACHE_FLASH_ATTR luaL_loadfsfile (lua_State *L, const char *filename) { +LUALIB_API int luaL_loadfsfile (lua_State *L, const char *filename) { LoadFSF lf; int status, readstatus; int c; @@ -722,7 +722,7 @@ typedef struct LoadS { } LoadS; -static const char *ICACHE_FLASH_ATTR getS (lua_State *L, void *ud, size_t *size) { +static const char *getS (lua_State *L, void *ud, size_t *size) { LoadS *ls = (LoadS *)ud; (void)L; if (L == NULL && size == NULL) // direct mode check @@ -734,7 +734,7 @@ static const char *ICACHE_FLASH_ATTR getS (lua_State *L, void *ud, size_t *size) } -LUALIB_API int ICACHE_FLASH_ATTR luaL_loadbuffer (lua_State *L, const char *buff, size_t size, +LUALIB_API int luaL_loadbuffer (lua_State *L, const char *buff, size_t size, const char *name) { LoadS ls; ls.s = buff; @@ -743,7 +743,7 @@ LUALIB_API int ICACHE_FLASH_ATTR luaL_loadbuffer (lua_State *L, const char *buff } -LUALIB_API int ICACHE_FLASH_ATTR (luaL_loadstring) (lua_State *L, const char *s) { +LUALIB_API int (luaL_loadstring) (lua_State *L, const char *s) { return luaL_loadbuffer(L, s, c_strlen(s), s); } @@ -752,7 +752,7 @@ LUALIB_API int ICACHE_FLASH_ATTR (luaL_loadstring) (lua_State *L, const char *s) /* }====================================================== */ -static int ICACHE_FLASH_ATTR l_check_memlimit(lua_State *L, size_t needbytes) { +static int l_check_memlimit(lua_State *L, size_t needbytes) { global_State *g = G(L); int cycle_count = 0; lu_mem limit = g->memlimit - needbytes; @@ -770,7 +770,7 @@ static int ICACHE_FLASH_ATTR l_check_memlimit(lua_State *L, size_t needbytes) { } -static void *ICACHE_FLASH_ATTR l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { +static void *l_alloc (void *ud, void *ptr, size_t osize, size_t nsize) { lua_State *L = (lua_State *)ud; int mode = L == NULL ? 0 : G(L)->egcmode; void *nptr; @@ -797,7 +797,7 @@ static void *ICACHE_FLASH_ATTR l_alloc (void *ud, void *ptr, size_t osize, size_ } -static int ICACHE_FLASH_ATTR panic (lua_State *L) { +static int panic (lua_State *L) { (void)L; /* to avoid warnings */ #if defined(LUA_USE_STDIO) c_fprintf(c_stderr, "PANIC: unprotected error in call to Lua API (%s)\n", @@ -810,7 +810,7 @@ static int ICACHE_FLASH_ATTR panic (lua_State *L) { } -LUALIB_API lua_State *ICACHE_FLASH_ATTR luaL_newstate (void) { +LUALIB_API lua_State *luaL_newstate (void) { lua_State *L = lua_newstate(l_alloc, NULL); lua_setallocf(L, l_alloc, L); /* allocator need lua_State. */ if (L) lua_atpanic(L, &panic); diff --git a/app/lua/lbaselib.c b/app/lua/lbaselib.c index eb809673..b7e328f0 100644 --- a/app/lua/lbaselib.c +++ b/app/lua/lbaselib.c @@ -29,7 +29,7 @@ ** model but changing `fputs' to put the strings at a proper place ** (a console window or a log file, for instance). */ -static int ICACHE_FLASH_ATTR luaB_print (lua_State *L) { +static int luaB_print (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ int i; lua_getglobal(L, "tostring"); @@ -60,7 +60,7 @@ static int ICACHE_FLASH_ATTR luaB_print (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_tonumber (lua_State *L) { +static int luaB_tonumber (lua_State *L) { int base = luaL_optint(L, 2, 10); if (base == 10) { /* standard conversion */ luaL_checkany(L, 1); @@ -88,7 +88,7 @@ static int ICACHE_FLASH_ATTR luaB_tonumber (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_error (lua_State *L) { +static int luaB_error (lua_State *L) { int level = luaL_optint(L, 2, 1); lua_settop(L, 1); if (lua_isstring(L, 1) && level > 0) { /* add extra information? */ @@ -100,7 +100,7 @@ static int ICACHE_FLASH_ATTR luaB_error (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_getmetatable (lua_State *L) { +static int luaB_getmetatable (lua_State *L) { luaL_checkany(L, 1); if (!lua_getmetatable(L, 1)) { lua_pushnil(L); @@ -111,7 +111,7 @@ static int ICACHE_FLASH_ATTR luaB_getmetatable (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_setmetatable (lua_State *L) { +static int luaB_setmetatable (lua_State *L) { int t = lua_type(L, 2); luaL_checktype(L, 1, LUA_TTABLE); luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE || t == LUA_TROTABLE, 2, @@ -124,7 +124,7 @@ static int ICACHE_FLASH_ATTR luaB_setmetatable (lua_State *L) { } -static void ICACHE_FLASH_ATTR getfunc (lua_State *L, int opt) { +static void getfunc (lua_State *L, int opt) { if (lua_isfunction(L, 1)) lua_pushvalue(L, 1); else { lua_Debug ar; @@ -140,7 +140,7 @@ static void ICACHE_FLASH_ATTR getfunc (lua_State *L, int opt) { } -static int ICACHE_FLASH_ATTR luaB_getfenv (lua_State *L) { +static int luaB_getfenv (lua_State *L) { getfunc(L, 1); if (lua_iscfunction(L, -1)) /* is a C function? */ lua_pushvalue(L, LUA_GLOBALSINDEX); /* return the thread's global env. */ @@ -150,7 +150,7 @@ static int ICACHE_FLASH_ATTR luaB_getfenv (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_setfenv (lua_State *L) { +static int luaB_setfenv (lua_State *L) { luaL_checktype(L, 2, LUA_TTABLE); getfunc(L, 0); lua_pushvalue(L, 2); @@ -168,7 +168,7 @@ static int ICACHE_FLASH_ATTR luaB_setfenv (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_rawequal (lua_State *L) { +static int luaB_rawequal (lua_State *L) { luaL_checkany(L, 1); luaL_checkany(L, 2); lua_pushboolean(L, lua_rawequal(L, 1, 2)); @@ -176,7 +176,7 @@ static int ICACHE_FLASH_ATTR luaB_rawequal (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_rawget (lua_State *L) { +static int luaB_rawget (lua_State *L) { luaL_checkanytable(L, 1); luaL_checkany(L, 2); lua_settop(L, 2); @@ -184,7 +184,7 @@ static int ICACHE_FLASH_ATTR luaB_rawget (lua_State *L) { return 1; } -static int ICACHE_FLASH_ATTR luaB_rawset (lua_State *L) { +static int luaB_rawset (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); luaL_checkany(L, 2); luaL_checkany(L, 3); @@ -194,13 +194,13 @@ static int ICACHE_FLASH_ATTR luaB_rawset (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_gcinfo (lua_State *L) { +static int luaB_gcinfo (lua_State *L) { lua_pushinteger(L, lua_getgccount(L)); return 1; } -static int ICACHE_FLASH_ATTR luaB_collectgarbage (lua_State *L) { +static int luaB_collectgarbage (lua_State *L) { static const char *const opts[] = {"stop", "restart", "collect", "count", "step", "setpause", "setstepmul","setmemlimit","getmemlimit", NULL}; static const int optsnum[] = {LUA_GCSTOP, LUA_GCRESTART, LUA_GCCOLLECT, @@ -227,14 +227,14 @@ static int ICACHE_FLASH_ATTR luaB_collectgarbage (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_type (lua_State *L) { +static int luaB_type (lua_State *L) { luaL_checkany(L, 1); lua_pushstring(L, luaL_typename(L, 1)); return 1; } -static int ICACHE_FLASH_ATTR luaB_next (lua_State *L) { +static int luaB_next (lua_State *L) { luaL_checkanytable(L, 1); lua_settop(L, 2); /* create a 2nd argument if there isn't one */ if (lua_next(L, 1)) @@ -246,7 +246,7 @@ static int ICACHE_FLASH_ATTR luaB_next (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_pairs (lua_State *L) { +static int luaB_pairs (lua_State *L) { luaL_checkanytable(L, 1); lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ lua_pushvalue(L, 1); /* state, */ @@ -255,7 +255,7 @@ static int ICACHE_FLASH_ATTR luaB_pairs (lua_State *L) { } -static int ICACHE_FLASH_ATTR ipairsaux (lua_State *L) { +static int ipairsaux (lua_State *L) { int i = luaL_checkint(L, 2); luaL_checkanytable(L, 1); i++; /* next value */ @@ -265,7 +265,7 @@ static int ICACHE_FLASH_ATTR ipairsaux (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_ipairs (lua_State *L) { +static int luaB_ipairs (lua_State *L) { luaL_checkanytable(L, 1); lua_pushvalue(L, lua_upvalueindex(1)); /* return generator, */ lua_pushvalue(L, 1); /* state, */ @@ -274,7 +274,7 @@ static int ICACHE_FLASH_ATTR luaB_ipairs (lua_State *L) { } -static int ICACHE_FLASH_ATTR load_aux (lua_State *L, int status) { +static int load_aux (lua_State *L, int status) { if (status == 0) /* OK? */ return 1; else { @@ -285,7 +285,7 @@ static int ICACHE_FLASH_ATTR load_aux (lua_State *L, int status) { } -static int ICACHE_FLASH_ATTR luaB_loadstring (lua_State *L) { +static int luaB_loadstring (lua_State *L) { size_t l; const char *s = luaL_checklstring(L, 1, &l); const char *chunkname = luaL_optstring(L, 2, s); @@ -293,7 +293,7 @@ static int ICACHE_FLASH_ATTR luaB_loadstring (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_loadfile (lua_State *L) { +static int luaB_loadfile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); #if 0 return load_aux(L, luaL_loadfile(L, fname)); @@ -309,7 +309,7 @@ static int ICACHE_FLASH_ATTR luaB_loadfile (lua_State *L) { ** stack top. Instead, it keeps its resulting string in a ** reserved slot inside the stack. */ -static const char *ICACHE_FLASH_ATTR generic_reader (lua_State *L, void *ud, size_t *size) { +static const char *generic_reader (lua_State *L, void *ud, size_t *size) { (void)ud; /* to avoid warnings */ if (L == NULL && size == NULL) // direct mode check, doesn't happen return NULL; @@ -329,7 +329,7 @@ static const char *ICACHE_FLASH_ATTR generic_reader (lua_State *L, void *ud, siz } -static int ICACHE_FLASH_ATTR luaB_load (lua_State *L) { +static int luaB_load (lua_State *L) { int status; const char *cname = luaL_optstring(L, 2, "=(load)"); luaL_checktype(L, 1, LUA_TFUNCTION); @@ -339,7 +339,7 @@ static int ICACHE_FLASH_ATTR luaB_load (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_dofile (lua_State *L) { +static int luaB_dofile (lua_State *L) { const char *fname = luaL_optstring(L, 1, NULL); int n = lua_gettop(L); #if 0 @@ -352,7 +352,7 @@ static int ICACHE_FLASH_ATTR luaB_dofile (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_assert (lua_State *L) { +static int luaB_assert (lua_State *L) { luaL_checkany(L, 1); if (!lua_toboolean(L, 1)) return luaL_error(L, "%s", luaL_optstring(L, 2, "assertion failed!")); @@ -360,7 +360,7 @@ static int ICACHE_FLASH_ATTR luaB_assert (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_unpack (lua_State *L) { +static int luaB_unpack (lua_State *L) { int i, e, n; luaL_checktype(L, 1, LUA_TTABLE); i = luaL_optint(L, 2, 1); @@ -376,7 +376,7 @@ static int ICACHE_FLASH_ATTR luaB_unpack (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_select (lua_State *L) { +static int luaB_select (lua_State *L) { int n = lua_gettop(L); if (lua_type(L, 1) == LUA_TSTRING && *lua_tostring(L, 1) == '#') { lua_pushinteger(L, n-1); @@ -392,7 +392,7 @@ static int ICACHE_FLASH_ATTR luaB_select (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_pcall (lua_State *L) { +static int luaB_pcall (lua_State *L) { int status; luaL_checkany(L, 1); status = lua_pcall(L, lua_gettop(L) - 1, LUA_MULTRET, 0); @@ -402,7 +402,7 @@ static int ICACHE_FLASH_ATTR luaB_pcall (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_xpcall (lua_State *L) { +static int luaB_xpcall (lua_State *L) { int status; luaL_checkany(L, 2); lua_settop(L, 2); @@ -414,7 +414,7 @@ static int ICACHE_FLASH_ATTR luaB_xpcall (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_tostring (lua_State *L) { +static int luaB_tostring (lua_State *L) { luaL_checkany(L, 1); if (luaL_callmeta(L, 1, "__tostring")) /* is there a metafield? */ return 1; /* use its value */ @@ -439,7 +439,7 @@ static int ICACHE_FLASH_ATTR luaB_tostring (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_newproxy (lua_State *L) { +static int luaB_newproxy (lua_State *L) { lua_settop(L, 1); lua_newuserdata(L, 0); /* create proxy */ if (lua_toboolean(L, 1) == 0) @@ -500,7 +500,7 @@ const LUA_REG_TYPE base_funcs_list[] = { #endif -static int ICACHE_FLASH_ATTR luaB_index(lua_State *L) { +static int luaB_index(lua_State *L) { #if LUA_OPTIMIZE_MEMORY == 2 int fres; if ((fres = luaR_findfunction(L, base_funcs_list)) != 0) @@ -546,7 +546,7 @@ static const luaL_Reg base_funcs[] = { static const char *const statnames[] = {"running", "suspended", "normal", "dead"}; -static int ICACHE_FLASH_ATTR costatus (lua_State *L, lua_State *co) { +static int costatus (lua_State *L, lua_State *co) { if (L == co) return CO_RUN; switch (lua_status(co)) { case LUA_YIELD: @@ -566,7 +566,7 @@ static int ICACHE_FLASH_ATTR costatus (lua_State *L, lua_State *co) { } -static int ICACHE_FLASH_ATTR luaB_costatus (lua_State *L) { +static int luaB_costatus (lua_State *L) { lua_State *co = lua_tothread(L, 1); luaL_argcheck(L, co, 1, "coroutine expected"); lua_pushstring(L, statnames[costatus(L, co)]); @@ -574,7 +574,7 @@ static int ICACHE_FLASH_ATTR luaB_costatus (lua_State *L) { } -static int ICACHE_FLASH_ATTR auxresume (lua_State *L, lua_State *co, int narg) { +static int auxresume (lua_State *L, lua_State *co, int narg) { int status = costatus(L, co); if (!lua_checkstack(co, narg)) luaL_error(L, "too many arguments to resume"); @@ -599,7 +599,7 @@ static int ICACHE_FLASH_ATTR auxresume (lua_State *L, lua_State *co, int narg) { } -static int ICACHE_FLASH_ATTR luaB_coresume (lua_State *L) { +static int luaB_coresume (lua_State *L) { lua_State *co = lua_tothread(L, 1); int r; luaL_argcheck(L, co, 1, "coroutine expected"); @@ -617,7 +617,7 @@ static int ICACHE_FLASH_ATTR luaB_coresume (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_auxwrap (lua_State *L) { +static int luaB_auxwrap (lua_State *L) { lua_State *co = lua_tothread(L, lua_upvalueindex(1)); int r = auxresume(L, co, lua_gettop(L)); if (r < 0) { @@ -632,7 +632,7 @@ static int ICACHE_FLASH_ATTR luaB_auxwrap (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_cocreate (lua_State *L) { +static int luaB_cocreate (lua_State *L) { lua_State *NL = lua_newthread(L); luaL_argcheck(L, lua_isfunction(L, 1) && !lua_iscfunction(L, 1), 1, "Lua function expected"); @@ -642,19 +642,19 @@ static int ICACHE_FLASH_ATTR luaB_cocreate (lua_State *L) { } -static int ICACHE_FLASH_ATTR luaB_cowrap (lua_State *L) { +static int luaB_cowrap (lua_State *L) { luaB_cocreate(L); lua_pushcclosure(L, luaB_auxwrap, 1); return 1; } -static int ICACHE_FLASH_ATTR luaB_yield (lua_State *L) { +static int luaB_yield (lua_State *L) { return lua_yield(L, lua_gettop(L)); } -static int ICACHE_FLASH_ATTR luaB_corunning (lua_State *L) { +static int luaB_corunning (lua_State *L) { if (lua_pushthread(L)) lua_pushnil(L); /* main thread is not a coroutine */ return 1; @@ -676,7 +676,7 @@ const LUA_REG_TYPE co_funcs[] = { /* }====================================================== */ -static void ICACHE_FLASH_ATTR auxopen (lua_State *L, const char *name, +static void auxopen (lua_State *L, const char *name, lua_CFunction f, lua_CFunction u) { lua_pushcfunction(L, u); lua_pushcclosure(L, f, 1); @@ -684,7 +684,7 @@ static void ICACHE_FLASH_ATTR auxopen (lua_State *L, const char *name, } -static void ICACHE_FLASH_ATTR base_open (lua_State *L) { +static void base_open (lua_State *L) { /* set global _G */ lua_pushvalue(L, LUA_GLOBALSINDEX); lua_setglobal(L, "_G"); @@ -711,7 +711,7 @@ static void ICACHE_FLASH_ATTR base_open (lua_State *L) { } -LUALIB_API int ICACHE_FLASH_ATTR luaopen_base (lua_State *L) { +LUALIB_API int luaopen_base (lua_State *L) { base_open(L); #if LUA_OPTIMIZE_MEMORY == 0 luaL_register(L, LUA_COLIBNAME, co_funcs); diff --git a/app/lua/lcode.c b/app/lua/lcode.c index 64b8bb36..f0282704 100644 --- a/app/lua/lcode.c +++ b/app/lua/lcode.c @@ -27,12 +27,12 @@ #define hasjumps(e) ((e)->t != (e)->f) -static int ICACHE_FLASH_ATTR isnumeral(expdesc *e) { +static int isnumeral(expdesc *e) { return (e->k == VKNUM && e->t == NO_JUMP && e->f == NO_JUMP); } -void ICACHE_FLASH_ATTR luaK_nil (FuncState *fs, int from, int n) { +void luaK_nil (FuncState *fs, int from, int n) { Instruction *previous; if (fs->pc > fs->lasttarget) { /* no jumps to current position? */ if (fs->pc == 0) { /* function start? */ @@ -56,7 +56,7 @@ void ICACHE_FLASH_ATTR luaK_nil (FuncState *fs, int from, int n) { } -int ICACHE_FLASH_ATTR luaK_jump (FuncState *fs) { +int luaK_jump (FuncState *fs) { int jpc = fs->jpc; /* save list of jumps to here */ int j; fs->jpc = NO_JUMP; @@ -66,18 +66,18 @@ int ICACHE_FLASH_ATTR luaK_jump (FuncState *fs) { } -void ICACHE_FLASH_ATTR luaK_ret (FuncState *fs, int first, int nret) { +void luaK_ret (FuncState *fs, int first, int nret) { luaK_codeABC(fs, OP_RETURN, first, nret+1, 0); } -static int ICACHE_FLASH_ATTR condjump (FuncState *fs, OpCode op, int A, int B, int C) { +static int condjump (FuncState *fs, OpCode op, int A, int B, int C) { luaK_codeABC(fs, op, A, B, C); return luaK_jump(fs); } -static void ICACHE_FLASH_ATTR fixjump (FuncState *fs, int pc, int dest) { +static void fixjump (FuncState *fs, int pc, int dest) { Instruction *jmp = &fs->f->code[pc]; int offset = dest-(pc+1); lua_assert(dest != NO_JUMP); @@ -91,13 +91,13 @@ static void ICACHE_FLASH_ATTR fixjump (FuncState *fs, int pc, int dest) { ** returns current `pc' and marks it as a jump target (to avoid wrong ** optimizations with consecutive instructions not in the same basic block). */ -int ICACHE_FLASH_ATTR luaK_getlabel (FuncState *fs) { +int luaK_getlabel (FuncState *fs) { fs->lasttarget = fs->pc; return fs->pc; } -static int ICACHE_FLASH_ATTR getjump (FuncState *fs, int pc) { +static int getjump (FuncState *fs, int pc) { int offset = GETARG_sBx(fs->f->code[pc]); if (offset == NO_JUMP) /* point to itself represents end of list */ return NO_JUMP; /* end of list */ @@ -106,7 +106,7 @@ static int ICACHE_FLASH_ATTR getjump (FuncState *fs, int pc) { } -static Instruction *ICACHE_FLASH_ATTR getjumpcontrol (FuncState *fs, int pc) { +static Instruction *getjumpcontrol (FuncState *fs, int pc) { Instruction *pi = &fs->f->code[pc]; if (pc >= 1 && testTMode(GET_OPCODE(*(pi-1)))) return pi-1; @@ -119,7 +119,7 @@ static Instruction *ICACHE_FLASH_ATTR getjumpcontrol (FuncState *fs, int pc) { ** check whether list has any jump that do not produce a value ** (or produce an inverted value) */ -static int ICACHE_FLASH_ATTR need_value (FuncState *fs, int list) { +static int need_value (FuncState *fs, int list) { for (; list != NO_JUMP; list = getjump(fs, list)) { Instruction i = *getjumpcontrol(fs, list); if (GET_OPCODE(i) != OP_TESTSET) return 1; @@ -128,7 +128,7 @@ static int ICACHE_FLASH_ATTR need_value (FuncState *fs, int list) { } -static int ICACHE_FLASH_ATTR patchtestreg (FuncState *fs, int node, int reg) { +static int patchtestreg (FuncState *fs, int node, int reg) { Instruction *i = getjumpcontrol(fs, node); if (GET_OPCODE(*i) != OP_TESTSET) return 0; /* cannot patch other instructions */ @@ -141,13 +141,13 @@ static int ICACHE_FLASH_ATTR patchtestreg (FuncState *fs, int node, int reg) { } -static void ICACHE_FLASH_ATTR removevalues (FuncState *fs, int list) { +static void removevalues (FuncState *fs, int list) { for (; list != NO_JUMP; list = getjump(fs, list)) patchtestreg(fs, list, NO_REG); } -static void ICACHE_FLASH_ATTR patchlistaux (FuncState *fs, int list, int vtarget, int reg, +static void patchlistaux (FuncState *fs, int list, int vtarget, int reg, int dtarget) { while (list != NO_JUMP) { int next = getjump(fs, list); @@ -160,13 +160,13 @@ static void ICACHE_FLASH_ATTR patchlistaux (FuncState *fs, int list, int vtarget } -static void ICACHE_FLASH_ATTR dischargejpc (FuncState *fs) { +static void dischargejpc (FuncState *fs) { patchlistaux(fs, fs->jpc, fs->pc, NO_REG, fs->pc); fs->jpc = NO_JUMP; } -void ICACHE_FLASH_ATTR luaK_patchlist (FuncState *fs, int list, int target) { +void luaK_patchlist (FuncState *fs, int list, int target) { if (target == fs->pc) luaK_patchtohere(fs, list); else { @@ -176,13 +176,13 @@ void ICACHE_FLASH_ATTR luaK_patchlist (FuncState *fs, int list, int target) { } -void ICACHE_FLASH_ATTR luaK_patchtohere (FuncState *fs, int list) { +void luaK_patchtohere (FuncState *fs, int list) { luaK_getlabel(fs); luaK_concat(fs, &fs->jpc, list); } -void ICACHE_FLASH_ATTR luaK_concat (FuncState *fs, int *l1, int l2) { +void luaK_concat (FuncState *fs, int *l1, int l2) { if (l2 == NO_JUMP) return; else if (*l1 == NO_JUMP) *l1 = l2; @@ -196,7 +196,7 @@ void ICACHE_FLASH_ATTR luaK_concat (FuncState *fs, int *l1, int l2) { } -void ICACHE_FLASH_ATTR luaK_checkstack (FuncState *fs, int n) { +void luaK_checkstack (FuncState *fs, int n) { int newstack = fs->freereg + n; if (newstack > fs->f->maxstacksize) { if (newstack >= MAXSTACK) @@ -206,13 +206,13 @@ void ICACHE_FLASH_ATTR luaK_checkstack (FuncState *fs, int n) { } -void ICACHE_FLASH_ATTR luaK_reserveregs (FuncState *fs, int n) { +void luaK_reserveregs (FuncState *fs, int n) { luaK_checkstack(fs, n); fs->freereg += n; } -static void ICACHE_FLASH_ATTR freereg (FuncState *fs, int reg) { +static void freereg (FuncState *fs, int reg) { if (!ISK(reg) && reg >= fs->nactvar) { fs->freereg--; lua_assert(reg == fs->freereg); @@ -220,13 +220,13 @@ static void ICACHE_FLASH_ATTR freereg (FuncState *fs, int reg) { } -static void ICACHE_FLASH_ATTR freeexp (FuncState *fs, expdesc *e) { +static void freeexp (FuncState *fs, expdesc *e) { if (e->k == VNONRELOC) freereg(fs, e->u.s.info); } -static int ICACHE_FLASH_ATTR addk (FuncState *fs, TValue *k, TValue *v) { +static int addk (FuncState *fs, TValue *k, TValue *v) { lua_State *L = fs->L; TValue *idx = luaH_set(L, fs->h, k); Proto *f = fs->f; @@ -247,28 +247,28 @@ static int ICACHE_FLASH_ATTR addk (FuncState *fs, TValue *k, TValue *v) { } -int ICACHE_FLASH_ATTR luaK_stringK (FuncState *fs, TString *s) { +int luaK_stringK (FuncState *fs, TString *s) { TValue o; setsvalue(fs->L, &o, s); return addk(fs, &o, &o); } -int ICACHE_FLASH_ATTR luaK_numberK (FuncState *fs, lua_Number r) { +int luaK_numberK (FuncState *fs, lua_Number r) { TValue o; setnvalue(&o, r); return addk(fs, &o, &o); } -static int ICACHE_FLASH_ATTR boolK (FuncState *fs, int b) { +static int boolK (FuncState *fs, int b) { TValue o; setbvalue(&o, b); return addk(fs, &o, &o); } -static int ICACHE_FLASH_ATTR nilK (FuncState *fs) { +static int nilK (FuncState *fs) { TValue k, v; setnilvalue(&v); /* cannot use nil as key; instead use table itself to represent nil */ @@ -277,7 +277,7 @@ static int ICACHE_FLASH_ATTR nilK (FuncState *fs) { } -void ICACHE_FLASH_ATTR luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { +void luaK_setreturns (FuncState *fs, expdesc *e, int nresults) { if (e->k == VCALL) { /* expression is an open function call? */ SETARG_C(getcode(fs, e), nresults+1); } @@ -289,7 +289,7 @@ void ICACHE_FLASH_ATTR luaK_setreturns (FuncState *fs, expdesc *e, int nresults) } -void ICACHE_FLASH_ATTR luaK_setoneret (FuncState *fs, expdesc *e) { +void luaK_setoneret (FuncState *fs, expdesc *e) { if (e->k == VCALL) { /* expression is an open function call? */ e->k = VNONRELOC; e->u.s.info = GETARG_A(getcode(fs, e)); @@ -301,7 +301,7 @@ void ICACHE_FLASH_ATTR luaK_setoneret (FuncState *fs, expdesc *e) { } -void ICACHE_FLASH_ATTR luaK_dischargevars (FuncState *fs, expdesc *e) { +void luaK_dischargevars (FuncState *fs, expdesc *e) { switch (e->k) { case VLOCAL: { e->k = VNONRELOC; @@ -334,13 +334,13 @@ void ICACHE_FLASH_ATTR luaK_dischargevars (FuncState *fs, expdesc *e) { } -static int ICACHE_FLASH_ATTR code_label (FuncState *fs, int A, int b, int jump) { +static int code_label (FuncState *fs, int A, int b, int jump) { luaK_getlabel(fs); /* those instructions may be jump targets */ return luaK_codeABC(fs, OP_LOADBOOL, A, b, jump); } -static void ICACHE_FLASH_ATTR discharge2reg (FuncState *fs, expdesc *e, int reg) { +static void discharge2reg (FuncState *fs, expdesc *e, int reg) { luaK_dischargevars(fs, e); switch (e->k) { case VNIL: { @@ -379,7 +379,7 @@ static void ICACHE_FLASH_ATTR discharge2reg (FuncState *fs, expdesc *e, int reg) } -static void ICACHE_FLASH_ATTR discharge2anyreg (FuncState *fs, expdesc *e) { +static void discharge2anyreg (FuncState *fs, expdesc *e) { if (e->k != VNONRELOC) { luaK_reserveregs(fs, 1); discharge2reg(fs, e, fs->freereg-1); @@ -387,7 +387,7 @@ static void ICACHE_FLASH_ATTR discharge2anyreg (FuncState *fs, expdesc *e) { } -static void ICACHE_FLASH_ATTR exp2reg (FuncState *fs, expdesc *e, int reg) { +static void exp2reg (FuncState *fs, expdesc *e, int reg) { discharge2reg(fs, e, reg); if (e->k == VJMP) luaK_concat(fs, &e->t, e->u.s.info); /* put this jump in `t' list */ @@ -411,7 +411,7 @@ static void ICACHE_FLASH_ATTR exp2reg (FuncState *fs, expdesc *e, int reg) { } -void ICACHE_FLASH_ATTR luaK_exp2nextreg (FuncState *fs, expdesc *e) { +void luaK_exp2nextreg (FuncState *fs, expdesc *e) { luaK_dischargevars(fs, e); freeexp(fs, e); luaK_reserveregs(fs, 1); @@ -419,7 +419,7 @@ void ICACHE_FLASH_ATTR luaK_exp2nextreg (FuncState *fs, expdesc *e) { } -int ICACHE_FLASH_ATTR luaK_exp2anyreg (FuncState *fs, expdesc *e) { +int luaK_exp2anyreg (FuncState *fs, expdesc *e) { luaK_dischargevars(fs, e); if (e->k == VNONRELOC) { if (!hasjumps(e)) return e->u.s.info; /* exp is already in a register */ @@ -433,7 +433,7 @@ int ICACHE_FLASH_ATTR luaK_exp2anyreg (FuncState *fs, expdesc *e) { } -void ICACHE_FLASH_ATTR luaK_exp2val (FuncState *fs, expdesc *e) { +void luaK_exp2val (FuncState *fs, expdesc *e) { if (hasjumps(e)) luaK_exp2anyreg(fs, e); else @@ -441,7 +441,7 @@ void ICACHE_FLASH_ATTR luaK_exp2val (FuncState *fs, expdesc *e) { } -int ICACHE_FLASH_ATTR luaK_exp2RK (FuncState *fs, expdesc *e) { +int luaK_exp2RK (FuncState *fs, expdesc *e) { luaK_exp2val(fs, e); switch (e->k) { case VKNUM: @@ -469,7 +469,7 @@ int ICACHE_FLASH_ATTR luaK_exp2RK (FuncState *fs, expdesc *e) { } -void ICACHE_FLASH_ATTR luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { +void luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) { switch (var->k) { case VLOCAL: { freeexp(fs, ex); @@ -500,7 +500,7 @@ void ICACHE_FLASH_ATTR luaK_storevar (FuncState *fs, expdesc *var, expdesc *ex) } -void ICACHE_FLASH_ATTR luaK_self (FuncState *fs, expdesc *e, expdesc *key) { +void luaK_self (FuncState *fs, expdesc *e, expdesc *key) { int func; luaK_exp2anyreg(fs, e); freeexp(fs, e); @@ -513,7 +513,7 @@ void ICACHE_FLASH_ATTR luaK_self (FuncState *fs, expdesc *e, expdesc *key) { } -static void ICACHE_FLASH_ATTR invertjump (FuncState *fs, expdesc *e) { +static void invertjump (FuncState *fs, expdesc *e) { Instruction *pc = getjumpcontrol(fs, e->u.s.info); lua_assert(testTMode(GET_OPCODE(*pc)) && GET_OPCODE(*pc) != OP_TESTSET && GET_OPCODE(*pc) != OP_TEST); @@ -521,7 +521,7 @@ static void ICACHE_FLASH_ATTR invertjump (FuncState *fs, expdesc *e) { } -static int ICACHE_FLASH_ATTR jumponcond (FuncState *fs, expdesc *e, int cond) { +static int jumponcond (FuncState *fs, expdesc *e, int cond) { if (e->k == VRELOCABLE) { Instruction ie = getcode(fs, e); if (GET_OPCODE(ie) == OP_NOT) { @@ -536,7 +536,7 @@ static int ICACHE_FLASH_ATTR jumponcond (FuncState *fs, expdesc *e, int cond) { } -void ICACHE_FLASH_ATTR luaK_goiftrue (FuncState *fs, expdesc *e) { +void luaK_goiftrue (FuncState *fs, expdesc *e) { int pc; /* pc of last jump */ luaK_dischargevars(fs, e); switch (e->k) { @@ -560,7 +560,7 @@ void ICACHE_FLASH_ATTR luaK_goiftrue (FuncState *fs, expdesc *e) { } -static void ICACHE_FLASH_ATTR luaK_goiffalse (FuncState *fs, expdesc *e) { +static void luaK_goiffalse (FuncState *fs, expdesc *e) { int pc; /* pc of last jump */ luaK_dischargevars(fs, e); switch (e->k) { @@ -583,7 +583,7 @@ static void ICACHE_FLASH_ATTR luaK_goiffalse (FuncState *fs, expdesc *e) { } -static void ICACHE_FLASH_ATTR codenot (FuncState *fs, expdesc *e) { +static void codenot (FuncState *fs, expdesc *e) { luaK_dischargevars(fs, e); switch (e->k) { case VNIL: case VFALSE: { @@ -618,13 +618,13 @@ static void ICACHE_FLASH_ATTR codenot (FuncState *fs, expdesc *e) { } -void ICACHE_FLASH_ATTR luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { +void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k) { t->u.s.aux = luaK_exp2RK(fs, k); t->k = VINDEXED; } -static int ICACHE_FLASH_ATTR constfolding (OpCode op, expdesc *e1, expdesc *e2) { +static int constfolding (OpCode op, expdesc *e1, expdesc *e2) { lua_Number v1, v2, r; if (!isnumeral(e1) || !isnumeral(e2)) return 0; v1 = e1->u.nval; @@ -650,7 +650,7 @@ static int ICACHE_FLASH_ATTR constfolding (OpCode op, expdesc *e1, expdesc *e2) } -static void ICACHE_FLASH_ATTR codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { +static void codearith (FuncState *fs, OpCode op, expdesc *e1, expdesc *e2) { if (constfolding(op, e1, e2)) return; else { @@ -670,7 +670,7 @@ static void ICACHE_FLASH_ATTR codearith (FuncState *fs, OpCode op, expdesc *e1, } -static void ICACHE_FLASH_ATTR codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, +static void codecomp (FuncState *fs, OpCode op, int cond, expdesc *e1, expdesc *e2) { int o1 = luaK_exp2RK(fs, e1); int o2 = luaK_exp2RK(fs, e2); @@ -686,7 +686,7 @@ static void ICACHE_FLASH_ATTR codecomp (FuncState *fs, OpCode op, int cond, expd } -void ICACHE_FLASH_ATTR luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { +void luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { expdesc e2; e2.t = e2.f = NO_JUMP; e2.k = VKNUM; e2.u.nval = 0; switch (op) { @@ -707,7 +707,7 @@ void ICACHE_FLASH_ATTR luaK_prefix (FuncState *fs, UnOpr op, expdesc *e) { } -void ICACHE_FLASH_ATTR luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { +void luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { switch (op) { case OPR_AND: { luaK_goiftrue(fs, v); @@ -734,7 +734,7 @@ void ICACHE_FLASH_ATTR luaK_infix (FuncState *fs, BinOpr op, expdesc *v) { } -void ICACHE_FLASH_ATTR luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { +void luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expdesc *e2) { switch (op) { case OPR_AND: { lua_assert(e1->t == NO_JUMP); /* list must be closed */ @@ -781,12 +781,12 @@ void ICACHE_FLASH_ATTR luaK_posfix (FuncState *fs, BinOpr op, expdesc *e1, expde } -void ICACHE_FLASH_ATTR luaK_fixline (FuncState *fs, int line) { +void luaK_fixline (FuncState *fs, int line) { fs->f->lineinfo[fs->pc - 1] = line; } -static int ICACHE_FLASH_ATTR luaK_code (FuncState *fs, Instruction i, int line) { +static int luaK_code (FuncState *fs, Instruction i, int line) { Proto *f = fs->f; dischargejpc(fs); /* `pc' will change */ /* put new instruction in code array */ @@ -801,7 +801,7 @@ static int ICACHE_FLASH_ATTR luaK_code (FuncState *fs, Instruction i, int line) } -int ICACHE_FLASH_ATTR luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { +int luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c) { lua_assert(getOpMode(o) == iABC); lua_assert(getBMode(o) != OpArgN || b == 0); lua_assert(getCMode(o) != OpArgN || c == 0); @@ -809,14 +809,14 @@ int ICACHE_FLASH_ATTR luaK_codeABC (FuncState *fs, OpCode o, int a, int b, int c } -int ICACHE_FLASH_ATTR luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { +int luaK_codeABx (FuncState *fs, OpCode o, int a, unsigned int bc) { lua_assert(getOpMode(o) == iABx || getOpMode(o) == iAsBx); lua_assert(getCMode(o) == OpArgN); return luaK_code(fs, CREATE_ABx(o, a, bc), fs->ls->lastline); } -void ICACHE_FLASH_ATTR luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { +void luaK_setlist (FuncState *fs, int base, int nelems, int tostore) { int c = (nelems - 1)/LFIELDS_PER_FLUSH + 1; int b = (tostore == LUA_MULTRET) ? 0 : tostore; lua_assert(tostore != 0); diff --git a/app/lua/ldebug.c b/app/lua/ldebug.c index 971f7331..d22c2af9 100644 --- a/app/lua/ldebug.c +++ b/app/lua/ldebug.c @@ -33,7 +33,7 @@ static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name); -static int ICACHE_FLASH_ATTR currentpc (lua_State *L, CallInfo *ci) { +static int currentpc (lua_State *L, CallInfo *ci) { if (!isLua(ci)) return -1; /* function is not a Lua function? */ if (ci == L->ci) ci->savedpc = L->savedpc; @@ -41,7 +41,7 @@ static int ICACHE_FLASH_ATTR currentpc (lua_State *L, CallInfo *ci) { } -static int ICACHE_FLASH_ATTR currentline (lua_State *L, CallInfo *ci) { +static int currentline (lua_State *L, CallInfo *ci) { int pc = currentpc(L, ci); if (pc < 0) return -1; /* only active lua functions have current-line information */ @@ -53,7 +53,7 @@ static int ICACHE_FLASH_ATTR currentline (lua_State *L, CallInfo *ci) { /* ** this function can be called asynchronous (e.g. during a signal) */ -LUA_API int ICACHE_FLASH_ATTR lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { +LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count) { if (func == NULL || mask == 0) { /* turn off hooks? */ mask = 0; func = NULL; @@ -66,22 +66,22 @@ LUA_API int ICACHE_FLASH_ATTR lua_sethook (lua_State *L, lua_Hook func, int mask } -LUA_API lua_Hook ICACHE_FLASH_ATTR lua_gethook (lua_State *L) { +LUA_API lua_Hook lua_gethook (lua_State *L) { return L->hook; } -LUA_API int ICACHE_FLASH_ATTR lua_gethookmask (lua_State *L) { +LUA_API int lua_gethookmask (lua_State *L) { return L->hookmask; } -LUA_API int ICACHE_FLASH_ATTR lua_gethookcount (lua_State *L) { +LUA_API int lua_gethookcount (lua_State *L) { return L->basehookcount; } -LUA_API int ICACHE_FLASH_ATTR lua_getstack (lua_State *L, int level, lua_Debug *ar) { +LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar) { int status; CallInfo *ci; lua_lock(L); @@ -104,12 +104,12 @@ LUA_API int ICACHE_FLASH_ATTR lua_getstack (lua_State *L, int level, lua_Debug * } -static Proto *ICACHE_FLASH_ATTR getluaproto (CallInfo *ci) { +static Proto *getluaproto (CallInfo *ci) { return (isLua(ci) ? ci_func(ci)->l.p : NULL); } -static const char *ICACHE_FLASH_ATTR findlocal (lua_State *L, CallInfo *ci, int n) { +static const char *findlocal (lua_State *L, CallInfo *ci, int n) { const char *name; Proto *fp = getluaproto(ci); if (fp && (name = luaF_getlocalname(fp, n, currentpc(L, ci))) != NULL) @@ -124,7 +124,7 @@ static const char *ICACHE_FLASH_ATTR findlocal (lua_State *L, CallInfo *ci, int } -LUA_API const char *ICACHE_FLASH_ATTR lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { +LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n) { CallInfo *ci = L->base_ci + ar->i_ci; const char *name = findlocal(L, ci, n); lua_lock(L); @@ -135,7 +135,7 @@ LUA_API const char *ICACHE_FLASH_ATTR lua_getlocal (lua_State *L, const lua_Debu } -LUA_API const char *ICACHE_FLASH_ATTR lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { +LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n) { CallInfo *ci = L->base_ci + ar->i_ci; const char *name = findlocal(L, ci, n); lua_lock(L); @@ -147,7 +147,7 @@ LUA_API const char *ICACHE_FLASH_ATTR lua_setlocal (lua_State *L, const lua_Debu } -static void ICACHE_FLASH_ATTR funcinfo (lua_Debug *ar, Closure *cl, void *plight) { +static void funcinfo (lua_Debug *ar, Closure *cl, void *plight) { if (plight || cl->c.isC) { ar->source = "=[C]"; ar->linedefined = -1; @@ -164,7 +164,7 @@ static void ICACHE_FLASH_ATTR funcinfo (lua_Debug *ar, Closure *cl, void *plight } -static void ICACHE_FLASH_ATTR info_tailcall (lua_Debug *ar) { +static void info_tailcall (lua_Debug *ar) { ar->name = ar->namewhat = ""; ar->what = "tail"; ar->lastlinedefined = ar->linedefined = ar->currentline = -1; @@ -174,7 +174,7 @@ static void ICACHE_FLASH_ATTR info_tailcall (lua_Debug *ar) { } -static void ICACHE_FLASH_ATTR collectvalidlines (lua_State *L, Closure *f) { +static void collectvalidlines (lua_State *L, Closure *f) { if (f == NULL || f->c.isC) { setnilvalue(L->top); } @@ -190,7 +190,7 @@ static void ICACHE_FLASH_ATTR collectvalidlines (lua_State *L, Closure *f) { } -static int ICACHE_FLASH_ATTR auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, +static int auxgetinfo (lua_State *L, const char *what, lua_Debug *ar, Closure *f, void *plight, CallInfo *ci) { int status = 1; if (plight == NULL && f == NULL) { @@ -229,7 +229,7 @@ static int ICACHE_FLASH_ATTR auxgetinfo (lua_State *L, const char *what, lua_Deb } -LUA_API int ICACHE_FLASH_ATTR lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { +LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar) { int status; Closure *f = NULL; CallInfo *ci = NULL; @@ -284,7 +284,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_getinfo (lua_State *L, const char *what, lua_D -static int ICACHE_FLASH_ATTR precheck (const Proto *pt) { +static int precheck (const Proto *pt) { check(pt->maxstacksize <= MAXSTACK); check(pt->numparams+(pt->is_vararg & VARARG_HASARG) <= pt->maxstacksize); check(!(pt->is_vararg & VARARG_NEEDSARG) || @@ -298,7 +298,7 @@ static int ICACHE_FLASH_ATTR precheck (const Proto *pt) { #define checkopenop(pt,pc) luaG_checkopenop((pt)->code[(pc)+1]) -int ICACHE_FLASH_ATTR luaG_checkopenop (Instruction i) { +int luaG_checkopenop (Instruction i) { switch (GET_OPCODE(i)) { case OP_CALL: case OP_TAILCALL: @@ -312,7 +312,7 @@ int ICACHE_FLASH_ATTR luaG_checkopenop (Instruction i) { } -static int ICACHE_FLASH_ATTR checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { +static int checkArgMode (const Proto *pt, int r, enum OpArgMask mode) { switch (mode) { case OpArgN: check(r == 0); break; case OpArgU: break; @@ -325,7 +325,7 @@ static int ICACHE_FLASH_ATTR checkArgMode (const Proto *pt, int r, enum OpArgMas } -static Instruction ICACHE_FLASH_ATTR symbexec (const Proto *pt, int lastpc, int reg) { +static Instruction symbexec (const Proto *pt, int lastpc, int reg) { int pc; int last; /* stores position of last instruction that changed `reg' */ last = pt->sizecode-1; /* points to final return (a `neutral' instruction) */ @@ -492,12 +492,12 @@ static Instruction ICACHE_FLASH_ATTR symbexec (const Proto *pt, int lastpc, int /* }====================================================== */ -int ICACHE_FLASH_ATTR luaG_checkcode (const Proto *pt) { +int luaG_checkcode (const Proto *pt) { return (symbexec(pt, pt->sizecode, NO_REG) != 0); } -static const char *ICACHE_FLASH_ATTR kname (Proto *p, int c) { +static const char *kname (Proto *p, int c) { if (ISK(c) && ttisstring(&p->k[INDEXK(c)])) return svalue(&p->k[INDEXK(c)]); else @@ -505,7 +505,7 @@ static const char *ICACHE_FLASH_ATTR kname (Proto *p, int c) { } -static const char *ICACHE_FLASH_ATTR getobjname (lua_State *L, CallInfo *ci, int stackpos, +static const char *getobjname (lua_State *L, CallInfo *ci, int stackpos, const char **name) { if (isLua(ci)) { /* a Lua function? */ Proto *p = ci_func(ci)->l.p; @@ -552,7 +552,7 @@ static const char *ICACHE_FLASH_ATTR getobjname (lua_State *L, CallInfo *ci, int } -static const char *ICACHE_FLASH_ATTR getfuncname (lua_State *L, CallInfo *ci, const char **name) { +static const char *getfuncname (lua_State *L, CallInfo *ci, const char **name) { Instruction i; if ((isLua(ci) && ci->tailcalls > 0) || !isLua(ci - 1)) return NULL; /* calling function is not Lua (or is unknown) */ @@ -567,7 +567,7 @@ static const char *ICACHE_FLASH_ATTR getfuncname (lua_State *L, CallInfo *ci, co /* only ANSI way to check whether a pointer points to an array */ -static int ICACHE_FLASH_ATTR isinstack (CallInfo *ci, const TValue *o) { +static int isinstack (CallInfo *ci, const TValue *o) { StkId p; for (p = ci->base; p < ci->top; p++) if (o == p) return 1; @@ -575,7 +575,7 @@ static int ICACHE_FLASH_ATTR isinstack (CallInfo *ci, const TValue *o) { } -void ICACHE_FLASH_ATTR luaG_typeerror (lua_State *L, const TValue *o, const char *op) { +void luaG_typeerror (lua_State *L, const TValue *o, const char *op) { const char *name = NULL; const char *t = luaT_typenames[ttype(o)]; const char *kind = (isinstack(L->ci, o)) ? @@ -589,14 +589,14 @@ void ICACHE_FLASH_ATTR luaG_typeerror (lua_State *L, const TValue *o, const char } -void ICACHE_FLASH_ATTR luaG_concaterror (lua_State *L, StkId p1, StkId p2) { +void luaG_concaterror (lua_State *L, StkId p1, StkId p2) { if (ttisstring(p1) || ttisnumber(p1)) p1 = p2; lua_assert(!ttisstring(p1) && !ttisnumber(p1)); luaG_typeerror(L, p1, "concatenate"); } -void ICACHE_FLASH_ATTR luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { +void luaG_aritherror (lua_State *L, const TValue *p1, const TValue *p2) { TValue temp; if (luaV_tonumber(p1, &temp) == NULL) p2 = p1; /* first operand is wrong */ @@ -604,7 +604,7 @@ void ICACHE_FLASH_ATTR luaG_aritherror (lua_State *L, const TValue *p1, const TV } -int ICACHE_FLASH_ATTR luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { +int luaG_ordererror (lua_State *L, const TValue *p1, const TValue *p2) { const char *t1 = luaT_typenames[ttype(p1)]; const char *t2 = luaT_typenames[ttype(p2)]; if (t1[2] == t2[2]) @@ -615,7 +615,7 @@ int ICACHE_FLASH_ATTR luaG_ordererror (lua_State *L, const TValue *p1, const TVa } -static void ICACHE_FLASH_ATTR addinfo (lua_State *L, const char *msg) { +static void addinfo (lua_State *L, const char *msg) { CallInfo *ci = L->ci; if (isLua(ci)) { /* is Lua code? */ char buff[LUA_IDSIZE]; /* add file:line information */ @@ -626,7 +626,7 @@ static void ICACHE_FLASH_ATTR addinfo (lua_State *L, const char *msg) { } -void ICACHE_FLASH_ATTR luaG_errormsg (lua_State *L) { +void luaG_errormsg (lua_State *L) { if (L->errfunc != 0) { /* is there an error handling function? */ StkId errfunc = restorestack(L, L->errfunc); if (!ttisfunction(errfunc) && !ttislightfunction(errfunc)) luaD_throw(L, LUA_ERRERR); @@ -639,7 +639,7 @@ void ICACHE_FLASH_ATTR luaG_errormsg (lua_State *L) { } -void ICACHE_FLASH_ATTR luaG_runerror (lua_State *L, const char *fmt, ...) { +void luaG_runerror (lua_State *L, const char *fmt, ...) { va_list argp; va_start(argp, fmt); addinfo(L, luaO_pushvfstring(L, fmt, argp)); diff --git a/app/lua/ldo.c b/app/lua/ldo.c index 8f69fe56..8189f108 100644 --- a/app/lua/ldo.c +++ b/app/lua/ldo.c @@ -48,7 +48,7 @@ struct lua_longjmp { }; -void ICACHE_FLASH_ATTR luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { +void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { switch (errcode) { case LUA_ERRMEM: { ptrdiff_t oldtopr = savestack(L, oldtop); @@ -70,7 +70,7 @@ void ICACHE_FLASH_ATTR luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop } -static void ICACHE_FLASH_ATTR restore_stack_limit (lua_State *L) { +static void restore_stack_limit (lua_State *L) { lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); if (L->size_ci > LUAI_MAXCALLS) { /* there was an overflow? */ int inuse = cast_int(L->ci - L->base_ci); @@ -80,7 +80,7 @@ static void ICACHE_FLASH_ATTR restore_stack_limit (lua_State *L) { } -static void ICACHE_FLASH_ATTR resetstack (lua_State *L, int status) { +static void resetstack (lua_State *L, int status) { L->ci = L->base_ci; L->base = L->ci->base; luaF_close(L, L->base); /* close eventual pending closures */ @@ -93,7 +93,7 @@ static void ICACHE_FLASH_ATTR resetstack (lua_State *L, int status) { } -void ICACHE_FLASH_ATTR luaD_throw (lua_State *L, int errcode) { +void luaD_throw (lua_State *L, int errcode) { unfixedstack(L); /* make sure the fixedstack & block_gc flags get reset. */ unset_block_gc(L); if (L->errorJmp) { @@ -112,7 +112,7 @@ void ICACHE_FLASH_ATTR luaD_throw (lua_State *L, int errcode) { } -int ICACHE_FLASH_ATTR luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { +int luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { struct lua_longjmp lj; lj.status = 0; lj.previous = L->errorJmp; /* chain new error handler */ @@ -127,7 +127,7 @@ int ICACHE_FLASH_ATTR luaD_rawrunprotected (lua_State *L, Pfunc f, void *ud) { /* }====================================================== */ -static void ICACHE_FLASH_ATTR correctstack (lua_State *L, TValue *oldstack) { +static void correctstack (lua_State *L, TValue *oldstack) { CallInfo *ci; GCObject *up; L->top = (L->top - oldstack) + L->stack; @@ -142,7 +142,7 @@ static void ICACHE_FLASH_ATTR correctstack (lua_State *L, TValue *oldstack) { } -void ICACHE_FLASH_ATTR luaD_reallocstack (lua_State *L, int newsize) { +void luaD_reallocstack (lua_State *L, int newsize) { TValue *oldstack = L->stack; int realsize = newsize + 1 + EXTRA_STACK; lua_assert(L->stack_last - L->stack == L->stacksize - EXTRA_STACK - 1); @@ -153,7 +153,7 @@ void ICACHE_FLASH_ATTR luaD_reallocstack (lua_State *L, int newsize) { } -void ICACHE_FLASH_ATTR luaD_reallocCI (lua_State *L, int newsize) { +void luaD_reallocCI (lua_State *L, int newsize) { CallInfo *oldci = L->base_ci; luaM_reallocvector(L, L->base_ci, L->size_ci, newsize, CallInfo); L->size_ci = newsize; @@ -162,7 +162,7 @@ void ICACHE_FLASH_ATTR luaD_reallocCI (lua_State *L, int newsize) { } -void ICACHE_FLASH_ATTR luaD_growstack (lua_State *L, int n) { +void luaD_growstack (lua_State *L, int n) { if (n <= L->stacksize) /* double size is enough? */ luaD_reallocstack(L, 2*L->stacksize); else @@ -170,7 +170,7 @@ void ICACHE_FLASH_ATTR luaD_growstack (lua_State *L, int n) { } -static CallInfo *ICACHE_FLASH_ATTR growCI (lua_State *L) { +static CallInfo *growCI (lua_State *L) { if (L->size_ci > LUAI_MAXCALLS) /* overflow while handling overflow? */ luaD_throw(L, LUA_ERRERR); else { @@ -182,7 +182,7 @@ static CallInfo *ICACHE_FLASH_ATTR growCI (lua_State *L) { } -void ICACHE_FLASH_ATTR luaD_callhook (lua_State *L, int event, int line) { +void luaD_callhook (lua_State *L, int event, int line) { lua_Hook hook = L->hook; if (hook && L->allowhook) { ptrdiff_t top = savestack(L, L->top); @@ -209,7 +209,7 @@ void ICACHE_FLASH_ATTR luaD_callhook (lua_State *L, int event, int line) { } -static StkId ICACHE_FLASH_ATTR adjust_varargs (lua_State *L, Proto *p, int actual) { +static StkId adjust_varargs (lua_State *L, Proto *p, int actual) { int i; int nfixargs = p->numparams; #if defined(LUA_COMPAT_VARARG) @@ -253,7 +253,7 @@ static StkId ICACHE_FLASH_ATTR adjust_varargs (lua_State *L, Proto *p, int actua } -static StkId ICACHE_FLASH_ATTR tryfuncTM (lua_State *L, StkId func) { +static StkId tryfuncTM (lua_State *L, StkId func) { const TValue *tm = luaT_gettmbyobj(L, func, TM_CALL); StkId p; ptrdiff_t funcr = savestack(L, func); @@ -274,7 +274,7 @@ static StkId ICACHE_FLASH_ATTR tryfuncTM (lua_State *L, StkId func) { (condhardstacktests(luaD_reallocCI(L, L->size_ci)), ++L->ci)) -int ICACHE_FLASH_ATTR luaD_precall (lua_State *L, StkId func, int nresults) { +int luaD_precall (lua_State *L, StkId func, int nresults) { ptrdiff_t funcr; LClosure *cl = NULL; if (!ttisfunction(func) && !ttislightfunction(func)) /* `func' is not a function? */ @@ -345,7 +345,7 @@ int ICACHE_FLASH_ATTR luaD_precall (lua_State *L, StkId func, int nresults) { } -static StkId ICACHE_FLASH_ATTR callrethooks (lua_State *L, StkId firstResult) { +static StkId callrethooks (lua_State *L, StkId firstResult) { ptrdiff_t fr = savestack(L, firstResult); /* next call may change stack */ luaD_callhook(L, LUA_HOOKRET, -1); if (f_isLua(L->ci)) { /* Lua function? */ @@ -356,7 +356,7 @@ static StkId ICACHE_FLASH_ATTR callrethooks (lua_State *L, StkId firstResult) { } -int ICACHE_FLASH_ATTR luaD_poscall (lua_State *L, StkId firstResult) { +int luaD_poscall (lua_State *L, StkId firstResult) { StkId res; int wanted, i; CallInfo *ci; @@ -383,7 +383,7 @@ int ICACHE_FLASH_ATTR luaD_poscall (lua_State *L, StkId firstResult) { ** When returns, all the results are on the stack, starting at the original ** function position. */ -void ICACHE_FLASH_ATTR luaD_call (lua_State *L, StkId func, int nResults) { +void luaD_call (lua_State *L, StkId func, int nResults) { if (++L->nCcalls >= LUAI_MAXCCALLS) { if (L->nCcalls == LUAI_MAXCCALLS) luaG_runerror(L, "C stack overflow"); @@ -397,7 +397,7 @@ void ICACHE_FLASH_ATTR luaD_call (lua_State *L, StkId func, int nResults) { } -static void ICACHE_FLASH_ATTR resume (lua_State *L, void *ud) { +static void resume (lua_State *L, void *ud) { StkId firstArg = cast(StkId, ud); CallInfo *ci = L->ci; if (L->status == 0) { /* start coroutine? */ @@ -422,7 +422,7 @@ static void ICACHE_FLASH_ATTR resume (lua_State *L, void *ud) { } -static int ICACHE_FLASH_ATTR resume_error (lua_State *L, const char *msg) { +static int resume_error (lua_State *L, const char *msg) { L->top = L->ci->base; setsvalue2s(L, L->top, luaS_new(L, msg)); incr_top(L); @@ -431,7 +431,7 @@ static int ICACHE_FLASH_ATTR resume_error (lua_State *L, const char *msg) { } -LUA_API int ICACHE_FLASH_ATTR lua_resume (lua_State *L, int nargs) { +LUA_API int lua_resume (lua_State *L, int nargs) { int status; lua_lock(L); if (L->status != LUA_YIELD && (L->status != 0 || L->ci != L->base_ci)) @@ -457,7 +457,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_resume (lua_State *L, int nargs) { } -LUA_API int ICACHE_FLASH_ATTR lua_yield (lua_State *L, int nresults) { +LUA_API int lua_yield (lua_State *L, int nresults) { luai_userstateyield(L, nresults); lua_lock(L); if (L->nCcalls > L->baseCcalls) @@ -469,7 +469,7 @@ LUA_API int ICACHE_FLASH_ATTR lua_yield (lua_State *L, int nresults) { } -int ICACHE_FLASH_ATTR luaD_pcall (lua_State *L, Pfunc func, void *u, +int luaD_pcall (lua_State *L, Pfunc func, void *u, ptrdiff_t old_top, ptrdiff_t ef) { int status; unsigned short oldnCcalls = L->nCcalls; @@ -504,7 +504,7 @@ struct SParser { /* data to `f_parser' */ const char *name; }; -static void ICACHE_FLASH_ATTR f_parser (lua_State *L, void *ud) { +static void f_parser (lua_State *L, void *ud) { int i; Proto *tf; Closure *cl; @@ -524,7 +524,7 @@ static void ICACHE_FLASH_ATTR f_parser (lua_State *L, void *ud) { } -int ICACHE_FLASH_ATTR luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { +int luaD_protectedparser (lua_State *L, ZIO *z, const char *name) { struct SParser p; int status; p.z = z; p.name = name; diff --git a/app/lua/ldump.c b/app/lua/ldump.c index d8e34044..c48878dc 100644 --- a/app/lua/ldump.c +++ b/app/lua/ldump.c @@ -29,7 +29,7 @@ typedef struct { #define DumpMem(b,n,size,D) DumpBlock(b,(n)*(size),D) #define DumpVar(x,D) DumpMem(&x,1,sizeof(x),D) -static void ICACHE_FLASH_ATTR DumpBlock(const void* b, size_t size, DumpState* D) +static void DumpBlock(const void* b, size_t size, DumpState* D) { if (D->status==0) { @@ -40,19 +40,19 @@ static void ICACHE_FLASH_ATTR DumpBlock(const void* b, size_t size, DumpState* D } } -static void ICACHE_FLASH_ATTR DumpChar(int y, DumpState* D) +static void DumpChar(int y, DumpState* D) { char x=(char)y; DumpVar(x,D); } -static void ICACHE_FLASH_ATTR Align4(DumpState *D) +static void Align4(DumpState *D) { while(D->wrote&3) DumpChar(0,D); } -static void ICACHE_FLASH_ATTR MaybeByteSwap(char *number, size_t numbersize, DumpState *D) +static void MaybeByteSwap(char *number, size_t numbersize, DumpState *D) { int x=1; int platform_little_endian = *(char*)&x; @@ -68,7 +68,7 @@ static void ICACHE_FLASH_ATTR MaybeByteSwap(char *number, size_t numbersize, Dum } } -static void ICACHE_FLASH_ATTR DumpIntWithSize(int x, int sizeof_int, DumpState* D) +static void DumpIntWithSize(int x, int sizeof_int, DumpState* D) { /* dump signed integer */ switch(sizeof_int) { @@ -93,12 +93,12 @@ static void ICACHE_FLASH_ATTR DumpIntWithSize(int x, int sizeof_int, DumpState* } } -static void ICACHE_FLASH_ATTR DumpInt(int x, DumpState* D) +static void DumpInt(int x, DumpState* D) { DumpIntWithSize(x,D->target.sizeof_int,D); } -static void ICACHE_FLASH_ATTR DumpSize(uint32_t x, DumpState* D) +static void DumpSize(uint32_t x, DumpState* D) { /* dump unsigned integer */ switch(D->target.sizeof_strsize_t) { @@ -123,7 +123,7 @@ static void ICACHE_FLASH_ATTR DumpSize(uint32_t x, DumpState* D) } } -static void ICACHE_FLASH_ATTR DumpNumber(lua_Number x, DumpState* D) +static void DumpNumber(lua_Number x, DumpState* D) { #if defined( LUA_NUMBER_INTEGRAL ) && !defined( LUA_CROSS_COMPILER ) DumpIntWithSize(x,D->target.sizeof_lua_Number,D); @@ -164,7 +164,7 @@ static void ICACHE_FLASH_ATTR DumpNumber(lua_Number x, DumpState* D) #endif // #if defined( LUA_NUMBER_INTEGRAL ) && !defined( LUA_CROSS_COMPILER ) } -static void ICACHE_FLASH_ATTR DumpCode(const Proto *f, DumpState* D) +static void DumpCode(const Proto *f, DumpState* D) { DumpInt(f->sizecode,D); char buf[10]; @@ -178,7 +178,7 @@ static void ICACHE_FLASH_ATTR DumpCode(const Proto *f, DumpState* D) } } -static void ICACHE_FLASH_ATTR DumpString(const TString* s, DumpState* D) +static void DumpString(const TString* s, DumpState* D) { if (s==NULL || getstr(s)==NULL) { @@ -195,7 +195,7 @@ static void ICACHE_FLASH_ATTR DumpString(const TString* s, DumpState* D) static void DumpFunction(const Proto* f, const TString* p, DumpState* D); -static void ICACHE_FLASH_ATTR DumpConstants(const Proto* f, DumpState* D) +static void DumpConstants(const Proto* f, DumpState* D) { int i,n=f->sizek; DumpInt(n,D); @@ -226,7 +226,7 @@ static void ICACHE_FLASH_ATTR DumpConstants(const Proto* f, DumpState* D) for (i=0; ip[i],f->source,D); } -static void ICACHE_FLASH_ATTR DumpDebug(const Proto* f, DumpState* D) +static void DumpDebug(const Proto* f, DumpState* D) { int i,n; n= (D->strip) ? 0 : f->sizelineinfo; @@ -251,7 +251,7 @@ static void ICACHE_FLASH_ATTR DumpDebug(const Proto* f, DumpState* D) for (i=0; iupvalues[i],D); } -static void ICACHE_FLASH_ATTR DumpFunction(const Proto* f, const TString* p, DumpState* D) +static void DumpFunction(const Proto* f, const TString* p, DumpState* D) { DumpString((f->source==p || D->strip) ? NULL : f->source,D); DumpInt(f->linedefined,D); @@ -265,7 +265,7 @@ static void ICACHE_FLASH_ATTR DumpFunction(const Proto* f, const TString* p, Dum DumpDebug(f,D); } -static void ICACHE_FLASH_ATTR DumpHeader(DumpState* D) +static void DumpHeader(DumpState* D) { char buf[LUAC_HEADERSIZE]; char *h=buf; @@ -288,7 +288,7 @@ static void ICACHE_FLASH_ATTR DumpHeader(DumpState* D) /* ** dump Lua function as precompiled chunk with specified target */ -int ICACHE_FLASH_ATTR luaU_dump_crosscompile (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip, DumpTargetInfo target) +int luaU_dump_crosscompile (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip, DumpTargetInfo target) { DumpState D; D.L=L; @@ -306,7 +306,7 @@ int ICACHE_FLASH_ATTR luaU_dump_crosscompile (lua_State* L, const Proto* f, lua_ /* ** dump Lua function as precompiled chunk with local machine as target */ -int ICACHE_FLASH_ATTR luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) +int luaU_dump (lua_State* L, const Proto* f, lua_Writer w, void* data, int strip) { DumpTargetInfo target; int test=1; diff --git a/app/lua/legc.c b/app/lua/legc.c index 9dc7c050..d2285ca4 100644 --- a/app/lua/legc.c +++ b/app/lua/legc.c @@ -4,7 +4,7 @@ #include "lstate.h" #include "c_types.h" -void ICACHE_FLASH_ATTR legc_set_mode(lua_State *L, int mode, unsigned limit) { +void legc_set_mode(lua_State *L, int mode, unsigned limit) { global_State *g = G(L); g->egcmode = mode; diff --git a/app/lua/lfunc.c b/app/lua/lfunc.c index 48f0db5f..7562d00d 100644 --- a/app/lua/lfunc.c +++ b/app/lua/lfunc.c @@ -20,7 +20,7 @@ -Closure *ICACHE_FLASH_ATTR luaF_newCclosure (lua_State *L, int nelems, Table *e) { +Closure *luaF_newCclosure (lua_State *L, int nelems, Table *e) { Closure *c = cast(Closure *, luaM_malloc(L, sizeCclosure(nelems))); luaC_link(L, obj2gco(c), LUA_TFUNCTION); c->c.isC = 1; @@ -30,7 +30,7 @@ Closure *ICACHE_FLASH_ATTR luaF_newCclosure (lua_State *L, int nelems, Table *e) } -Closure *ICACHE_FLASH_ATTR luaF_newLclosure (lua_State *L, int nelems, Table *e) { +Closure *luaF_newLclosure (lua_State *L, int nelems, Table *e) { Closure *c = cast(Closure *, luaM_malloc(L, sizeLclosure(nelems))); luaC_link(L, obj2gco(c), LUA_TFUNCTION); c->l.isC = 0; @@ -41,7 +41,7 @@ Closure *ICACHE_FLASH_ATTR luaF_newLclosure (lua_State *L, int nelems, Table *e) } -UpVal *ICACHE_FLASH_ATTR luaF_newupval (lua_State *L) { +UpVal *luaF_newupval (lua_State *L) { UpVal *uv = luaM_new(L, UpVal); luaC_link(L, obj2gco(uv), LUA_TUPVAL); uv->v = &uv->u.value; @@ -50,7 +50,7 @@ UpVal *ICACHE_FLASH_ATTR luaF_newupval (lua_State *L) { } -UpVal *ICACHE_FLASH_ATTR luaF_findupval (lua_State *L, StkId level) { +UpVal *luaF_findupval (lua_State *L, StkId level) { global_State *g = G(L); GCObject **pp = &L->openupval; UpVal *p; @@ -79,21 +79,21 @@ UpVal *ICACHE_FLASH_ATTR luaF_findupval (lua_State *L, StkId level) { } -static void ICACHE_FLASH_ATTR unlinkupval (UpVal *uv) { +static void unlinkupval (UpVal *uv) { lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); uv->u.l.next->u.l.prev = uv->u.l.prev; /* remove from `uvhead' list */ uv->u.l.prev->u.l.next = uv->u.l.next; } -void ICACHE_FLASH_ATTR luaF_freeupval (lua_State *L, UpVal *uv) { +void luaF_freeupval (lua_State *L, UpVal *uv) { if (uv->v != &uv->u.value) /* is it open? */ unlinkupval(uv); /* remove from open list */ luaM_free(L, uv); /* free upvalue */ } -void ICACHE_FLASH_ATTR luaF_close (lua_State *L, StkId level) { +void luaF_close (lua_State *L, StkId level) { UpVal *uv; global_State *g = G(L); while (L->openupval != NULL && (uv = ngcotouv(L->openupval))->v >= level) { @@ -112,7 +112,7 @@ void ICACHE_FLASH_ATTR luaF_close (lua_State *L, StkId level) { } -Proto *ICACHE_FLASH_ATTR luaF_newproto (lua_State *L) { +Proto *luaF_newproto (lua_State *L) { Proto *f = luaM_new(L, Proto); luaC_link(L, obj2gco(f), LUA_TPROTO); f->k = NULL; @@ -138,7 +138,7 @@ Proto *ICACHE_FLASH_ATTR luaF_newproto (lua_State *L) { } -void ICACHE_FLASH_ATTR luaF_freeproto (lua_State *L, Proto *f) { +void luaF_freeproto (lua_State *L, Proto *f) { luaM_freearray(L, f->p, f->sizep, Proto *); luaM_freearray(L, f->k, f->sizek, TValue); luaM_freearray(L, f->locvars, f->sizelocvars, struct LocVar); @@ -151,7 +151,7 @@ void ICACHE_FLASH_ATTR luaF_freeproto (lua_State *L, Proto *f) { } -void ICACHE_FLASH_ATTR luaF_freeclosure (lua_State *L, Closure *c) { +void luaF_freeclosure (lua_State *L, Closure *c) { int size = (c->c.isC) ? sizeCclosure(c->c.nupvalues) : sizeLclosure(c->l.nupvalues); luaM_freemem(L, c, size); @@ -162,7 +162,7 @@ void ICACHE_FLASH_ATTR luaF_freeclosure (lua_State *L, Closure *c) { ** Look for n-th local variable at line `line' in function `func'. ** Returns NULL if not found. */ -const char *ICACHE_FLASH_ATTR luaF_getlocalname (const Proto *f, int local_number, int pc) { +const char *luaF_getlocalname (const Proto *f, int local_number, int pc) { int i; for (i = 0; isizelocvars && f->locvars[i].startpc <= pc; i++) { if (pc < f->locvars[i].endpc) { /* is variable active? */ diff --git a/app/lua/lgc.c b/app/lua/lgc.c index 77beaa31..d9c89716 100644 --- a/app/lua/lgc.c +++ b/app/lua/lgc.c @@ -59,14 +59,14 @@ #define setthreshold(g) (g->GCthreshold = (g->estimate/100) * g->gcpause) -static void ICACHE_FLASH_ATTR removeentry (Node *n) { +static void removeentry (Node *n) { lua_assert(ttisnil(gval(n))); if (iscollectable(gkey(n))) setttype(gkey(n), LUA_TDEADKEY); /* dead key; remove it */ } -static void ICACHE_FLASH_ATTR reallymarkobject (global_State *g, GCObject *o) { +static void reallymarkobject (global_State *g, GCObject *o) { lua_assert(iswhite(o) && !isdead(g, o)); white2gray(o); switch (o->gch.tt) { @@ -112,7 +112,7 @@ static void ICACHE_FLASH_ATTR reallymarkobject (global_State *g, GCObject *o) { } -static void ICACHE_FLASH_ATTR marktmu (global_State *g) { +static void marktmu (global_State *g) { GCObject *u = g->tmudata; if (u) { do { @@ -125,7 +125,7 @@ static void ICACHE_FLASH_ATTR marktmu (global_State *g) { /* move `dead' udata that need finalization to list `tmudata' */ -size_t ICACHE_FLASH_ATTR luaC_separateudata (lua_State *L, int all) { +size_t luaC_separateudata (lua_State *L, int all) { global_State *g = G(L); size_t deadmem = 0; GCObject **p = &g->mainthread->next; @@ -155,7 +155,7 @@ size_t ICACHE_FLASH_ATTR luaC_separateudata (lua_State *L, int all) { } -static int ICACHE_FLASH_ATTR traversetable (global_State *g, Table *h) { +static int traversetable (global_State *g, Table *h) { int i; int weakkey = 0; int weakvalue = 0; @@ -200,7 +200,7 @@ static int ICACHE_FLASH_ATTR traversetable (global_State *g, Table *h) { ** All marks are conditional because a GC may happen while the ** prototype is still being created */ -static void ICACHE_FLASH_ATTR traverseproto (global_State *g, Proto *f) { +static void traverseproto (global_State *g, Proto *f) { int i; if (f->source) stringmark(f->source); for (i=0; isizek; i++) /* mark literals */ @@ -221,7 +221,7 @@ static void ICACHE_FLASH_ATTR traverseproto (global_State *g, Proto *f) { -static void ICACHE_FLASH_ATTR traverseclosure (global_State *g, Closure *cl) { +static void traverseclosure (global_State *g, Closure *cl) { markobject(g, cl->c.env); if (cl->c.isC) { int i; @@ -240,7 +240,7 @@ static void ICACHE_FLASH_ATTR traverseclosure (global_State *g, Closure *cl) { } -static void ICACHE_FLASH_ATTR checkstacksizes (lua_State *L, StkId max) { +static void checkstacksizes (lua_State *L, StkId max) { int ci_used = cast_int(L->ci - L->base_ci); /* number of `ci' in use */ int s_used = cast_int(max - L->stack); /* part of stack in use */ if (L->size_ci > LUAI_MAXCALLS) /* handling overflow? */ @@ -255,7 +255,7 @@ static void ICACHE_FLASH_ATTR checkstacksizes (lua_State *L, StkId max) { } -static void ICACHE_FLASH_ATTR traversestack (global_State *g, lua_State *l) { +static void traversestack (global_State *g, lua_State *l) { StkId o, lim; CallInfo *ci; markvalue(g, gt(l)); @@ -278,7 +278,7 @@ static void ICACHE_FLASH_ATTR traversestack (global_State *g, lua_State *l) { ** traverse one gray object, turning it to black. ** Returns `quantity' traversed. */ -static l_mem ICACHE_FLASH_ATTR propagatemark (global_State *g) { +static l_mem propagatemark (global_State *g) { GCObject *o = g->gray; lua_assert(isgray(o)); gray2black(o); @@ -324,7 +324,7 @@ static l_mem ICACHE_FLASH_ATTR propagatemark (global_State *g) { } -static size_t ICACHE_FLASH_ATTR propagateall (global_State *g) { +static size_t propagateall (global_State *g) { size_t m = 0; while (g->gray) m += propagatemark(g); return m; @@ -338,7 +338,7 @@ static size_t ICACHE_FLASH_ATTR propagateall (global_State *g) { ** other objects: if really collected, cannot keep them; for userdata ** being finalized, keep them in keys, but not in values */ -static int ICACHE_FLASH_ATTR iscleared (const TValue *o, int iskey) { +static int iscleared (const TValue *o, int iskey) { if (!iscollectable(o)) return 0; if (ttisstring(o)) { stringmark(rawtsvalue(o)); /* strings are `values', so are never weak */ @@ -352,7 +352,7 @@ static int ICACHE_FLASH_ATTR iscleared (const TValue *o, int iskey) { /* ** clear collected entries from weaktables */ -static void ICACHE_FLASH_ATTR cleartable (GCObject *l) { +static void cleartable (GCObject *l) { while (l) { Table *h = gco2h(l); int i = h->sizearray; @@ -379,7 +379,7 @@ static void ICACHE_FLASH_ATTR cleartable (GCObject *l) { } -static void ICACHE_FLASH_ATTR freeobj (lua_State *L, GCObject *o) { +static void freeobj (lua_State *L, GCObject *o) { switch (o->gch.tt) { case LUA_TPROTO: luaF_freeproto(L, gco2p(o)); break; case LUA_TFUNCTION: luaF_freeclosure(L, gco2cl(o)); break; @@ -408,7 +408,7 @@ static void ICACHE_FLASH_ATTR freeobj (lua_State *L, GCObject *o) { #define sweepwholelist(L,p) sweeplist(L,p,MAX_LUMEM) -static GCObject **ICACHE_FLASH_ATTR sweeplist (lua_State *L, GCObject **p, lu_mem count) { +static GCObject **sweeplist (lua_State *L, GCObject **p, lu_mem count) { GCObject *curr; global_State *g = G(L); int deadmask = otherwhite(g); @@ -430,7 +430,7 @@ static GCObject **ICACHE_FLASH_ATTR sweeplist (lua_State *L, GCObject **p, lu_me } -static void ICACHE_FLASH_ATTR checkSizes (lua_State *L) { +static void checkSizes (lua_State *L) { global_State *g = G(L); /* check size of string hash */ if (g->strt.nuse < cast(lu_int32, g->strt.size/4) && @@ -446,7 +446,7 @@ static void ICACHE_FLASH_ATTR checkSizes (lua_State *L) { } -static void ICACHE_FLASH_ATTR GCTM (lua_State *L) { +static void GCTM (lua_State *L) { global_State *g = G(L); GCObject *o = g->tmudata->gch.next; /* get first element */ Udata *udata = rawgco2u(o); @@ -478,13 +478,13 @@ static void ICACHE_FLASH_ATTR GCTM (lua_State *L) { /* ** Call all GC tag methods */ -void ICACHE_FLASH_ATTR luaC_callGCTM (lua_State *L) { +void luaC_callGCTM (lua_State *L) { while (G(L)->tmudata) GCTM(L); } -void ICACHE_FLASH_ATTR luaC_freeall (lua_State *L) { +void luaC_freeall (lua_State *L) { global_State *g = G(L); int i; g->currentwhite = WHITEBITS | bitmask(SFIXEDBIT); /* mask to collect all elements */ @@ -494,7 +494,7 @@ void ICACHE_FLASH_ATTR luaC_freeall (lua_State *L) { } -static void ICACHE_FLASH_ATTR markmt (global_State *g) { +static void markmt (global_State *g) { int i; for (i=0; imt[i] && !luaR_isrotable(g->mt[i])) markobject(g, g->mt[i]); @@ -502,7 +502,7 @@ static void ICACHE_FLASH_ATTR markmt (global_State *g) { /* mark root set */ -static void ICACHE_FLASH_ATTR markroot (lua_State *L) { +static void markroot (lua_State *L) { global_State *g = G(L); g->gray = NULL; g->grayagain = NULL; @@ -516,7 +516,7 @@ static void ICACHE_FLASH_ATTR markroot (lua_State *L) { } -static void ICACHE_FLASH_ATTR remarkupvals (global_State *g) { +static void remarkupvals (global_State *g) { UpVal *uv; for (uv = g->uvhead.u.l.next; uv != &g->uvhead; uv = uv->u.l.next) { lua_assert(uv->u.l.next->u.l.prev == uv && uv->u.l.prev->u.l.next == uv); @@ -526,7 +526,7 @@ static void ICACHE_FLASH_ATTR remarkupvals (global_State *g) { } -static void ICACHE_FLASH_ATTR atomic (lua_State *L) { +static void atomic (lua_State *L) { global_State *g = G(L); size_t udsize; /* total size of userdata to be finalized */ /* remark occasional upvalues of (maybe) dead threads */ @@ -556,7 +556,7 @@ static void ICACHE_FLASH_ATTR atomic (lua_State *L) { g->estimate = g->totalbytes - udsize; /* first estimate */ } -static void ICACHE_FLASH_ATTR sweepstrstep (global_State *g, lua_State *L) { +static void sweepstrstep (global_State *g, lua_State *L) { lu_mem old = g->totalbytes; sweepwholelist(L, &g->strt.hash[g->sweepstrgc++]); if (g->sweepstrgc >= g->strt.size) /* nothing more to sweep? */ @@ -566,7 +566,7 @@ static void ICACHE_FLASH_ATTR sweepstrstep (global_State *g, lua_State *L) { } -static l_mem ICACHE_FLASH_ATTR singlestep (lua_State *L) { +static l_mem singlestep (lua_State *L) { global_State *g = G(L); /*lua_checkmemory(L);*/ switch (g->gcstate) { @@ -615,7 +615,7 @@ static l_mem ICACHE_FLASH_ATTR singlestep (lua_State *L) { } -void ICACHE_FLASH_ATTR luaC_step (lua_State *L) { +void luaC_step (lua_State *L) { global_State *g = G(L); if(is_block_gc(L)) return; set_block_gc(L); @@ -645,7 +645,7 @@ void ICACHE_FLASH_ATTR luaC_step (lua_State *L) { unset_block_gc(L); } -int ICACHE_FLASH_ATTR luaC_sweepstrgc (lua_State *L) { +int luaC_sweepstrgc (lua_State *L) { global_State *g = G(L); if (g->gcstate == GCSsweepstring) { sweepstrstep(g, L); @@ -654,7 +654,7 @@ int ICACHE_FLASH_ATTR luaC_sweepstrgc (lua_State *L) { return 0; } -void ICACHE_FLASH_ATTR luaC_fullgc (lua_State *L) { +void luaC_fullgc (lua_State *L) { global_State *g = G(L); if(is_block_gc(L)) return; set_block_gc(L); @@ -683,7 +683,7 @@ void ICACHE_FLASH_ATTR luaC_fullgc (lua_State *L) { } -void ICACHE_FLASH_ATTR luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { +void luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { global_State *g = G(L); lua_assert(isblack(o) && iswhite(v) && !isdead(g, v) && !isdead(g, o)); lua_assert(g->gcstate != GCSfinalize && g->gcstate != GCSpause); @@ -696,7 +696,7 @@ void ICACHE_FLASH_ATTR luaC_barrierf (lua_State *L, GCObject *o, GCObject *v) { } -void ICACHE_FLASH_ATTR luaC_barrierback (lua_State *L, Table *t) { +void luaC_barrierback (lua_State *L, Table *t) { global_State *g = G(L); GCObject *o = obj2gco(t); lua_assert(isblack(o) && !isdead(g, o)); @@ -707,7 +707,7 @@ void ICACHE_FLASH_ATTR luaC_barrierback (lua_State *L, Table *t) { } -void ICACHE_FLASH_ATTR luaC_marknew (lua_State *L, GCObject *o) { +void luaC_marknew (lua_State *L, GCObject *o) { global_State *g = G(L); o->gch.marked = luaC_white(g); if (g->gcstate == GCSpropagate) @@ -715,7 +715,7 @@ void ICACHE_FLASH_ATTR luaC_marknew (lua_State *L, GCObject *o) { } -void ICACHE_FLASH_ATTR luaC_link (lua_State *L, GCObject *o, lu_byte tt) { +void luaC_link (lua_State *L, GCObject *o, lu_byte tt) { global_State *g = G(L); o->gch.next = g->rootgc; g->rootgc = o; @@ -724,7 +724,7 @@ void ICACHE_FLASH_ATTR luaC_link (lua_State *L, GCObject *o, lu_byte tt) { } -void ICACHE_FLASH_ATTR luaC_linkupval (lua_State *L, UpVal *uv) { +void luaC_linkupval (lua_State *L, UpVal *uv) { global_State *g = G(L); GCObject *o = obj2gco(uv); o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ diff --git a/app/lua/linit.c b/app/lua/linit.c index 2d85cad7..872321ef 100644 --- a/app/lua/linit.c +++ b/app/lua/linit.c @@ -71,7 +71,7 @@ const luaR_table lua_rotable[] = {NULL, NULL} }; -LUALIB_API void ICACHE_FLASH_ATTR luaL_openlibs (lua_State *L) { +LUALIB_API void luaL_openlibs (lua_State *L) { const luaL_Reg *lib = lualibs; for (; lib->func; lib++) { lua_pushcfunction(L, lib->func); diff --git a/app/lua/liolib.c b/app/lua/liolib.c index 5334bb32..b6e377ff 100644 --- a/app/lua/liolib.c +++ b/app/lua/liolib.c @@ -38,7 +38,7 @@ static const int liolib_keys[] = {(int)&luaL_callmeta, (int)&luaL_typerror, (int static const char *const fnames[] = {"input", "output"}; -static int ICACHE_FLASH_ATTR pushresult (lua_State *L, int i, const char *filename) { +static int pushresult (lua_State *L, int i, const char *filename) { int en = fs_error(0); /* calls to Lua API may change this value */ if (i) { lua_pushboolean(L, 1); @@ -56,7 +56,7 @@ static int ICACHE_FLASH_ATTR pushresult (lua_State *L, int i, const char *filena } -static void ICACHE_FLASH_ATTR fileerror (lua_State *L, int arg, const char *filename) { +static void fileerror (lua_State *L, int arg, const char *filename) { lua_pushfstring(L, "%s: err(%d)", filename, fs_error(0)); luaL_argerror(L, arg, lua_tostring(L, -1)); } @@ -65,7 +65,7 @@ static void ICACHE_FLASH_ATTR fileerror (lua_State *L, int arg, const char *file #define tofilep(L) ((int *)luaL_checkudata(L, 1, LUA_FILEHANDLE)) -static int ICACHE_FLASH_ATTR io_type (lua_State *L) { +static int io_type (lua_State *L) { void *ud; luaL_checkany(L, 1); ud = lua_touserdata(L, 1); @@ -80,7 +80,7 @@ static int ICACHE_FLASH_ATTR io_type (lua_State *L) { } -static int ICACHE_FLASH_ATTR tofile (lua_State *L) { +static int tofile (lua_State *L) { int *f = tofilep(L); if (*f < FS_OPEN_OK) luaL_error(L, "attempt to use a closed file"); @@ -94,7 +94,7 @@ static int ICACHE_FLASH_ATTR tofile (lua_State *L) { ** before opening the actual file; so, if there is a memory error, the ** file is not left opened. */ -static int *ICACHE_FLASH_ATTR newfile (lua_State *L) { +static int *newfile (lua_State *L) { int *pf = (int *)lua_newuserdata(L, sizeof(int)); *pf = FS_OPEN_OK - 1; /* file handle is currently `closed' */ luaL_getmetatable(L, LUA_FILEHANDLE); @@ -107,7 +107,7 @@ static int *ICACHE_FLASH_ATTR newfile (lua_State *L) { /* ** function to (not) close the standard files stdin, stdout, and stderr */ -static int ICACHE_FLASH_ATTR io_noclose (lua_State *L) { +static int io_noclose (lua_State *L) { lua_pushnil(L); lua_pushliteral(L, "cannot close standard file"); return 2; @@ -117,7 +117,7 @@ static int ICACHE_FLASH_ATTR io_noclose (lua_State *L) { /* ** function to close 'popen' files */ -static int ICACHE_FLASH_ATTR io_pclose (lua_State *L) { +static int io_pclose (lua_State *L) { int *p = tofilep(L); int ok = lua_pclose(L, *p); *p = FS_OPEN_OK - 1; @@ -128,7 +128,7 @@ static int ICACHE_FLASH_ATTR io_pclose (lua_State *L) { /* ** function to close regular files */ -static int ICACHE_FLASH_ATTR io_fclose (lua_State *L) { +static int io_fclose (lua_State *L) { int *p = tofilep(L); int ok = (fs_close(*p) == 0); *p = FS_OPEN_OK - 1; @@ -136,7 +136,7 @@ static int ICACHE_FLASH_ATTR io_fclose (lua_State *L) { } #endif -static int ICACHE_FLASH_ATTR aux_close (lua_State *L) { +static int aux_close (lua_State *L) { #if LUA_OPTIMIZE_MEMORY != 2 lua_getfenv(L, 1); lua_getfield(L, -1, "__close"); @@ -156,7 +156,7 @@ static int ICACHE_FLASH_ATTR aux_close (lua_State *L) { } -static int ICACHE_FLASH_ATTR io_close (lua_State *L) { +static int io_close (lua_State *L) { if (lua_isnone(L, 1)) LUA_IO_GETFIELD(IO_OUTPUT); tofile(L); /* make sure argument is a file */ @@ -164,7 +164,7 @@ static int ICACHE_FLASH_ATTR io_close (lua_State *L) { } -static int ICACHE_FLASH_ATTR io_gc (lua_State *L) { +static int io_gc (lua_State *L) { int f = *tofilep(L); /* ignore closed files */ if (f != FS_OPEN_OK - 1) @@ -173,7 +173,7 @@ static int ICACHE_FLASH_ATTR io_gc (lua_State *L) { } -static int ICACHE_FLASH_ATTR io_tostring (lua_State *L) { +static int io_tostring (lua_State *L) { int f = *tofilep(L); if (f == FS_OPEN_OK - 1) lua_pushliteral(L, "file (closed)"); @@ -183,7 +183,7 @@ static int ICACHE_FLASH_ATTR io_tostring (lua_State *L) { } -static int ICACHE_FLASH_ATTR io_open (lua_State *L) { +static int io_open (lua_State *L) { const char *filename = luaL_checkstring(L, 1); const char *mode = luaL_optstring(L, 2, "r"); int *pf = newfile(L); @@ -197,7 +197,7 @@ static int ICACHE_FLASH_ATTR io_open (lua_State *L) { ** correct __close for 'popen' files */ #if 0 -static int ICACHE_FLASH_ATTR io_popen (lua_State *L) { +static int io_popen (lua_State *L) { const char *filename = luaL_checkstring(L, 1); const char *mode = luaL_optstring(L, 2, "r"); int *pf = newfile(L); @@ -206,14 +206,14 @@ static int ICACHE_FLASH_ATTR io_popen (lua_State *L) { } -static int ICACHE_FLASH_ATTR io_tmpfile (lua_State *L) { +static int io_tmpfile (lua_State *L) { int *pf = newfile(L); *pf = tmpfile(); return (*pf == FS_OPEN_OK - 1) ? pushresult(L, 0, NULL) : 1; } #endif -static int ICACHE_FLASH_ATTR getiofile (lua_State *L, int findex) { +static int getiofile (lua_State *L, int findex) { int *pf; LUA_IO_GETFIELD(findex); pf = (int *)lua_touserdata(L, -1); @@ -225,7 +225,7 @@ static int ICACHE_FLASH_ATTR getiofile (lua_State *L, int findex) { } -static int ICACHE_FLASH_ATTR g_iofile (lua_State *L, int f, const char *mode) { +static int g_iofile (lua_State *L, int f, const char *mode) { if (!lua_isnoneornil(L, 1)) { const char *filename = lua_tostring(L, 1); if (filename) { @@ -246,34 +246,34 @@ static int ICACHE_FLASH_ATTR g_iofile (lua_State *L, int f, const char *mode) { } -static int ICACHE_FLASH_ATTR io_input (lua_State *L) { +static int io_input (lua_State *L) { return g_iofile(L, IO_INPUT, "r"); } -static int ICACHE_FLASH_ATTR io_output (lua_State *L) { +static int io_output (lua_State *L) { return g_iofile(L, IO_OUTPUT, "w"); } -static int ICACHE_FLASH_ATTR io_readline (lua_State *L); +static int io_readline (lua_State *L); -static void ICACHE_FLASH_ATTR aux_lines (lua_State *L, int idx, int toclose) { +static void aux_lines (lua_State *L, int idx, int toclose) { lua_pushvalue(L, idx); lua_pushboolean(L, toclose); /* close/not close file when finished */ lua_pushcclosure(L, io_readline, 2); } -static int ICACHE_FLASH_ATTR f_lines (lua_State *L) { +static int f_lines (lua_State *L) { tofile(L); /* check that it's a valid file handle */ aux_lines(L, 1, 0); return 1; } -static int ICACHE_FLASH_ATTR io_lines (lua_State *L) { +static int io_lines (lua_State *L) { if (lua_isnoneornil(L, 1)) { /* no arguments? */ /* will iterate over default input */ LUA_IO_GETFIELD(IO_INPUT); @@ -298,7 +298,7 @@ static int ICACHE_FLASH_ATTR io_lines (lua_State *L) { */ #if 0 -static int ICACHE_FLASH_ATTR read_number (lua_State *L, int f) { +static int read_number (lua_State *L, int f) { lua_Number d; if (fs_scanf(f, LUA_NUMBER_SCAN, &d) == 1) { lua_pushnumber(L, d); @@ -311,7 +311,7 @@ static int ICACHE_FLASH_ATTR read_number (lua_State *L, int f) { } #endif -static int ICACHE_FLASH_ATTR test_eof (lua_State *L, int f) { +static int test_eof (lua_State *L, int f) { int c = fs_getc(f); fs_ungetc(c, f); lua_pushlstring(L, NULL, 0); @@ -319,7 +319,7 @@ static int ICACHE_FLASH_ATTR test_eof (lua_State *L, int f) { } #if 0 -static int ICACHE_FLASH_ATTR read_line (lua_State *L, int f) { +static int read_line (lua_State *L, int f) { luaL_Buffer b; luaL_buffinit(L, &b); for (;;) { @@ -340,7 +340,7 @@ static int ICACHE_FLASH_ATTR read_line (lua_State *L, int f) { } } #else -static int ICACHE_FLASH_ATTR read_line (lua_State *L, int f) { +static int read_line (lua_State *L, int f) { luaL_Buffer b; luaL_buffinit(L, &b); char *p = luaL_prepbuffer(&b); @@ -368,7 +368,7 @@ static int ICACHE_FLASH_ATTR read_line (lua_State *L, int f) { } #endif -static int ICACHE_FLASH_ATTR read_chars (lua_State *L, int f, size_t n) { +static int read_chars (lua_State *L, int f, size_t n) { size_t rlen; /* how much to read */ size_t nr; /* number of chars actually read */ luaL_Buffer b; @@ -386,7 +386,7 @@ static int ICACHE_FLASH_ATTR read_chars (lua_State *L, int f, size_t n) { } -static int ICACHE_FLASH_ATTR g_read (lua_State *L, int f, int first) { +static int g_read (lua_State *L, int f, int first) { int nargs = lua_gettop(L) - 1; int success; int n; @@ -435,17 +435,17 @@ static int ICACHE_FLASH_ATTR g_read (lua_State *L, int f, int first) { } -static int ICACHE_FLASH_ATTR io_read (lua_State *L) { +static int io_read (lua_State *L) { return g_read(L, getiofile(L, IO_INPUT), 1); } -static int ICACHE_FLASH_ATTR f_read (lua_State *L) { +static int f_read (lua_State *L) { return g_read(L, tofile(L), 2); } -static int ICACHE_FLASH_ATTR io_readline (lua_State *L) { +static int io_readline (lua_State *L) { int *pf = (int *)lua_touserdata(L, lua_upvalueindex(1)); int sucess; if (pf == NULL || *pf == FS_OPEN_OK - 1){ /* file is already closed? */ @@ -469,7 +469,7 @@ static int ICACHE_FLASH_ATTR io_readline (lua_State *L) { /* }====================================================== */ -static int ICACHE_FLASH_ATTR g_write (lua_State *L, int f, int arg) { +static int g_write (lua_State *L, int f, int arg) { int nargs = lua_gettop(L) - 1; int status = 1; for (; nargs--; arg++) { @@ -491,17 +491,17 @@ static int ICACHE_FLASH_ATTR g_write (lua_State *L, int f, int arg) { } -static int ICACHE_FLASH_ATTR io_write (lua_State *L) { +static int io_write (lua_State *L) { return g_write(L, getiofile(L, IO_OUTPUT), 1); } -static int ICACHE_FLASH_ATTR f_write (lua_State *L) { +static int f_write (lua_State *L) { return g_write(L, tofile(L), 2); } -static int ICACHE_FLASH_ATTR f_seek (lua_State *L) { +static int f_seek (lua_State *L) { static const int mode[] = {FS_SEEK_SET, FS_SEEK_CUR, FS_SEEK_END}; static const char *const modenames[] = {"set", "cur", "end", NULL}; int f = tofile(L); @@ -517,7 +517,7 @@ static int ICACHE_FLASH_ATTR f_seek (lua_State *L) { } #if 0 -static int ICACHE_FLASH_ATTR f_setvbuf (lua_State *L) { +static int f_setvbuf (lua_State *L) { static const int mode[] = {_IONBF, _IOFBF, _IOLBF}; static const char *const modenames[] = {"no", "full", "line", NULL}; int f = tofile(L); @@ -529,12 +529,12 @@ static int ICACHE_FLASH_ATTR f_setvbuf (lua_State *L) { #endif -static int ICACHE_FLASH_ATTR io_flush (lua_State *L) { +static int io_flush (lua_State *L) { return pushresult(L, fs_flush(getiofile(L, IO_OUTPUT)) == 0, NULL); } -static int ICACHE_FLASH_ATTR f_flush (lua_State *L) { +static int f_flush (lua_State *L) { return pushresult(L, fs_flush(tofile(L)) == 0, NULL); } @@ -560,7 +560,7 @@ const LUA_REG_TYPE iolib[] = { }; #if LUA_OPTIMIZE_MEMORY == 2 -static int ICACHE_FLASH_ATTR luaL_index(lua_State *L) +static int luaL_index(lua_State *L) { return luaR_findfunction(L, iolib_funcs); } @@ -590,7 +590,7 @@ const LUA_REG_TYPE flib[] = { {LNILKEY, LNILVAL} }; -static void ICACHE_FLASH_ATTR createmeta (lua_State *L) { +static void createmeta (lua_State *L) { #if LUA_OPTIMIZE_MEMORY == 0 luaL_newmetatable(L, LUA_FILEHANDLE); /* create metatable for file handles */ lua_pushvalue(L, -1); /* push metatable */ @@ -602,7 +602,7 @@ static void ICACHE_FLASH_ATTR createmeta (lua_State *L) { } -static void ICACHE_FLASH_ATTR createstdfile (lua_State *L, int f, int k, const char *fname) { +static void createstdfile (lua_State *L, int f, int k, const char *fname) { *newfile(L) = f; #if LUA_OPTIMIZE_MEMORY != 2 if (k > 0) { @@ -620,14 +620,14 @@ static void ICACHE_FLASH_ATTR createstdfile (lua_State *L, int f, int k, const c } #if LUA_OPTIMIZE_MEMORY != 2 -static void ICACHE_FLASH_ATTR newfenv (lua_State *L, lua_CFunction cls) { +static void newfenv (lua_State *L, lua_CFunction cls) { lua_createtable(L, 0, 1); lua_pushcfunction(L, cls); lua_setfield(L, -2, "__close"); } #endif -LUALIB_API int ICACHE_FLASH_ATTR luaopen_io (lua_State *L) { +LUALIB_API int luaopen_io (lua_State *L) { createmeta(L); #if LUA_OPTIMIZE_MEMORY != 2 /* create (private) environment (with fields IO_INPUT, IO_OUTPUT, __close) */ diff --git a/app/lua/llex.c b/app/lua/llex.c index 398b3c38..11db1a64 100644 --- a/app/lua/llex.c +++ b/app/lua/llex.c @@ -48,7 +48,7 @@ const char *const luaX_tokens [] = { #define save_and_next(ls) (save(ls, ls->current), next(ls)) -static void ICACHE_FLASH_ATTR save (LexState *ls, int c) { +static void save (LexState *ls, int c) { Mbuffer *b = ls->buff; if (b->n + 1 > b->buffsize) { size_t newsize; @@ -61,14 +61,14 @@ static void ICACHE_FLASH_ATTR save (LexState *ls, int c) { } -void ICACHE_FLASH_ATTR luaX_init (lua_State *L) { +void luaX_init (lua_State *L) { } #define MAXSRC 80 -const char *ICACHE_FLASH_ATTR luaX_token2str (LexState *ls, int token) { +const char *luaX_token2str (LexState *ls, int token) { if (token < FIRST_RESERVED) { lua_assert(token == cast(unsigned char, token)); return (iscntrl(token)) ? luaO_pushfstring(ls->L, "char(%d)", token) : @@ -79,7 +79,7 @@ const char *ICACHE_FLASH_ATTR luaX_token2str (LexState *ls, int token) { } -static const char *ICACHE_FLASH_ATTR txtToken (LexState *ls, int token) { +static const char *txtToken (LexState *ls, int token) { switch (token) { case TK_NAME: case TK_STRING: @@ -92,7 +92,7 @@ static const char *ICACHE_FLASH_ATTR txtToken (LexState *ls, int token) { } -void ICACHE_FLASH_ATTR luaX_lexerror (LexState *ls, const char *msg, int token) { +void luaX_lexerror (LexState *ls, const char *msg, int token) { char buff[MAXSRC]; luaO_chunkid(buff, getstr(ls->source), MAXSRC); msg = luaO_pushfstring(ls->L, "%s:%d: %s", buff, ls->linenumber, msg); @@ -102,12 +102,12 @@ void ICACHE_FLASH_ATTR luaX_lexerror (LexState *ls, const char *msg, int token) } -void ICACHE_FLASH_ATTR luaX_syntaxerror (LexState *ls, const char *msg) { +void luaX_syntaxerror (LexState *ls, const char *msg) { luaX_lexerror(ls, msg, ls->t.token); } -TString *ICACHE_FLASH_ATTR luaX_newstring (LexState *ls, const char *str, size_t l) { +TString *luaX_newstring (LexState *ls, const char *str, size_t l) { lua_State *L = ls->L; TString *ts = luaS_newlstr(L, str, l); TValue *o = luaH_setstr(L, ls->fs->h, ts); /* entry for `str' */ @@ -119,7 +119,7 @@ TString *ICACHE_FLASH_ATTR luaX_newstring (LexState *ls, const char *str, size_t } -static void ICACHE_FLASH_ATTR inclinenumber (LexState *ls) { +static void inclinenumber (LexState *ls) { int old = ls->current; lua_assert(currIsNewline(ls)); next(ls); /* skip `\n' or `\r' */ @@ -130,7 +130,7 @@ static void ICACHE_FLASH_ATTR inclinenumber (LexState *ls) { } -void ICACHE_FLASH_ATTR luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { +void luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TString *source) { ls->decpoint = '.'; ls->L = L; ls->lookahead.token = TK_EOS; /* no look-ahead token */ @@ -153,7 +153,7 @@ void ICACHE_FLASH_ATTR luaX_setinput (lua_State *L, LexState *ls, ZIO *z, TStrin -static int ICACHE_FLASH_ATTR check_next (LexState *ls, const char *set) { +static int check_next (LexState *ls, const char *set) { if (!c_strchr(set, ls->current)) return 0; save_and_next(ls); @@ -161,7 +161,7 @@ static int ICACHE_FLASH_ATTR check_next (LexState *ls, const char *set) { } -static void ICACHE_FLASH_ATTR buffreplace (LexState *ls, char from, char to) { +static void buffreplace (LexState *ls, char from, char to) { size_t n = luaZ_bufflen(ls->buff); char *p = luaZ_buffer(ls->buff); while (n--) @@ -169,7 +169,7 @@ static void ICACHE_FLASH_ATTR buffreplace (LexState *ls, char from, char to) { } -static void ICACHE_FLASH_ATTR trydecpoint (LexState *ls, SemInfo *seminfo) { +static void trydecpoint (LexState *ls, SemInfo *seminfo) { /* format error: try to update decimal point separator */ struct lconv *cv = localeconv(); char old = ls->decpoint; @@ -184,7 +184,7 @@ static void ICACHE_FLASH_ATTR trydecpoint (LexState *ls, SemInfo *seminfo) { /* LUA_NUMBER */ -static void ICACHE_FLASH_ATTR read_numeral (LexState *ls, SemInfo *seminfo) { +static void read_numeral (LexState *ls, SemInfo *seminfo) { lua_assert(isdigit(ls->current)); do { save_and_next(ls); @@ -200,7 +200,7 @@ static void ICACHE_FLASH_ATTR read_numeral (LexState *ls, SemInfo *seminfo) { } -static int ICACHE_FLASH_ATTR skip_sep (LexState *ls) { +static int skip_sep (LexState *ls) { int count = 0; int s = ls->current; lua_assert(s == '[' || s == ']'); @@ -213,7 +213,7 @@ static int ICACHE_FLASH_ATTR skip_sep (LexState *ls) { } -static void ICACHE_FLASH_ATTR read_long_string (LexState *ls, SemInfo *seminfo, int sep) { +static void read_long_string (LexState *ls, SemInfo *seminfo, int sep) { int cont = 0; (void)(cont); /* avoid warnings when `cont' is not used */ save_and_next(ls); /* skip 2nd `[' */ @@ -268,7 +268,7 @@ static void ICACHE_FLASH_ATTR read_long_string (LexState *ls, SemInfo *seminfo, } -static void ICACHE_FLASH_ATTR read_string (LexState *ls, int del, SemInfo *seminfo) { +static void read_string (LexState *ls, int del, SemInfo *seminfo) { save_and_next(ls); while (ls->current != del) { switch (ls->current) { @@ -324,7 +324,7 @@ static void ICACHE_FLASH_ATTR read_string (LexState *ls, int del, SemInfo *semin } -static int ICACHE_FLASH_ATTR llex (LexState *ls, SemInfo *seminfo) { +static int llex (LexState *ls, SemInfo *seminfo) { luaZ_resetbuffer(ls->buff); for (;;) { switch (ls->current) { @@ -440,7 +440,7 @@ static int ICACHE_FLASH_ATTR llex (LexState *ls, SemInfo *seminfo) { } -void ICACHE_FLASH_ATTR luaX_next (LexState *ls) { +void luaX_next (LexState *ls) { ls->lastline = ls->linenumber; if (ls->lookahead.token != TK_EOS) { /* is there a look-ahead token? */ ls->t = ls->lookahead; /* use this one */ @@ -451,7 +451,7 @@ void ICACHE_FLASH_ATTR luaX_next (LexState *ls) { } -void ICACHE_FLASH_ATTR luaX_lookahead (LexState *ls) { +void luaX_lookahead (LexState *ls) { lua_assert(ls->lookahead.token == TK_EOS); ls->lookahead.token = llex(ls, &ls->lookahead.seminfo); } diff --git a/app/lua/lmathlib.c b/app/lua/lmathlib.c index bdcad18f..d9630518 100644 --- a/app/lua/lmathlib.c +++ b/app/lua/lmathlib.c @@ -23,7 +23,7 @@ -static int ICACHE_FLASH_ATTR math_abs (lua_State *L) { +static int math_abs (lua_State *L) { #ifdef LUA_NUMBER_INTEGRAL lua_Number x = luaL_checknumber(L, 1); if (x < 0) x = -x; //fails for -2^31 @@ -36,72 +36,72 @@ static int ICACHE_FLASH_ATTR math_abs (lua_State *L) { #ifndef LUA_NUMBER_INTEGRAL -static int ICACHE_FLASH_ATTR math_sin (lua_State *L) { +static int math_sin (lua_State *L) { lua_pushnumber(L, sin(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_sinh (lua_State *L) { +static int math_sinh (lua_State *L) { lua_pushnumber(L, sinh(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_cos (lua_State *L) { +static int math_cos (lua_State *L) { lua_pushnumber(L, cos(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_cosh (lua_State *L) { +static int math_cosh (lua_State *L) { lua_pushnumber(L, cosh(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_tan (lua_State *L) { +static int math_tan (lua_State *L) { lua_pushnumber(L, tan(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_tanh (lua_State *L) { +static int math_tanh (lua_State *L) { lua_pushnumber(L, tanh(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_asin (lua_State *L) { +static int math_asin (lua_State *L) { lua_pushnumber(L, asin(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_acos (lua_State *L) { +static int math_acos (lua_State *L) { lua_pushnumber(L, acos(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_atan (lua_State *L) { +static int math_atan (lua_State *L) { lua_pushnumber(L, atan(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_atan2 (lua_State *L) { +static int math_atan2 (lua_State *L) { lua_pushnumber(L, atan2(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); return 1; } -static int ICACHE_FLASH_ATTR math_ceil (lua_State *L) { +static int math_ceil (lua_State *L) { lua_pushnumber(L, ceil(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_floor (lua_State *L) { +static int math_floor (lua_State *L) { lua_pushnumber(L, floor(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_fmod (lua_State *L) { +static int math_fmod (lua_State *L) { lua_pushnumber(L, fmod(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); return 1; } -static int ICACHE_FLASH_ATTR math_modf (lua_State *L) { +static int math_modf (lua_State *L) { double ip; double fp = modf(luaL_checknumber(L, 1), &ip); lua_pushnumber(L, ip); @@ -116,7 +116,7 @@ static int ICACHE_FLASH_ATTR math_modf (lua_State *L) { // works in both integer and floating point versions of Lua. // This identity function is used for them. -static int ICACHE_FLASH_ATTR math_identity (lua_State *L) { +static int math_identity (lua_State *L) { lua_pushnumber(L, luaL_checknumber(L, 1)); return 1; } @@ -125,7 +125,7 @@ static int ICACHE_FLASH_ATTR math_identity (lua_State *L) { #ifdef LUA_NUMBER_INTEGRAL // Integer square root for integer version -static lua_Number ICACHE_FLASH_ATTR isqrt(lua_Number x) +static lua_Number isqrt(lua_Number x) { lua_Number op, res, one; @@ -147,7 +147,7 @@ static lua_Number ICACHE_FLASH_ATTR isqrt(lua_Number x) } #endif -static int ICACHE_FLASH_ATTR math_sqrt (lua_State *L) { +static int math_sqrt (lua_State *L) { #ifdef LUA_NUMBER_INTEGRAL lua_Number x = luaL_checknumber(L, 1); luaL_argcheck(L, 0<=x, 1, "negative"); @@ -162,7 +162,7 @@ static int ICACHE_FLASH_ATTR math_sqrt (lua_State *L) { # define pow(a,b) luai_ipow(a,b) #endif -static int ICACHE_FLASH_ATTR math_pow (lua_State *L) { +static int math_pow (lua_State *L) { lua_pushnumber(L, pow(luaL_checknumber(L, 1), luaL_checknumber(L, 2))); return 1; } @@ -174,46 +174,46 @@ static int ICACHE_FLASH_ATTR math_pow (lua_State *L) { #ifndef LUA_NUMBER_INTEGRAL -static int ICACHE_FLASH_ATTR math_log (lua_State *L) { +static int math_log (lua_State *L) { lua_pushnumber(L, log(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_log10 (lua_State *L) { +static int math_log10 (lua_State *L) { lua_pushnumber(L, log10(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_exp (lua_State *L) { +static int math_exp (lua_State *L) { lua_pushnumber(L, exp(luaL_checknumber(L, 1))); return 1; } -static int ICACHE_FLASH_ATTR math_deg (lua_State *L) { +static int math_deg (lua_State *L) { lua_pushnumber(L, luaL_checknumber(L, 1)/RADIANS_PER_DEGREE); return 1; } -static int ICACHE_FLASH_ATTR math_rad (lua_State *L) { +static int math_rad (lua_State *L) { lua_pushnumber(L, luaL_checknumber(L, 1)*RADIANS_PER_DEGREE); return 1; } -static int ICACHE_FLASH_ATTR math_frexp (lua_State *L) { +static int math_frexp (lua_State *L) { int e; lua_pushnumber(L, frexp(luaL_checknumber(L, 1), &e)); lua_pushinteger(L, e); return 2; } -static int ICACHE_FLASH_ATTR math_ldexp (lua_State *L) { +static int math_ldexp (lua_State *L) { lua_pushnumber(L, ldexp(luaL_checknumber(L, 1), luaL_checkint(L, 2))); return 1; } #endif // #ifdef LUA_NUMBER_INTEGRAL -static int ICACHE_FLASH_ATTR math_min (lua_State *L) { +static int math_min (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ lua_Number dmin = luaL_checknumber(L, 1); int i; @@ -227,7 +227,7 @@ static int ICACHE_FLASH_ATTR math_min (lua_State *L) { } -static int ICACHE_FLASH_ATTR math_max (lua_State *L) { +static int math_max (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ lua_Number dmax = luaL_checknumber(L, 1); int i; @@ -243,7 +243,7 @@ static int ICACHE_FLASH_ATTR math_max (lua_State *L) { #ifdef LUA_NUMBER_INTEGRAL -static int ICACHE_FLASH_ATTR math_random (lua_State *L) { +static int math_random (lua_State *L) { lua_Number r = (lua_Number)(rand()%RAND_MAX); switch (lua_gettop(L)) { /* check number of arguments */ @@ -271,7 +271,7 @@ static int ICACHE_FLASH_ATTR math_random (lua_State *L) { #else -static int ICACHE_FLASH_ATTR math_random (lua_State *L) { +static int math_random (lua_State *L) { /* the `%' avoids the (rare) case of r==1, and is needed also because on some systems (SunOS!) `rand()' may return a value larger than RAND_MAX */ lua_Number r = (lua_Number)(rand()%RAND_MAX) / (lua_Number)RAND_MAX; @@ -301,7 +301,7 @@ static int ICACHE_FLASH_ATTR math_random (lua_State *L) { #endif -static int ICACHE_FLASH_ATTR math_randomseed (lua_State *L) { +static int math_randomseed (lua_State *L) { srand(luaL_checkint(L, 1)); return 0; } @@ -371,7 +371,7 @@ const LUA_REG_TYPE math_map[] = { # include "c_limits.h" /* for LONG_MAX */ #endif -LUALIB_API int ICACHE_FLASH_ATTR luaopen_math (lua_State *L) { +LUALIB_API int luaopen_math (lua_State *L) { #if LUA_OPTIMIZE_MEMORY > 0 return 0; #else diff --git a/app/lua/lmem.c b/app/lua/lmem.c index eb07011e..f8939e0a 100644 --- a/app/lua/lmem.c +++ b/app/lua/lmem.c @@ -43,7 +43,7 @@ #define MINSIZEARRAY 4 -void *ICACHE_FLASH_ATTR luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, +void *luaM_growaux_ (lua_State *L, void *block, int *size, size_t size_elems, int limit, const char *errormsg) { void *newblock; int newsize; @@ -63,7 +63,7 @@ void *ICACHE_FLASH_ATTR luaM_growaux_ (lua_State *L, void *block, int *size, siz } -void *ICACHE_FLASH_ATTR luaM_toobig (lua_State *L) { +void *luaM_toobig (lua_State *L) { luaG_runerror(L, "memory allocation error: block too big"); return NULL; /* to avoid warnings */ } @@ -73,7 +73,7 @@ void *ICACHE_FLASH_ATTR luaM_toobig (lua_State *L) { /* ** generic allocation routine. */ -void *ICACHE_FLASH_ATTR luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { +void *luaM_realloc_ (lua_State *L, void *block, size_t osize, size_t nsize) { global_State *g = G(L); lua_assert((osize == 0) == (block == NULL)); block = (*g->frealloc)(g->ud, block, osize, nsize); diff --git a/app/lua/loadlib.c b/app/lua/loadlib.c index 0b3dc7e0..42722c4a 100644 --- a/app/lua/loadlib.c +++ b/app/lua/loadlib.c @@ -237,19 +237,19 @@ static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { #define DLMSG "dynamic libraries not enabled; check your Lua installation" -static void ICACHE_FLASH_ATTR ll_unloadlib (void *lib) { +static void ll_unloadlib (void *lib) { (void)lib; /* to avoid warnings */ } -static void * ICACHE_FLASH_ATTR ll_load (lua_State *L, const char *path) { +static void * ll_load (lua_State *L, const char *path) { (void)path; /* to avoid warnings */ lua_pushliteral(L, DLMSG); return NULL; } -static lua_CFunction ICACHE_FLASH_ATTR ll_sym (lua_State *L, void *lib, const char *sym) { +static lua_CFunction ll_sym (lua_State *L, void *lib, const char *sym) { (void)lib; (void)sym; /* to avoid warnings */ lua_pushliteral(L, DLMSG); return NULL; @@ -260,7 +260,7 @@ static lua_CFunction ICACHE_FLASH_ATTR ll_sym (lua_State *L, void *lib, const ch -static void ** ICACHE_FLASH_ATTR ll_register (lua_State *L, const char *path) { +static void ** ll_register (lua_State *L, const char *path) { void **plib; lua_pushfstring(L, "%s%s", LIBPREFIX, path); lua_gettable(L, LUA_REGISTRYINDEX); /* check library in registry? */ @@ -284,7 +284,7 @@ static void ** ICACHE_FLASH_ATTR ll_register (lua_State *L, const char *path) { ** __gc tag method: calls library's `ll_unloadlib' function with the lib ** handle */ -static int ICACHE_FLASH_ATTR gctm (lua_State *L) { +static int gctm (lua_State *L) { void **lib = (void **)luaL_checkudata(L, 1, "_LOADLIB"); if (*lib) ll_unloadlib(*lib); *lib = NULL; /* mark library as closed */ @@ -292,7 +292,7 @@ static int ICACHE_FLASH_ATTR gctm (lua_State *L) { } -static int ICACHE_FLASH_ATTR ll_loadfunc (lua_State *L, const char *path, const char *sym) { +static int ll_loadfunc (lua_State *L, const char *path, const char *sym) { void **reg = ll_register(L, path); if (*reg == NULL) *reg = ll_load(L, path); if (*reg == NULL) @@ -307,7 +307,7 @@ static int ICACHE_FLASH_ATTR ll_loadfunc (lua_State *L, const char *path, const } -static int ICACHE_FLASH_ATTR ll_loadlib (lua_State *L) { +static int ll_loadlib (lua_State *L) { const char *path = luaL_checkstring(L, 1); const char *init = luaL_checkstring(L, 2); int stat = ll_loadfunc(L, path, init); @@ -336,7 +336,7 @@ static int readable (const char *filename) { return 1; } #else -static int ICACHE_FLASH_ATTR readable (const char *filename) { +static int readable (const char *filename) { int f = fs_open(filename, FS_RDONLY); /* try to open file */ if (f < FS_OPEN_OK) return 0; /* open failed */ fs_close(f); @@ -344,7 +344,7 @@ static int ICACHE_FLASH_ATTR readable (const char *filename) { } #endif -static const char * ICACHE_FLASH_ATTR pushnexttemplate (lua_State *L, const char *path) { +static const char * pushnexttemplate (lua_State *L, const char *path) { const char *l; while (*path == *LUA_PATHSEP) path++; /* skip separators */ if (*path == '\0') return NULL; /* no more templates */ @@ -355,7 +355,7 @@ static const char * ICACHE_FLASH_ATTR pushnexttemplate (lua_State *L, const char } -static const char * ICACHE_FLASH_ATTR findfile (lua_State *L, const char *name, +static const char * findfile (lua_State *L, const char *name, const char *pname) { const char *path; name = luaL_gsub(L, name, ".", LUA_DIRSEP); @@ -378,13 +378,13 @@ static const char * ICACHE_FLASH_ATTR findfile (lua_State *L, const char *name, } -static void ICACHE_FLASH_ATTR loaderror (lua_State *L, const char *filename) { +static void loaderror (lua_State *L, const char *filename) { luaL_error(L, "error loading module " LUA_QS " from file " LUA_QS ":\n\t%s", lua_tostring(L, 1), filename, lua_tostring(L, -1)); } -static int ICACHE_FLASH_ATTR loader_Lua (lua_State *L) { +static int loader_Lua (lua_State *L) { const char *filename; const char *name = luaL_checkstring(L, 1); filename = findfile(L, name, "path"); @@ -410,7 +410,7 @@ static const char *mkfuncname (lua_State *L, const char *modname) { } -static int ICACHE_FLASH_ATTR loader_C (lua_State *L) { +static int loader_C (lua_State *L) { const char *funcname; const char *name = luaL_checkstring(L, 1); const char *filename = findfile(L, name, "cpath"); @@ -422,7 +422,7 @@ static int ICACHE_FLASH_ATTR loader_C (lua_State *L) { } -static int ICACHE_FLASH_ATTR loader_Croot (lua_State *L) { +static int loader_Croot (lua_State *L) { const char *funcname; const char *filename; const char *name = luaL_checkstring(L, 1); @@ -443,7 +443,7 @@ static int ICACHE_FLASH_ATTR loader_Croot (lua_State *L) { } -static int ICACHE_FLASH_ATTR loader_preload (lua_State *L) { +static int loader_preload (lua_State *L) { const char *name = luaL_checkstring(L, 1); lua_getfield(L, LUA_ENVIRONINDEX, "preload"); if (!lua_istable(L, -1)) @@ -459,7 +459,7 @@ static const int sentinel_ = 0; #define sentinel ((void *)&sentinel_) -static int ICACHE_FLASH_ATTR ll_require (lua_State *L) { +static int ll_require (lua_State *L) { const char *name = luaL_checkstring(L, 1); int i; lua_settop(L, 1); /* _LOADED table will be at index 2 */ @@ -521,7 +521,7 @@ static int ICACHE_FLASH_ATTR ll_require (lua_State *L) { */ -static void ICACHE_FLASH_ATTR setfenv (lua_State *L) { +static void setfenv (lua_State *L) { lua_Debug ar; if (lua_getstack(L, 1, &ar) == 0 || lua_getinfo(L, "f", &ar) == 0 || /* get calling function */ @@ -533,7 +533,7 @@ static void ICACHE_FLASH_ATTR setfenv (lua_State *L) { } -static void ICACHE_FLASH_ATTR dooptions (lua_State *L, int n) { +static void dooptions (lua_State *L, int n) { int i; for (i = 2; i <= n; i++) { lua_pushvalue(L, i); /* get option (a function) */ @@ -543,7 +543,7 @@ static void ICACHE_FLASH_ATTR dooptions (lua_State *L, int n) { } -static void ICACHE_FLASH_ATTR modinit (lua_State *L, const char *modname) { +static void modinit (lua_State *L, const char *modname) { const char *dot; lua_pushvalue(L, -1); lua_setfield(L, -2, "_M"); /* module._M = module */ @@ -558,7 +558,7 @@ static void ICACHE_FLASH_ATTR modinit (lua_State *L, const char *modname) { } -static int ICACHE_FLASH_ATTR ll_module (lua_State *L) { +static int ll_module (lua_State *L) { const char *modname = luaL_checkstring(L, 1); if (luaR_findglobal(modname, c_strlen(modname))) return 0; @@ -608,7 +608,7 @@ static int ll_seeall (lua_State *L) { /* auxiliary mark (for internal use) */ #define AUXMARK "\1" -static void ICACHE_FLASH_ATTR setpath (lua_State *L, const char *fieldname, const char *envname, +static void setpath (lua_State *L, const char *fieldname, const char *envname, const char *def) { const char *path = c_getenv(envname); if (path == NULL) /* no environment variable? */ @@ -643,13 +643,15 @@ static const lua_CFunction loaders[] = {loader_preload, loader_Lua, loader_C, loader_Croot, NULL}; #if LUA_OPTIMIZE_MEMORY > 0 -const luaR_entry lmt[] = { +#define MIN_OPT_LEVEL 1 +#include "lrodefs.h" +const LUA_REG_TYPE lmt[] = { {LRO_STRKEY("__gc"), LRO_FUNCVAL(gctm)}, {LRO_NILKEY, LRO_NILVAL} }; #endif -LUALIB_API int ICACHE_FLASH_ATTR luaopen_package (lua_State *L) { +LUALIB_API int luaopen_package (lua_State *L) { int i; /* create new type _LOADLIB */ #if LUA_OPTIMIZE_MEMORY == 0 diff --git a/app/lua/lobject.c b/app/lua/lobject.c index d8fd8344..13733b0c 100644 --- a/app/lua/lobject.c +++ b/app/lua/lobject.c @@ -32,7 +32,7 @@ const TValue luaO_nilobject_ = {LUA_TVALUE_NIL}; ** (eeeeexxx), where the real value is (1xxx) * 2^(eeeee - 1) if ** eeeee != 0 and (xxx) otherwise. */ -int ICACHE_FLASH_ATTR luaO_int2fb (unsigned int x) { +int luaO_int2fb (unsigned int x) { int e = 0; /* expoent */ while (x >= 16) { x = (x+1) >> 1; @@ -44,14 +44,14 @@ int ICACHE_FLASH_ATTR luaO_int2fb (unsigned int x) { /* converts back */ -int ICACHE_FLASH_ATTR luaO_fb2int (int x) { +int luaO_fb2int (int x) { int e = (x >> 3) & 31; if (e == 0) return x; else return ((x & 7)+8) << (e - 1); } -int ICACHE_FLASH_ATTR luaO_log2 (unsigned int x) { +int luaO_log2 (unsigned int x) { static const lu_byte log_2[256] = { 0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5, 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6, @@ -69,7 +69,7 @@ int ICACHE_FLASH_ATTR luaO_log2 (unsigned int x) { } -int ICACHE_FLASH_ATTR luaO_rawequalObj (const TValue *t1, const TValue *t2) { +int luaO_rawequalObj (const TValue *t1, const TValue *t2) { if (ttype(t1) != ttype(t2)) return 0; else switch (ttype(t1)) { case LUA_TNIL: @@ -89,7 +89,7 @@ int ICACHE_FLASH_ATTR luaO_rawequalObj (const TValue *t1, const TValue *t2) { } -int ICACHE_FLASH_ATTR luaO_str2d (const char *s, lua_Number *result) { +int luaO_str2d (const char *s, lua_Number *result) { char *endptr; *result = lua_str2number(s, &endptr); if (endptr == s) return 0; /* conversion failed */ @@ -103,14 +103,14 @@ int ICACHE_FLASH_ATTR luaO_str2d (const char *s, lua_Number *result) { -static void ICACHE_FLASH_ATTR pushstr (lua_State *L, const char *str) { +static void pushstr (lua_State *L, const char *str) { setsvalue2s(L, L->top, luaS_new(L, str)); incr_top(L); } /* this function handles only `%d', `%c', %f, %p, and `%s' formats */ -const char *ICACHE_FLASH_ATTR luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { +const char *luaO_pushvfstring (lua_State *L, const char *fmt, va_list argp) { int n = 1; pushstr(L, ""); for (;;) { @@ -171,7 +171,7 @@ const char *ICACHE_FLASH_ATTR luaO_pushvfstring (lua_State *L, const char *fmt, } -const char *ICACHE_FLASH_ATTR luaO_pushfstring (lua_State *L, const char *fmt, ...) { +const char *luaO_pushfstring (lua_State *L, const char *fmt, ...) { const char *msg; va_list argp; va_start(argp, fmt); @@ -181,7 +181,7 @@ const char *ICACHE_FLASH_ATTR luaO_pushfstring (lua_State *L, const char *fmt, . } -void ICACHE_FLASH_ATTR luaO_chunkid (char *out, const char *source, size_t bufflen) { +void luaO_chunkid (char *out, const char *source, size_t bufflen) { if (*source == '=') { c_strncpy(out, source+1, bufflen); /* remove first char */ out[bufflen-1] = '\0'; /* ensures null termination */ diff --git a/app/lua/lparser.c b/app/lua/lparser.c index 98c810a2..a3653c7d 100644 --- a/app/lua/lparser.c +++ b/app/lua/lparser.c @@ -54,7 +54,7 @@ static void chunk (LexState *ls); static void expr (LexState *ls, expdesc *v); -static void ICACHE_FLASH_ATTR anchor_token (LexState *ls) { +static void anchor_token (LexState *ls) { if (ls->t.token == TK_NAME || ls->t.token == TK_STRING) { TString *ts = ls->t.seminfo.ts; luaX_newstring(ls, getstr(ts), ts->tsv.len); @@ -62,13 +62,13 @@ static void ICACHE_FLASH_ATTR anchor_token (LexState *ls) { } -static void ICACHE_FLASH_ATTR error_expected (LexState *ls, int token) { +static void error_expected (LexState *ls, int token) { luaX_syntaxerror(ls, luaO_pushfstring(ls->L, LUA_QS " expected", luaX_token2str(ls, token))); } -static void ICACHE_FLASH_ATTR errorlimit (FuncState *fs, int limit, const char *what) { +static void errorlimit (FuncState *fs, int limit, const char *what) { const char *msg = (fs->f->linedefined == 0) ? luaO_pushfstring(fs->L, "main function has more than %d %s", limit, what) : luaO_pushfstring(fs->L, "function at line %d has more than %d %s", @@ -77,7 +77,7 @@ static void ICACHE_FLASH_ATTR errorlimit (FuncState *fs, int limit, const char * } -static int ICACHE_FLASH_ATTR testnext (LexState *ls, int c) { +static int testnext (LexState *ls, int c) { if (ls->t.token == c) { luaX_next(ls); return 1; @@ -86,12 +86,12 @@ static int ICACHE_FLASH_ATTR testnext (LexState *ls, int c) { } -static void ICACHE_FLASH_ATTR check (LexState *ls, int c) { +static void check (LexState *ls, int c) { if (ls->t.token != c) error_expected(ls, c); } -static void ICACHE_FLASH_ATTR checknext (LexState *ls, int c) { +static void checknext (LexState *ls, int c) { check(ls, c); luaX_next(ls); } @@ -101,7 +101,7 @@ static void ICACHE_FLASH_ATTR checknext (LexState *ls, int c) { -static void ICACHE_FLASH_ATTR check_match (LexState *ls, int what, int who, int where) { +static void check_match (LexState *ls, int what, int who, int where) { if (!testnext(ls, what)) { if (where == ls->linenumber) error_expected(ls, what); @@ -114,7 +114,7 @@ static void ICACHE_FLASH_ATTR check_match (LexState *ls, int what, int who, int } -static TString *ICACHE_FLASH_ATTR str_checkname (LexState *ls) { +static TString *str_checkname (LexState *ls) { TString *ts; check(ls, TK_NAME); ts = ls->t.seminfo.ts; @@ -123,24 +123,24 @@ static TString *ICACHE_FLASH_ATTR str_checkname (LexState *ls) { } -static void ICACHE_FLASH_ATTR init_exp (expdesc *e, expkind k, int i) { +static void init_exp (expdesc *e, expkind k, int i) { e->f = e->t = NO_JUMP; e->k = k; e->u.s.info = i; } -static void ICACHE_FLASH_ATTR codestring (LexState *ls, expdesc *e, TString *s) { +static void codestring (LexState *ls, expdesc *e, TString *s) { init_exp(e, VK, luaK_stringK(ls->fs, s)); } -static void ICACHE_FLASH_ATTR checkname(LexState *ls, expdesc *e) { +static void checkname(LexState *ls, expdesc *e) { codestring(ls, e, str_checkname(ls)); } -static int ICACHE_FLASH_ATTR registerlocalvar (LexState *ls, TString *varname) { +static int registerlocalvar (LexState *ls, TString *varname) { FuncState *fs = ls->fs; Proto *f = fs->f; int oldsize = f->sizelocvars; @@ -157,14 +157,14 @@ static int ICACHE_FLASH_ATTR registerlocalvar (LexState *ls, TString *varname) { new_localvar(ls, luaX_newstring(ls, "" v, (sizeof(v)/sizeof(char))-1), n) -static void ICACHE_FLASH_ATTR new_localvar (LexState *ls, TString *name, int n) { +static void new_localvar (LexState *ls, TString *name, int n) { FuncState *fs = ls->fs; luaY_checklimit(fs, fs->nactvar+n+1, LUAI_MAXVARS, "local variables"); fs->actvar[fs->nactvar+n] = cast(unsigned short, registerlocalvar(ls, name)); } -static void ICACHE_FLASH_ATTR adjustlocalvars (LexState *ls, int nvars) { +static void adjustlocalvars (LexState *ls, int nvars) { FuncState *fs = ls->fs; fs->nactvar = cast_byte(fs->nactvar + nvars); for (; nvars; nvars--) { @@ -173,14 +173,14 @@ static void ICACHE_FLASH_ATTR adjustlocalvars (LexState *ls, int nvars) { } -static void ICACHE_FLASH_ATTR removevars (LexState *ls, int tolevel) { +static void removevars (LexState *ls, int tolevel) { FuncState *fs = ls->fs; while (fs->nactvar > tolevel) getlocvar(fs, --fs->nactvar).endpc = fs->pc; } -static int ICACHE_FLASH_ATTR indexupvalue (FuncState *fs, TString *name, expdesc *v) { +static int indexupvalue (FuncState *fs, TString *name, expdesc *v) { int i; Proto *f = fs->f; int oldsize = f->sizeupvalues; @@ -204,7 +204,7 @@ static int ICACHE_FLASH_ATTR indexupvalue (FuncState *fs, TString *name, expdesc } -static int ICACHE_FLASH_ATTR searchvar (FuncState *fs, TString *n) { +static int searchvar (FuncState *fs, TString *n) { int i; for (i=fs->nactvar-1; i >= 0; i--) { if (n == getlocvar(fs, i).varname) @@ -214,14 +214,14 @@ static int ICACHE_FLASH_ATTR searchvar (FuncState *fs, TString *n) { } -static void ICACHE_FLASH_ATTR markupval (FuncState *fs, int level) { +static void markupval (FuncState *fs, int level) { BlockCnt *bl = fs->bl; while (bl && bl->nactvar > level) bl = bl->previous; if (bl) bl->upval = 1; } -static int ICACHE_FLASH_ATTR singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { +static int singlevaraux (FuncState *fs, TString *n, expdesc *var, int base) { if (fs == NULL) { /* no more levels? */ init_exp(var, VGLOBAL, NO_REG); /* default is global variable */ return VGLOBAL; @@ -245,7 +245,7 @@ static int ICACHE_FLASH_ATTR singlevaraux (FuncState *fs, TString *n, expdesc *v } -static void ICACHE_FLASH_ATTR singlevar (LexState *ls, expdesc *var) { +static void singlevar (LexState *ls, expdesc *var) { TString *varname = str_checkname(ls); FuncState *fs = ls->fs; if (singlevaraux(fs, varname, var, 1) == VGLOBAL) @@ -253,7 +253,7 @@ static void ICACHE_FLASH_ATTR singlevar (LexState *ls, expdesc *var) { } -static void ICACHE_FLASH_ATTR adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { +static void adjust_assign (LexState *ls, int nvars, int nexps, expdesc *e) { FuncState *fs = ls->fs; int extra = nvars - nexps; if (hasmultret(e->k)) { @@ -273,7 +273,7 @@ static void ICACHE_FLASH_ATTR adjust_assign (LexState *ls, int nvars, int nexps, } -static void ICACHE_FLASH_ATTR enterlevel (LexState *ls) { +static void enterlevel (LexState *ls) { if (++ls->L->nCcalls > LUAI_MAXCCALLS) luaX_lexerror(ls, "chunk has too many syntax levels", 0); } @@ -282,7 +282,7 @@ static void ICACHE_FLASH_ATTR enterlevel (LexState *ls) { #define leavelevel(ls) ((ls)->L->nCcalls--) -static void ICACHE_FLASH_ATTR enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { +static void enterblock (FuncState *fs, BlockCnt *bl, lu_byte isbreakable) { bl->breaklist = NO_JUMP; bl->isbreakable = isbreakable; bl->nactvar = fs->nactvar; @@ -293,7 +293,7 @@ static void ICACHE_FLASH_ATTR enterblock (FuncState *fs, BlockCnt *bl, lu_byte i } -static void ICACHE_FLASH_ATTR leaveblock (FuncState *fs) { +static void leaveblock (FuncState *fs) { BlockCnt *bl = fs->bl; fs->bl = bl->previous; removevars(fs->ls, bl->nactvar); @@ -307,7 +307,7 @@ static void ICACHE_FLASH_ATTR leaveblock (FuncState *fs) { } -static void ICACHE_FLASH_ATTR pushclosure (LexState *ls, FuncState *func, expdesc *v) { +static void pushclosure (LexState *ls, FuncState *func, expdesc *v) { FuncState *fs = ls->fs; Proto *f = fs->f; int oldsize = f->sizep; @@ -325,7 +325,7 @@ static void ICACHE_FLASH_ATTR pushclosure (LexState *ls, FuncState *func, expdes } -static void ICACHE_FLASH_ATTR open_func (LexState *ls, FuncState *fs) { +static void open_func (LexState *ls, FuncState *fs) { lua_State *L = ls->L; Proto *f = luaF_newproto(L); fs->f = f; @@ -353,7 +353,7 @@ static void ICACHE_FLASH_ATTR open_func (LexState *ls, FuncState *fs) { } -static void ICACHE_FLASH_ATTR close_func (LexState *ls) { +static void close_func (LexState *ls) { lua_State *L = ls->L; FuncState *fs = ls->fs; Proto *f = fs->f; @@ -380,7 +380,7 @@ static void ICACHE_FLASH_ATTR close_func (LexState *ls) { } -Proto *ICACHE_FLASH_ATTR luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { +Proto *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const char *name) { struct LexState lexstate; struct FuncState funcstate; TString *tname = luaS_new(L, name); @@ -408,7 +408,7 @@ Proto *ICACHE_FLASH_ATTR luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff, const /*============================================================*/ -static void ICACHE_FLASH_ATTR field (LexState *ls, expdesc *v) { +static void field (LexState *ls, expdesc *v) { /* field -> ['.' | ':'] NAME */ FuncState *fs = ls->fs; expdesc key; @@ -419,7 +419,7 @@ static void ICACHE_FLASH_ATTR field (LexState *ls, expdesc *v) { } -static void ICACHE_FLASH_ATTR yindex (LexState *ls, expdesc *v) { +static void yindex (LexState *ls, expdesc *v) { /* index -> '[' expr ']' */ luaX_next(ls); /* skip the '[' */ expr(ls, v); @@ -444,7 +444,7 @@ struct ConsControl { }; -static void ICACHE_FLASH_ATTR recfield (LexState *ls, struct ConsControl *cc) { +static void recfield (LexState *ls, struct ConsControl *cc) { /* recfield -> (NAME | `['exp1`]') = exp1 */ FuncState *fs = ls->fs; int reg = ls->fs->freereg; @@ -465,7 +465,7 @@ static void ICACHE_FLASH_ATTR recfield (LexState *ls, struct ConsControl *cc) { } -static void ICACHE_FLASH_ATTR closelistfield (FuncState *fs, struct ConsControl *cc) { +static void closelistfield (FuncState *fs, struct ConsControl *cc) { if (cc->v.k == VVOID) return; /* there is no list item */ luaK_exp2nextreg(fs, &cc->v); cc->v.k = VVOID; @@ -476,7 +476,7 @@ static void ICACHE_FLASH_ATTR closelistfield (FuncState *fs, struct ConsControl } -static void ICACHE_FLASH_ATTR lastlistfield (FuncState *fs, struct ConsControl *cc) { +static void lastlistfield (FuncState *fs, struct ConsControl *cc) { if (cc->tostore == 0) return; if (hasmultret(cc->v.k)) { luaK_setmultret(fs, &cc->v); @@ -491,7 +491,7 @@ static void ICACHE_FLASH_ATTR lastlistfield (FuncState *fs, struct ConsControl * } -static void ICACHE_FLASH_ATTR listfield (LexState *ls, struct ConsControl *cc) { +static void listfield (LexState *ls, struct ConsControl *cc) { expr(ls, &cc->v); luaY_checklimit(ls->fs, cc->na, MAX_INT, "items in a constructor"); cc->na++; @@ -499,7 +499,7 @@ static void ICACHE_FLASH_ATTR listfield (LexState *ls, struct ConsControl *cc) { } -static void ICACHE_FLASH_ATTR constructor (LexState *ls, expdesc *t) { +static void constructor (LexState *ls, expdesc *t) { /* constructor -> ?? */ FuncState *fs = ls->fs; int line = ls->linenumber; @@ -544,7 +544,7 @@ static void ICACHE_FLASH_ATTR constructor (LexState *ls, expdesc *t) { -static void ICACHE_FLASH_ATTR parlist (LexState *ls) { +static void parlist (LexState *ls) { /* parlist -> [ param { `,' param } ] */ FuncState *fs = ls->fs; Proto *f = fs->f; @@ -577,7 +577,7 @@ static void ICACHE_FLASH_ATTR parlist (LexState *ls) { } -static void ICACHE_FLASH_ATTR body (LexState *ls, expdesc *e, int needself, int line) { +static void body (LexState *ls, expdesc *e, int needself, int line) { /* body -> `(' parlist `)' chunk END */ FuncState new_fs; open_func(ls, &new_fs); @@ -597,7 +597,7 @@ static void ICACHE_FLASH_ATTR body (LexState *ls, expdesc *e, int needself, int } -static int ICACHE_FLASH_ATTR explist1 (LexState *ls, expdesc *v) { +static int explist1 (LexState *ls, expdesc *v) { /* explist1 -> expr { `,' expr } */ int n = 1; /* at least one expression */ expr(ls, v); @@ -610,7 +610,7 @@ static int ICACHE_FLASH_ATTR explist1 (LexState *ls, expdesc *v) { } -static void ICACHE_FLASH_ATTR funcargs (LexState *ls, expdesc *f) { +static void funcargs (LexState *ls, expdesc *f) { FuncState *fs = ls->fs; expdesc args; int base, nparams; @@ -668,7 +668,7 @@ static void ICACHE_FLASH_ATTR funcargs (LexState *ls, expdesc *f) { */ -static void ICACHE_FLASH_ATTR prefixexp (LexState *ls, expdesc *v) { +static void prefixexp (LexState *ls, expdesc *v) { /* prefixexp -> NAME | '(' expr ')' */ switch (ls->t.token) { case '(': { @@ -691,7 +691,7 @@ static void ICACHE_FLASH_ATTR prefixexp (LexState *ls, expdesc *v) { } -static void ICACHE_FLASH_ATTR primaryexp (LexState *ls, expdesc *v) { +static void primaryexp (LexState *ls, expdesc *v) { /* primaryexp -> prefixexp { `.' NAME | `[' exp `]' | `:' NAME funcargs | funcargs } */ FuncState *fs = ls->fs; @@ -728,7 +728,7 @@ static void ICACHE_FLASH_ATTR primaryexp (LexState *ls, expdesc *v) { } -static void ICACHE_FLASH_ATTR simpleexp (LexState *ls, expdesc *v) { +static void simpleexp (LexState *ls, expdesc *v) { /* simpleexp -> NUMBER | STRING | NIL | true | false | ... | constructor | FUNCTION body | primaryexp */ switch (ls->t.token) { @@ -779,7 +779,7 @@ static void ICACHE_FLASH_ATTR simpleexp (LexState *ls, expdesc *v) { } -static UnOpr ICACHE_FLASH_ATTR getunopr (int op) { +static UnOpr getunopr (int op) { switch (op) { case TK_NOT: return OPR_NOT; case '-': return OPR_MINUS; @@ -789,7 +789,7 @@ static UnOpr ICACHE_FLASH_ATTR getunopr (int op) { } -static BinOpr ICACHE_FLASH_ATTR getbinopr (int op) { +static BinOpr getbinopr (int op) { switch (op) { case '+': return OPR_ADD; case '-': return OPR_SUB; @@ -829,7 +829,7 @@ static const struct { ** subexpr -> (simpleexp | unop subexpr) { binop subexpr } ** where `binop' is any binary operator with a priority higher than `limit' */ -static BinOpr ICACHE_FLASH_ATTR subexpr (LexState *ls, expdesc *v, unsigned int limit) { +static BinOpr subexpr (LexState *ls, expdesc *v, unsigned int limit) { BinOpr op; UnOpr uop; enterlevel(ls); @@ -857,7 +857,7 @@ static BinOpr ICACHE_FLASH_ATTR subexpr (LexState *ls, expdesc *v, unsigned int } -static void ICACHE_FLASH_ATTR expr (LexState *ls, expdesc *v) { +static void expr (LexState *ls, expdesc *v) { subexpr(ls, v, 0); } @@ -872,7 +872,7 @@ static void ICACHE_FLASH_ATTR expr (LexState *ls, expdesc *v) { */ -static int ICACHE_FLASH_ATTR block_follow (int token) { +static int block_follow (int token) { switch (token) { case TK_ELSE: case TK_ELSEIF: case TK_END: case TK_UNTIL: case TK_EOS: @@ -882,7 +882,7 @@ static int ICACHE_FLASH_ATTR block_follow (int token) { } -static void ICACHE_FLASH_ATTR block (LexState *ls) { +static void block (LexState *ls) { /* block -> chunk */ FuncState *fs = ls->fs; BlockCnt *pbl = (BlockCnt*)luaM_malloc(ls->L,sizeof(BlockCnt)); @@ -910,7 +910,7 @@ struct LHS_assign { ** local value in a safe place and use this safe copy in the previous ** assignment. */ -static void ICACHE_FLASH_ATTR check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { +static void check_conflict (LexState *ls, struct LHS_assign *lh, expdesc *v) { FuncState *fs = ls->fs; int extra = fs->freereg; /* eventual position to save local variable */ int conflict = 0; @@ -933,7 +933,7 @@ static void ICACHE_FLASH_ATTR check_conflict (LexState *ls, struct LHS_assign *l } -static void ICACHE_FLASH_ATTR assignment (LexState *ls, struct LHS_assign *lh, int nvars) { +static void assignment (LexState *ls, struct LHS_assign *lh, int nvars) { expdesc e; check_condition(ls, VLOCAL <= lh->v.k && lh->v.k <= VINDEXED, "syntax error"); @@ -967,7 +967,7 @@ static void ICACHE_FLASH_ATTR assignment (LexState *ls, struct LHS_assign *lh, i } -static int ICACHE_FLASH_ATTR cond (LexState *ls) { +static int cond (LexState *ls) { /* cond -> exp */ expdesc v; expr(ls, &v); /* read condition */ @@ -977,7 +977,7 @@ static int ICACHE_FLASH_ATTR cond (LexState *ls) { } -static void ICACHE_FLASH_ATTR breakstat (LexState *ls) { +static void breakstat (LexState *ls) { FuncState *fs = ls->fs; BlockCnt *bl = fs->bl; int upval = 0; @@ -993,7 +993,7 @@ static void ICACHE_FLASH_ATTR breakstat (LexState *ls) { } -static void ICACHE_FLASH_ATTR whilestat (LexState *ls, int line) { +static void whilestat (LexState *ls, int line) { /* whilestat -> WHILE cond DO block END */ FuncState *fs = ls->fs; int whileinit; @@ -1012,7 +1012,7 @@ static void ICACHE_FLASH_ATTR whilestat (LexState *ls, int line) { } -static void ICACHE_FLASH_ATTR repeatstat (LexState *ls, int line) { +static void repeatstat (LexState *ls, int line) { /* repeatstat -> REPEAT block UNTIL cond */ int condexit; FuncState *fs = ls->fs; @@ -1038,7 +1038,7 @@ static void ICACHE_FLASH_ATTR repeatstat (LexState *ls, int line) { } -static int ICACHE_FLASH_ATTR exp1 (LexState *ls) { +static int exp1 (LexState *ls) { expdesc e; int k; expr(ls, &e); @@ -1048,7 +1048,7 @@ static int ICACHE_FLASH_ATTR exp1 (LexState *ls) { } -static void ICACHE_FLASH_ATTR forbody (LexState *ls, int base, int line, int nvars, int isnum) { +static void forbody (LexState *ls, int base, int line, int nvars, int isnum) { /* forbody -> DO block */ BlockCnt *pbl = (BlockCnt*)luaM_malloc(ls->L,sizeof(BlockCnt)); FuncState *fs = ls->fs; @@ -1070,7 +1070,7 @@ static void ICACHE_FLASH_ATTR forbody (LexState *ls, int base, int line, int nva } -static void ICACHE_FLASH_ATTR fornum (LexState *ls, TString *varname, int line) { +static void fornum (LexState *ls, TString *varname, int line) { /* fornum -> NAME = exp1,exp1[,exp1] forbody */ FuncState *fs = ls->fs; int base = fs->freereg; @@ -1092,7 +1092,7 @@ static void ICACHE_FLASH_ATTR fornum (LexState *ls, TString *varname, int line) } -static void ICACHE_FLASH_ATTR forlist (LexState *ls, TString *indexname) { +static void forlist (LexState *ls, TString *indexname) { /* forlist -> NAME {,NAME} IN explist1 forbody */ FuncState *fs = ls->fs; expdesc e; @@ -1115,7 +1115,7 @@ static void ICACHE_FLASH_ATTR forlist (LexState *ls, TString *indexname) { } -static void ICACHE_FLASH_ATTR forstat (LexState *ls, int line) { +static void forstat (LexState *ls, int line) { /* forstat -> FOR (fornum | forlist) END */ FuncState *fs = ls->fs; TString *varname; @@ -1133,7 +1133,7 @@ static void ICACHE_FLASH_ATTR forstat (LexState *ls, int line) { } -static int ICACHE_FLASH_ATTR test_then_block (LexState *ls) { +static int test_then_block (LexState *ls) { /* test_then_block -> [IF | ELSEIF] cond THEN block */ int condexit; luaX_next(ls); /* skip IF or ELSEIF */ @@ -1144,7 +1144,7 @@ static int ICACHE_FLASH_ATTR test_then_block (LexState *ls) { } -static void ICACHE_FLASH_ATTR ifstat (LexState *ls, int line) { +static void ifstat (LexState *ls, int line) { /* ifstat -> IF cond THEN block {ELSEIF cond THEN block} [ELSE block] END */ FuncState *fs = ls->fs; int flist; @@ -1168,7 +1168,7 @@ static void ICACHE_FLASH_ATTR ifstat (LexState *ls, int line) { } -static void ICACHE_FLASH_ATTR localfunc (LexState *ls) { +static void localfunc (LexState *ls) { expdesc v, b; FuncState *fs = ls->fs; new_localvar(ls, str_checkname(ls), 0); @@ -1182,7 +1182,7 @@ static void ICACHE_FLASH_ATTR localfunc (LexState *ls) { } -static void ICACHE_FLASH_ATTR localstat (LexState *ls) { +static void localstat (LexState *ls) { /* stat -> LOCAL NAME {`,' NAME} [`=' explist1] */ int nvars = 0; int nexps; @@ -1201,7 +1201,7 @@ static void ICACHE_FLASH_ATTR localstat (LexState *ls) { } -static int ICACHE_FLASH_ATTR funcname (LexState *ls, expdesc *v) { +static int funcname (LexState *ls, expdesc *v) { /* funcname -> NAME {field} [`:' NAME] */ int needself = 0; singlevar(ls, v); @@ -1215,7 +1215,7 @@ static int ICACHE_FLASH_ATTR funcname (LexState *ls, expdesc *v) { } -static void ICACHE_FLASH_ATTR funcstat (LexState *ls, int line) { +static void funcstat (LexState *ls, int line) { /* funcstat -> FUNCTION funcname body */ int needself; expdesc v, b; @@ -1227,7 +1227,7 @@ static void ICACHE_FLASH_ATTR funcstat (LexState *ls, int line) { } -static void ICACHE_FLASH_ATTR exprstat (LexState *ls) { +static void exprstat (LexState *ls) { /* stat -> func | assignment */ FuncState *fs = ls->fs; struct LHS_assign v; @@ -1241,7 +1241,7 @@ static void ICACHE_FLASH_ATTR exprstat (LexState *ls) { } -static void ICACHE_FLASH_ATTR retstat (LexState *ls) { +static void retstat (LexState *ls) { /* stat -> RETURN explist */ FuncState *fs = ls->fs; expdesc e; @@ -1274,7 +1274,7 @@ static void ICACHE_FLASH_ATTR retstat (LexState *ls) { } -static int ICACHE_FLASH_ATTR statement (LexState *ls) { +static int statement (LexState *ls) { int line = ls->linenumber; /* may be needed for error messages */ switch (ls->t.token) { case TK_IF: { /* stat -> ifstat */ @@ -1328,7 +1328,7 @@ static int ICACHE_FLASH_ATTR statement (LexState *ls) { } -static void ICACHE_FLASH_ATTR chunk (LexState *ls) { +static void chunk (LexState *ls) { /* chunk -> { stat [`;'] } */ int islast = 0; enterlevel(ls); diff --git a/app/lua/lrodefs.h b/app/lua/lrodefs.h index 02b635ef..7094586d 100644 --- a/app/lua/lrodefs.h +++ b/app/lua/lrodefs.h @@ -16,7 +16,7 @@ #undef LREGISTER #if (MIN_OPT_LEVEL > 0) && (LUA_OPTIMIZE_MEMORY >= MIN_OPT_LEVEL) -#define LUA_REG_TYPE luaR_entry +#define LUA_REG_TYPE luaR_entry ICACHE_FLASH_ATTR #define LSTRKEY LRO_STRKEY #define LNUMKEY LRO_NUMKEY #define LNILKEY LRO_NILKEY diff --git a/app/lua/lrotable.c b/app/lua/lrotable.c index 60cf6788..8d7e54e4 100644 --- a/app/lua/lrotable.c +++ b/app/lua/lrotable.c @@ -16,7 +16,7 @@ extern const luaR_table lua_rotable[]; /* Find a global "read only table" in the constant lua_rotable array */ -void* ICACHE_FLASH_ATTR luaR_findglobal(const char *name, unsigned len) { +void* luaR_findglobal(const char *name, unsigned len) { unsigned i; if (c_strlen(name) > LUA_MAX_ROTABLE_NAME) @@ -29,7 +29,7 @@ void* ICACHE_FLASH_ATTR luaR_findglobal(const char *name, unsigned len) { } /* Find an entry in a rotable and return it */ -static const TValue* ICACHE_FLASH_ATTR luaR_auxfind(const luaR_entry *pentry, const char *strkey, luaR_numkey numkey, unsigned *ppos) { +static const TValue* luaR_auxfind(const luaR_entry *pentry, const char *strkey, luaR_numkey numkey, unsigned *ppos) { const TValue *res = NULL; unsigned i = 0; @@ -48,7 +48,7 @@ static const TValue* ICACHE_FLASH_ATTR luaR_auxfind(const luaR_entry *pentry, co return res; } -int ICACHE_FLASH_ATTR luaR_findfunction(lua_State *L, const luaR_entry *ptable) { +int luaR_findfunction(lua_State *L, const luaR_entry *ptable) { const TValue *res = NULL; const char *key = luaL_checkstring(L, 2); @@ -64,12 +64,12 @@ int ICACHE_FLASH_ATTR luaR_findfunction(lua_State *L, const luaR_entry *ptable) /* Find an entry in a rotable and return its type If "strkey" is not NULL, the function will look for a string key, otherwise it will look for a number key */ -const TValue* ICACHE_FLASH_ATTR luaR_findentry(void *data, const char *strkey, luaR_numkey numkey, unsigned *ppos) { +const TValue* luaR_findentry(void *data, const char *strkey, luaR_numkey numkey, unsigned *ppos) { return luaR_auxfind((const luaR_entry*)data, strkey, numkey, ppos); } /* Find the metatable of a given table */ -void* ICACHE_FLASH_ATTR luaR_getmeta(void *data) { +void* luaR_getmeta(void *data) { #ifdef LUA_META_ROTABLES const TValue *res = luaR_auxfind((const luaR_entry*)data, "__metatable", 0, NULL); return res && ttisrotable(res) ? rvalue(res) : NULL; @@ -78,7 +78,7 @@ void* ICACHE_FLASH_ATTR luaR_getmeta(void *data) { #endif } -static void ICACHE_FLASH_ATTR luaR_next_helper(lua_State *L, const luaR_entry *pentries, int pos, TValue *key, TValue *val) { +static void luaR_next_helper(lua_State *L, const luaR_entry *pentries, int pos, TValue *key, TValue *val) { setnilvalue(key); setnilvalue(val); if (pentries[pos].key.type != LUA_TNIL) { @@ -91,7 +91,7 @@ static void ICACHE_FLASH_ATTR luaR_next_helper(lua_State *L, const luaR_entry *p } } /* next (used for iteration) */ -void ICACHE_FLASH_ATTR luaR_next(lua_State *L, void *data, TValue *key, TValue *val) { +void luaR_next(lua_State *L, void *data, TValue *key, TValue *val) { const luaR_entry* pentries = (const luaR_entry*)data; char strkey[LUA_MAX_ROTABLE_NAME + 1], *pstrkey = NULL; luaR_numkey numkey = 0; @@ -115,7 +115,7 @@ void ICACHE_FLASH_ATTR luaR_next(lua_State *L, void *data, TValue *key, TValue * } /* Convert a Lua string to a C string */ -void ICACHE_FLASH_ATTR luaR_getcstr(char *dest, const TString *src, size_t maxsize) { +void luaR_getcstr(char *dest, const TString *src, size_t maxsize) { if (src->tsv.len+1 > maxsize) dest[0] = '\0'; else { @@ -129,7 +129,7 @@ void ICACHE_FLASH_ATTR luaR_getcstr(char *dest, const TString *src, size_t maxsi #include "compiler.h" -int ICACHE_FLASH_ATTR luaR_isrotable(void *p) { +int luaR_isrotable(void *p) { return RODATA_START_ADDRESS <= (char*)p && (char*)p <= RODATA_END_ADDRESS; } #endif diff --git a/app/lua/lstate.c b/app/lua/lstate.c index 75454af1..8b71cb47 100644 --- a/app/lua/lstate.c +++ b/app/lua/lstate.c @@ -38,7 +38,7 @@ typedef struct LG { -static void ICACHE_FLASH_ATTR stack_init (lua_State *L1, lua_State *L) { +static void stack_init (lua_State *L1, lua_State *L) { /* initialize CallInfo array */ L1->base_ci = luaM_newvector(L, BASIC_CI_SIZE, CallInfo); L1->ci = L1->base_ci; @@ -57,7 +57,7 @@ static void ICACHE_FLASH_ATTR stack_init (lua_State *L1, lua_State *L) { } -static void ICACHE_FLASH_ATTR freestack (lua_State *L, lua_State *L1) { +static void freestack (lua_State *L, lua_State *L1) { luaM_freearray(L, L1->base_ci, L1->size_ci, CallInfo); luaM_freearray(L, L1->stack, L1->stacksize, TValue); } @@ -66,7 +66,7 @@ static void ICACHE_FLASH_ATTR freestack (lua_State *L, lua_State *L1) { /* ** open parts that may cause memory-allocation errors */ -static void ICACHE_FLASH_ATTR f_luaopen (lua_State *L, void *ud) { +static void f_luaopen (lua_State *L, void *ud) { global_State *g = G(L); UNUSED(ud); stack_init(L, L); /* init stack */ @@ -80,7 +80,7 @@ static void ICACHE_FLASH_ATTR f_luaopen (lua_State *L, void *ud) { } -static void ICACHE_FLASH_ATTR preinit_state (lua_State *L, global_State *g) { +static void preinit_state (lua_State *L, global_State *g) { G(L) = g; L->stack = NULL; L->stacksize = 0; @@ -101,7 +101,7 @@ static void ICACHE_FLASH_ATTR preinit_state (lua_State *L, global_State *g) { } -static void ICACHE_FLASH_ATTR close_state (lua_State *L) { +static void close_state (lua_State *L) { global_State *g = G(L); luaF_close(L, L->stack); /* close all upvalues for this thread */ luaC_freeall(L); /* collect all objects */ @@ -115,7 +115,7 @@ static void ICACHE_FLASH_ATTR close_state (lua_State *L) { } -lua_State *ICACHE_FLASH_ATTR luaE_newthread (lua_State *L) { +lua_State *luaE_newthread (lua_State *L) { lua_State *L1 = tostate(luaM_malloc(L, state_size(lua_State))); luaC_link(L, obj2gco(L1), LUA_TTHREAD); setthvalue(L, L->top, L1); /* put thread on stack */ @@ -133,7 +133,7 @@ lua_State *ICACHE_FLASH_ATTR luaE_newthread (lua_State *L) { } -void ICACHE_FLASH_ATTR luaE_freethread (lua_State *L, lua_State *L1) { +void luaE_freethread (lua_State *L, lua_State *L1) { luaF_close(L1, L1->stack); /* close all upvalues for this thread */ lua_assert(L1->openupval == NULL); luai_userstatefree(L1); @@ -142,7 +142,7 @@ void ICACHE_FLASH_ATTR luaE_freethread (lua_State *L, lua_State *L1) { } -LUA_API lua_State *ICACHE_FLASH_ATTR lua_newstate (lua_Alloc f, void *ud) { +LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { int i; lua_State *L; global_State *g; @@ -205,7 +205,7 @@ LUA_API lua_State *ICACHE_FLASH_ATTR lua_newstate (lua_Alloc f, void *ud) { } -static void ICACHE_FLASH_ATTR callallgcTM (lua_State *L, void *ud) { +static void callallgcTM (lua_State *L, void *ud) { UNUSED(ud); luaC_callGCTM(L); /* call GC metamethods for all udata */ } @@ -214,15 +214,15 @@ static void ICACHE_FLASH_ATTR callallgcTM (lua_State *L, void *ud) { extern lua_State *luaL_newstate (void); static lua_State *lua_crtstate; -lua_State *ICACHE_FLASH_ATTR lua_open(void) { +lua_State *lua_open(void) { lua_crtstate = luaL_newstate(); return lua_crtstate; } -lua_State *ICACHE_FLASH_ATTR lua_getstate(void) { +lua_State *lua_getstate(void) { return lua_crtstate; } -LUA_API void ICACHE_FLASH_ATTR lua_close (lua_State *L) { +LUA_API void lua_close (lua_State *L) { #ifndef LUA_CROSS_COMPILER lua_sethook( L, NULL, 0, 0 ); lua_crtstate = NULL; diff --git a/app/lua/lstring.c b/app/lua/lstring.c index 61dc74cd..d2144f22 100644 --- a/app/lua/lstring.c +++ b/app/lua/lstring.c @@ -20,7 +20,7 @@ #define LUAS_READONLY_STRING 1 #define LUAS_REGULAR_STRING 0 -void ICACHE_FLASH_ATTR luaS_resize (lua_State *L, int newsize) { +void luaS_resize (lua_State *L, int newsize) { stringtable *tb; int i; tb = &G(L)->strt; @@ -51,7 +51,7 @@ void ICACHE_FLASH_ATTR luaS_resize (lua_State *L, int newsize) { unset_resizing_strings_gc(L); } -static TString *ICACHE_FLASH_ATTR newlstr (lua_State *L, const char *str, size_t l, +static TString *newlstr (lua_State *L, const char *str, size_t l, unsigned int h, int readonly) { TString *ts; stringtable *tb; @@ -80,7 +80,7 @@ static TString *ICACHE_FLASH_ATTR newlstr (lua_State *L, const char *str, size_t } -static TString *ICACHE_FLASH_ATTR luaS_newlstr_helper (lua_State *L, const char *str, size_t l, int readonly) { +static TString *luaS_newlstr_helper (lua_State *L, const char *str, size_t l, int readonly) { GCObject *o; unsigned int h = cast(unsigned int, l); /* seed */ size_t step = (l>>5)+1; /* if string is too long, don't hash all its chars */ @@ -100,7 +100,7 @@ static TString *ICACHE_FLASH_ATTR luaS_newlstr_helper (lua_State *L, const char return newlstr(L, str, l, h, readonly); /* not found */ } -static int ICACHE_FLASH_ATTR lua_is_ptr_in_ro_area(const char *p) { +static int lua_is_ptr_in_ro_area(const char *p) { #ifdef LUA_CROSS_COMPILER return 0; #else @@ -111,7 +111,7 @@ static int ICACHE_FLASH_ATTR lua_is_ptr_in_ro_area(const char *p) { #endif } -TString *ICACHE_FLASH_ATTR luaS_newlstr (lua_State *L, const char *str, size_t l) { +TString *luaS_newlstr (lua_State *L, const char *str, size_t l) { // If the pointer is in a read-only memory and the string is at least 4 chars in length, // create it as a read-only string instead if(lua_is_ptr_in_ro_area(str) && l+1 > sizeof(char**) && l == c_strlen(str)) @@ -121,7 +121,7 @@ TString *ICACHE_FLASH_ATTR luaS_newlstr (lua_State *L, const char *str, size_t l } -LUAI_FUNC TString *ICACHE_FLASH_ATTR luaS_newrolstr (lua_State *L, const char *str, size_t l) { +LUAI_FUNC TString *luaS_newrolstr (lua_State *L, const char *str, size_t l) { if(l+1 > sizeof(char**) && l == c_strlen(str)) return luaS_newlstr_helper(L, str, l, LUAS_READONLY_STRING); else // no point in creating a RO string, as it would actually be larger @@ -129,7 +129,7 @@ LUAI_FUNC TString *ICACHE_FLASH_ATTR luaS_newrolstr (lua_State *L, const char *s } -Udata *ICACHE_FLASH_ATTR luaS_newudata (lua_State *L, size_t s, Table *e) { +Udata *luaS_newudata (lua_State *L, size_t s, Table *e) { Udata *u; if (s > MAX_SIZET - sizeof(Udata)) luaM_toobig(L); diff --git a/app/lua/lstrlib.c b/app/lua/lstrlib.c index 1a6aeb4d..9611e961 100644 --- a/app/lua/lstrlib.c +++ b/app/lua/lstrlib.c @@ -25,7 +25,7 @@ -static int ICACHE_FLASH_ATTR str_len (lua_State *L) { +static int str_len (lua_State *L) { size_t l; luaL_checklstring(L, 1, &l); lua_pushinteger(L, l); @@ -33,14 +33,14 @@ static int ICACHE_FLASH_ATTR str_len (lua_State *L) { } -static ptrdiff_t ICACHE_FLASH_ATTR posrelat (ptrdiff_t pos, size_t len) { +static ptrdiff_t posrelat (ptrdiff_t pos, size_t len) { /* relative string position: negative means back from end */ if (pos < 0) pos += (ptrdiff_t)len + 1; return (pos >= 0) ? pos : 0; } -static int ICACHE_FLASH_ATTR str_sub (lua_State *L) { +static int str_sub (lua_State *L) { size_t l; const char *s = luaL_checklstring(L, 1, &l); ptrdiff_t start = posrelat(luaL_checkinteger(L, 2), l); @@ -54,7 +54,7 @@ static int ICACHE_FLASH_ATTR str_sub (lua_State *L) { } -static int ICACHE_FLASH_ATTR str_reverse (lua_State *L) { +static int str_reverse (lua_State *L) { size_t l; luaL_Buffer b; const char *s = luaL_checklstring(L, 1, &l); @@ -65,7 +65,7 @@ static int ICACHE_FLASH_ATTR str_reverse (lua_State *L) { } -static int ICACHE_FLASH_ATTR str_lower (lua_State *L) { +static int str_lower (lua_State *L) { size_t l; size_t i; luaL_Buffer b; @@ -78,7 +78,7 @@ static int ICACHE_FLASH_ATTR str_lower (lua_State *L) { } -static int ICACHE_FLASH_ATTR str_upper (lua_State *L) { +static int str_upper (lua_State *L) { size_t l; size_t i; luaL_Buffer b; @@ -90,7 +90,7 @@ static int ICACHE_FLASH_ATTR str_upper (lua_State *L) { return 1; } -static int ICACHE_FLASH_ATTR str_rep (lua_State *L) { +static int str_rep (lua_State *L) { size_t l; luaL_Buffer b; const char *s = luaL_checklstring(L, 1, &l); @@ -103,7 +103,7 @@ static int ICACHE_FLASH_ATTR str_rep (lua_State *L) { } -static int ICACHE_FLASH_ATTR str_byte (lua_State *L) { +static int str_byte (lua_State *L) { size_t l; const char *s = luaL_checklstring(L, 1, &l); ptrdiff_t posi = posrelat(luaL_optinteger(L, 2, 1), l); @@ -122,7 +122,7 @@ static int ICACHE_FLASH_ATTR str_byte (lua_State *L) { } -static int ICACHE_FLASH_ATTR str_char (lua_State *L) { +static int str_char (lua_State *L) { int n = lua_gettop(L); /* number of arguments */ int i; luaL_Buffer b; @@ -137,14 +137,14 @@ static int ICACHE_FLASH_ATTR str_char (lua_State *L) { } -static int ICACHE_FLASH_ATTR writer (lua_State *L, const void* b, size_t size, void* B) { +static int writer (lua_State *L, const void* b, size_t size, void* B) { (void)L; luaL_addlstring((luaL_Buffer*) B, (const char *)b, size); return 0; } -static int ICACHE_FLASH_ATTR str_dump (lua_State *L) { +static int str_dump (lua_State *L) { luaL_Buffer b; luaL_checktype(L, 1, LUA_TFUNCTION); lua_settop(L, 1); @@ -183,7 +183,7 @@ typedef struct MatchState { #define SPECIALS "^$*+?.([%-" -static int ICACHE_FLASH_ATTR check_capture (MatchState *ms, int l) { +static int check_capture (MatchState *ms, int l) { l -= '1'; if (l < 0 || l >= ms->level || ms->capture[l].len == CAP_UNFINISHED) return luaL_error(ms->L, "invalid capture index"); @@ -191,7 +191,7 @@ static int ICACHE_FLASH_ATTR check_capture (MatchState *ms, int l) { } -static int ICACHE_FLASH_ATTR capture_to_close (MatchState *ms) { +static int capture_to_close (MatchState *ms) { int level = ms->level; for (level--; level>=0; level--) if (ms->capture[level].len == CAP_UNFINISHED) return level; @@ -199,7 +199,7 @@ static int ICACHE_FLASH_ATTR capture_to_close (MatchState *ms) { } -static const char *ICACHE_FLASH_ATTR classend (MatchState *ms, const char *p) { +static const char *classend (MatchState *ms, const char *p) { switch (*p++) { case L_ESC: { if (*p == '\0') @@ -223,7 +223,7 @@ static const char *ICACHE_FLASH_ATTR classend (MatchState *ms, const char *p) { } -static int ICACHE_FLASH_ATTR match_class (int c, int cl) { +static int match_class (int c, int cl) { int res; switch (tolower(cl)) { case 'a' : res = isalpha(c); break; @@ -242,7 +242,7 @@ static int ICACHE_FLASH_ATTR match_class (int c, int cl) { } -static int ICACHE_FLASH_ATTR matchbracketclass (int c, const char *p, const char *ec) { +static int matchbracketclass (int c, const char *p, const char *ec) { int sig = 1; if (*(p+1) == '^') { sig = 0; @@ -265,7 +265,7 @@ static int ICACHE_FLASH_ATTR matchbracketclass (int c, const char *p, const char } -static int ICACHE_FLASH_ATTR singlematch (int c, const char *p, const char *ep) { +static int singlematch (int c, const char *p, const char *ep) { switch (*p) { case '.': return 1; /* matches any char */ case L_ESC: return match_class(c, uchar(*(p+1))); @@ -278,7 +278,7 @@ static int ICACHE_FLASH_ATTR singlematch (int c, const char *p, const char *ep) static const char *match (MatchState *ms, const char *s, const char *p); -static const char *ICACHE_FLASH_ATTR matchbalance (MatchState *ms, const char *s, +static const char *matchbalance (MatchState *ms, const char *s, const char *p) { if (*p == 0 || *(p+1) == 0) luaL_error(ms->L, "unbalanced pattern"); @@ -298,7 +298,7 @@ static const char *ICACHE_FLASH_ATTR matchbalance (MatchState *ms, const char *s } -static const char *ICACHE_FLASH_ATTR max_expand (MatchState *ms, const char *s, +static const char *max_expand (MatchState *ms, const char *s, const char *p, const char *ep) { ptrdiff_t i = 0; /* counts maximum expand for item */ while ((s+i)src_end && singlematch(uchar(*(s+i)), p, ep)) @@ -313,7 +313,7 @@ static const char *ICACHE_FLASH_ATTR max_expand (MatchState *ms, const char *s, } -static const char *ICACHE_FLASH_ATTR min_expand (MatchState *ms, const char *s, +static const char *min_expand (MatchState *ms, const char *s, const char *p, const char *ep) { for (;;) { const char *res = match(ms, s, ep+1); @@ -326,7 +326,7 @@ static const char *ICACHE_FLASH_ATTR min_expand (MatchState *ms, const char *s, } -static const char *ICACHE_FLASH_ATTR start_capture (MatchState *ms, const char *s, +static const char *start_capture (MatchState *ms, const char *s, const char *p, int what) { const char *res; int level = ms->level; @@ -340,7 +340,7 @@ static const char *ICACHE_FLASH_ATTR start_capture (MatchState *ms, const char * } -static const char *ICACHE_FLASH_ATTR end_capture (MatchState *ms, const char *s, +static const char *end_capture (MatchState *ms, const char *s, const char *p) { int l = capture_to_close(ms); const char *res; @@ -351,7 +351,7 @@ static const char *ICACHE_FLASH_ATTR end_capture (MatchState *ms, const char *s, } -static const char *ICACHE_FLASH_ATTR match_capture (MatchState *ms, const char *s, int l) { +static const char *match_capture (MatchState *ms, const char *s, int l) { size_t len; l = check_capture(ms, l); len = ms->capture[l].len; @@ -362,7 +362,7 @@ static const char *ICACHE_FLASH_ATTR match_capture (MatchState *ms, const char * } -static const char *ICACHE_FLASH_ATTR match (MatchState *ms, const char *s, const char *p) { +static const char *match (MatchState *ms, const char *s, const char *p) { init: /* using goto's to optimize tail recursion */ switch (*p) { case '(': { /* start capture */ @@ -441,7 +441,7 @@ static const char *ICACHE_FLASH_ATTR match (MatchState *ms, const char *s, const -static const char *ICACHE_FLASH_ATTR lmemfind (const char *s1, size_t l1, +static const char *lmemfind (const char *s1, size_t l1, const char *s2, size_t l2) { if (l2 == 0) return s1; /* empty strings are everywhere */ else if (l2 > l1) return NULL; /* avoids a negative `l1' */ @@ -463,7 +463,7 @@ static const char *ICACHE_FLASH_ATTR lmemfind (const char *s1, size_t l1, } -static void ICACHE_FLASH_ATTR push_onecapture (MatchState *ms, int i, const char *s, +static void push_onecapture (MatchState *ms, int i, const char *s, const char *e) { if (i >= ms->level) { if (i == 0) /* ms->level == 0, too */ @@ -482,7 +482,7 @@ static void ICACHE_FLASH_ATTR push_onecapture (MatchState *ms, int i, const char } -static int ICACHE_FLASH_ATTR push_captures (MatchState *ms, const char *s, const char *e) { +static int push_captures (MatchState *ms, const char *s, const char *e) { int i; int nlevels = (ms->level == 0 && s) ? 1 : ms->level; luaL_checkstack(ms->L, nlevels, "too many captures"); @@ -492,7 +492,7 @@ static int ICACHE_FLASH_ATTR push_captures (MatchState *ms, const char *s, const } -static int ICACHE_FLASH_ATTR str_find_aux (lua_State *L, int find) { +static int str_find_aux (lua_State *L, int find) { size_t l1, l2; const char *s = luaL_checklstring(L, 1, &l1); const char *p = luaL_checklstring(L, 2, &l2); @@ -535,17 +535,17 @@ static int ICACHE_FLASH_ATTR str_find_aux (lua_State *L, int find) { } -static int ICACHE_FLASH_ATTR str_find (lua_State *L) { +static int str_find (lua_State *L) { return str_find_aux(L, 1); } -static int ICACHE_FLASH_ATTR str_match (lua_State *L) { +static int str_match (lua_State *L) { return str_find_aux(L, 0); } -static int ICACHE_FLASH_ATTR gmatch_aux (lua_State *L) { +static int gmatch_aux (lua_State *L) { MatchState ms; size_t ls; const char *s = lua_tolstring(L, lua_upvalueindex(1), &ls); @@ -571,7 +571,7 @@ static int ICACHE_FLASH_ATTR gmatch_aux (lua_State *L) { } -static int ICACHE_FLASH_ATTR gmatch (lua_State *L) { +static int gmatch (lua_State *L) { luaL_checkstring(L, 1); luaL_checkstring(L, 2); lua_settop(L, 2); @@ -581,13 +581,13 @@ static int ICACHE_FLASH_ATTR gmatch (lua_State *L) { } #if LUA_OPTIMIZE_MEMORY == 0 || !defined(LUA_COMPAT_GFIND) -static int ICACHE_FLASH_ATTR gfind_nodef (lua_State *L) { +static int gfind_nodef (lua_State *L) { return luaL_error(L, LUA_QL("string.gfind") " was renamed to " LUA_QL("string.gmatch")); } #endif -static void ICACHE_FLASH_ATTR add_s (MatchState *ms, luaL_Buffer *b, const char *s, +static void add_s (MatchState *ms, luaL_Buffer *b, const char *s, const char *e) { size_t l, i; const char *news = lua_tolstring(ms->L, 3, &l); @@ -609,7 +609,7 @@ static void ICACHE_FLASH_ATTR add_s (MatchState *ms, luaL_Buffer *b, const char } -static void ICACHE_FLASH_ATTR add_value (MatchState *ms, luaL_Buffer *b, const char *s, +static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, const char *e) { lua_State *L = ms->L; switch (lua_type(L, 3)) { @@ -642,7 +642,7 @@ static void ICACHE_FLASH_ATTR add_value (MatchState *ms, luaL_Buffer *b, const c } -static int ICACHE_FLASH_ATTR str_gsub (lua_State *L) { +static int str_gsub (lua_State *L) { size_t srcl; const char *src = luaL_checklstring(L, 1, &srcl); const char *p = luaL_checkstring(L, 2); @@ -696,7 +696,7 @@ static int ICACHE_FLASH_ATTR str_gsub (lua_State *L) { #define MAX_FORMAT (sizeof(FLAGS) + sizeof(LUA_INTFRMLEN) + 10) -static void ICACHE_FLASH_ATTR addquoted (lua_State *L, luaL_Buffer *b, int arg) { +static void addquoted (lua_State *L, luaL_Buffer *b, int arg) { size_t l; const char *s = luaL_checklstring(L, arg, &l); luaL_addchar(b, '"'); @@ -725,7 +725,7 @@ static void ICACHE_FLASH_ATTR addquoted (lua_State *L, luaL_Buffer *b, int arg) luaL_addchar(b, '"'); } -static const char *ICACHE_FLASH_ATTR scanformat (lua_State *L, const char *strfrmt, char *form) { +static const char *scanformat (lua_State *L, const char *strfrmt, char *form) { const char *p = strfrmt; while (*p != '\0' && c_strchr(FLAGS, *p) != NULL) p++; /* skip flags */ if ((size_t)(p - strfrmt) >= sizeof(FLAGS)) @@ -747,7 +747,7 @@ static const char *ICACHE_FLASH_ATTR scanformat (lua_State *L, const char *strfr } -static void ICACHE_FLASH_ATTR addintlen (char *form) { +static void addintlen (char *form) { size_t l = c_strlen(form); char spec = form[l - 1]; c_strcpy(form + l - 1, LUA_INTFRMLEN); @@ -756,7 +756,7 @@ static void ICACHE_FLASH_ATTR addintlen (char *form) { } -static int ICACHE_FLASH_ATTR str_format (lua_State *L) { +static int str_format (lua_State *L) { int top = lua_gettop(L); int arg = 1; size_t sfl; @@ -858,7 +858,7 @@ const LUA_REG_TYPE strlib[] = { #if LUA_OPTIMIZE_MEMORY != 2 -static void ICACHE_FLASH_ATTR createmetatable (lua_State *L) { +static void createmetatable (lua_State *L) { lua_createtable(L, 0, 1); /* create metatable for strings */ lua_pushliteral(L, ""); /* dummy string */ lua_pushvalue(L, -2); @@ -873,7 +873,7 @@ static void ICACHE_FLASH_ATTR createmetatable (lua_State *L) { /* ** Open string library */ -LUALIB_API int ICACHE_FLASH_ATTR luaopen_string (lua_State *L) { +LUALIB_API int luaopen_string (lua_State *L) { #if LUA_OPTIMIZE_MEMORY == 0 luaL_register(L, LUA_STRLIBNAME, strlib); #if defined(LUA_COMPAT_GFIND) diff --git a/app/lua/ltable.c b/app/lua/ltable.c index 0c1162cd..7cc5d8d5 100644 --- a/app/lua/ltable.c +++ b/app/lua/ltable.c @@ -81,7 +81,7 @@ static const Node dummynode_ = { /* ** hash for lua_Numbers */ -static Node *ICACHE_FLASH_ATTR hashnum (const Table *t, lua_Number n) { +static Node *hashnum (const Table *t, lua_Number n) { unsigned int a[numints]; int i; if (luai_numeq(n, 0)) /* avoid problems with -0 */ @@ -97,7 +97,7 @@ static Node *ICACHE_FLASH_ATTR hashnum (const Table *t, lua_Number n) { ** returns the `main' position of an element in a table (that is, the index ** of its hash value) */ -static Node *ICACHE_FLASH_ATTR mainposition (const Table *t, const TValue *key) { +static Node *mainposition (const Table *t, const TValue *key) { switch (ttype(key)) { case LUA_TNUMBER: return hashnum(t, nvalue(key)); @@ -119,7 +119,7 @@ static Node *ICACHE_FLASH_ATTR mainposition (const Table *t, const TValue *key) ** returns the index for `key' if `key' is an appropriate key to live in ** the array part of the table, -1 otherwise. */ -static int ICACHE_FLASH_ATTR arrayindex (const TValue *key) { +static int arrayindex (const TValue *key) { if (ttisnumber(key)) { lua_Number n = nvalue(key); int k; @@ -136,7 +136,7 @@ static int ICACHE_FLASH_ATTR arrayindex (const TValue *key) { ** elements in the array part, then elements in the hash part. The ** beginning of a traversal is signalled by -1. */ -static int ICACHE_FLASH_ATTR findindex (lua_State *L, Table *t, StkId key) { +static int findindex (lua_State *L, Table *t, StkId key) { int i; if (ttisnil(key)) return -1; /* first iteration */ i = arrayindex(key); @@ -161,7 +161,7 @@ static int ICACHE_FLASH_ATTR findindex (lua_State *L, Table *t, StkId key) { } -int ICACHE_FLASH_ATTR luaH_next (lua_State *L, Table *t, StkId key) { +int luaH_next (lua_State *L, Table *t, StkId key) { int i = findindex(L, t, key); /* find original element */ for (i++; i < t->sizearray; i++) { /* try first array part */ if (!ttisnil(&t->array[i])) { /* a non-nil value? */ @@ -181,7 +181,7 @@ int ICACHE_FLASH_ATTR luaH_next (lua_State *L, Table *t, StkId key) { } -int ICACHE_FLASH_ATTR luaH_next_ro (lua_State *L, void *t, StkId key) { +int luaH_next_ro (lua_State *L, void *t, StkId key) { luaR_next(L, t, key, key+1); return ttisnil(key) ? 0 : 1; } @@ -194,7 +194,7 @@ int ICACHE_FLASH_ATTR luaH_next_ro (lua_State *L, void *t, StkId key) { */ -static int ICACHE_FLASH_ATTR computesizes (int nums[], int *narray) { +static int computesizes (int nums[], int *narray) { int i; int twotoi; /* 2^i */ int a = 0; /* number of elements smaller than 2^i */ @@ -216,7 +216,7 @@ static int ICACHE_FLASH_ATTR computesizes (int nums[], int *narray) { } -static int ICACHE_FLASH_ATTR countint (const TValue *key, int *nums) { +static int countint (const TValue *key, int *nums) { int k = arrayindex(key); if (0 < k && k <= MAXASIZE) { /* is `key' an appropriate array index? */ nums[ceillog2(k)]++; /* count as such */ @@ -227,7 +227,7 @@ static int ICACHE_FLASH_ATTR countint (const TValue *key, int *nums) { } -static int ICACHE_FLASH_ATTR numusearray (const Table *t, int *nums) { +static int numusearray (const Table *t, int *nums) { int lg; int ttlg; /* 2^lg */ int ause = 0; /* summation of `nums' */ @@ -252,7 +252,7 @@ static int ICACHE_FLASH_ATTR numusearray (const Table *t, int *nums) { } -static int ICACHE_FLASH_ATTR numusehash (const Table *t, int *nums, int *pnasize) { +static int numusehash (const Table *t, int *nums, int *pnasize) { int totaluse = 0; /* total number of elements */ int ause = 0; /* summation of `nums' */ int i = sizenode(t); @@ -268,7 +268,7 @@ static int ICACHE_FLASH_ATTR numusehash (const Table *t, int *nums, int *pnasize } -static void ICACHE_FLASH_ATTR setarrayvector (lua_State *L, Table *t, int size) { +static void setarrayvector (lua_State *L, Table *t, int size) { int i; luaM_reallocvector(L, t->array, t->sizearray, size, TValue); for (i=t->sizearray; ilastfree-- > t->node) { if (ttisnil(gkey(t->lastfree))) return t->lastfree; @@ -286,7 +286,7 @@ static Node *ICACHE_FLASH_ATTR getfreepos (Table *t) { } -static void ICACHE_FLASH_ATTR resizenodevector (lua_State *L, Table *t, int oldsize, int newsize) { +static void resizenodevector (lua_State *L, Table *t, int oldsize, int newsize) { int lsize; if (newsize == 0) { /* no elements to hash part? */ t->node = cast(Node *, dummynode); /* use common `dummynode' */ @@ -317,7 +317,7 @@ static void ICACHE_FLASH_ATTR resizenodevector (lua_State *L, Table *t, int olds } -static Node *ICACHE_FLASH_ATTR find_prev_node(Node *mp, Node *next) { +static Node *find_prev_node(Node *mp, Node *next) { Node *prev = mp; while (prev != NULL && gnext(prev) != next) prev = gnext(prev); return prev; @@ -331,7 +331,7 @@ static Node *ICACHE_FLASH_ATTR find_prev_node(Node *mp, Node *next) { ** node to an empty place and put moving node in its main position; otherwise ** (colliding node is in its main position), moving node goes to an empty position. */ -static int ICACHE_FLASH_ATTR move_node (lua_State *L, Table *t, Node *node) { +static int move_node (lua_State *L, Table *t, Node *node) { Node *mp = mainposition(t, key2tval(node)); /* if node is in it's main position, don't need to move node. */ if (mp == node) return 1; @@ -369,7 +369,7 @@ static int ICACHE_FLASH_ATTR move_node (lua_State *L, Table *t, Node *node) { } -static int ICACHE_FLASH_ATTR move_number (lua_State *L, Table *t, Node *node) { +static int move_number (lua_State *L, Table *t, Node *node) { int key; lua_Number n = nvalue(key2tval(node)); lua_number2int(key, n); @@ -386,7 +386,7 @@ static int ICACHE_FLASH_ATTR move_number (lua_State *L, Table *t, Node *node) { } -static void ICACHE_FLASH_ATTR resize_hashpart (lua_State *L, Table *t, int nhsize) { +static void resize_hashpart (lua_State *L, Table *t, int nhsize) { int i; int lsize=0; int oldhsize = (t->node != dummynode) ? twoto(t->lsizenode) : 0; @@ -439,7 +439,7 @@ static void ICACHE_FLASH_ATTR resize_hashpart (lua_State *L, Table *t, int nhsiz } -static void ICACHE_FLASH_ATTR resize (lua_State *L, Table *t, int nasize, int nhsize) { +static void resize (lua_State *L, Table *t, int nasize, int nhsize) { int i; int oldasize = t->sizearray; if (nasize > oldasize) /* array part must grow? */ @@ -458,13 +458,13 @@ static void ICACHE_FLASH_ATTR resize (lua_State *L, Table *t, int nasize, int nh } -void ICACHE_FLASH_ATTR luaH_resizearray (lua_State *L, Table *t, int nasize) { +void luaH_resizearray (lua_State *L, Table *t, int nasize) { int nsize = (t->node == dummynode) ? 0 : sizenode(t); resize(L, t, nasize, nsize); } -static void ICACHE_FLASH_ATTR rehash (lua_State *L, Table *t, const TValue *ek) { +static void rehash (lua_State *L, Table *t, const TValue *ek) { int nasize, na; int nums[MAXBITS+1]; /* nums[i] = number of keys between 2^(i-1) and 2^i */ int i; @@ -489,7 +489,7 @@ static void ICACHE_FLASH_ATTR rehash (lua_State *L, Table *t, const TValue *ek) */ -Table *ICACHE_FLASH_ATTR luaH_new (lua_State *L, int narray, int nhash) { +Table *luaH_new (lua_State *L, int narray, int nhash) { Table *t = luaM_new(L, Table); luaC_link(L, obj2gco(t), LUA_TTABLE); sethvalue2s(L, L->top, t); /* put table on stack */ @@ -508,7 +508,7 @@ Table *ICACHE_FLASH_ATTR luaH_new (lua_State *L, int narray, int nhash) { } -void ICACHE_FLASH_ATTR luaH_free (lua_State *L, Table *t) { +void luaH_free (lua_State *L, Table *t) { if (t->node != dummynode) luaM_freearray(L, t->node, sizenode(t), Node); luaM_freearray(L, t->array, t->sizearray, TValue); @@ -524,7 +524,7 @@ void ICACHE_FLASH_ATTR luaH_free (lua_State *L, Table *t) { ** put new key in its main position; otherwise (colliding node is in its main ** position), new key goes to an empty position. */ -static TValue *ICACHE_FLASH_ATTR newkey (lua_State *L, Table *t, const TValue *key) { +static TValue *newkey (lua_State *L, Table *t, const TValue *key) { Node *mp = mainposition(t, key); if (!ttisnil(gval(mp)) || mp == dummynode) { Node *othern; @@ -560,7 +560,7 @@ static TValue *ICACHE_FLASH_ATTR newkey (lua_State *L, Table *t, const TValue *k /* ** search function for integers */ -const TValue *ICACHE_FLASH_ATTR luaH_getnum (Table *t, int key) { +const TValue *luaH_getnum (Table *t, int key) { /* (1 <= key && key <= t->sizearray) */ if (cast(unsigned int, key-1) < cast(unsigned int, t->sizearray)) return &t->array[key-1]; @@ -577,7 +577,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_getnum (Table *t, int key) { } /* same thing for rotables */ -const TValue *ICACHE_FLASH_ATTR luaH_getnum_ro (void *t, int key) { +const TValue *luaH_getnum_ro (void *t, int key) { const TValue *res = luaR_findentry(t, NULL, key, NULL); return res ? res : luaO_nilobject; } @@ -586,7 +586,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_getnum_ro (void *t, int key) { /* ** search function for strings */ -const TValue *ICACHE_FLASH_ATTR luaH_getstr (Table *t, TString *key) { +const TValue *luaH_getstr (Table *t, TString *key) { Node *n = hashstr(t, key); do { /* check whether `key' is somewhere in the chain */ if (ttisstring(gkey(n)) && rawtsvalue(gkey(n)) == key) @@ -597,7 +597,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_getstr (Table *t, TString *key) { } /* same thing for rotables */ -const TValue *ICACHE_FLASH_ATTR luaH_getstr_ro (void *t, TString *key) { +const TValue *luaH_getstr_ro (void *t, TString *key) { char keyname[LUA_MAX_ROTABLE_NAME + 1]; const TValue *res; if (!t) @@ -611,7 +611,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_getstr_ro (void *t, TString *key) { /* ** main search function */ -const TValue *ICACHE_FLASH_ATTR luaH_get (Table *t, const TValue *key) { +const TValue *luaH_get (Table *t, const TValue *key) { switch (ttype(key)) { case LUA_TNIL: return luaO_nilobject; case LUA_TSTRING: return luaH_getstr(t, rawtsvalue(key)); @@ -636,7 +636,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_get (Table *t, const TValue *key) { } /* same thing for rotables */ -const TValue *ICACHE_FLASH_ATTR luaH_get_ro (void *t, const TValue *key) { +const TValue *luaH_get_ro (void *t, const TValue *key) { switch (ttype(key)) { case LUA_TNIL: return luaO_nilobject; case LUA_TSTRING: return luaH_getstr_ro(t, rawtsvalue(key)); @@ -655,7 +655,7 @@ const TValue *ICACHE_FLASH_ATTR luaH_get_ro (void *t, const TValue *key) { } -TValue *ICACHE_FLASH_ATTR luaH_set (lua_State *L, Table *t, const TValue *key) { +TValue *luaH_set (lua_State *L, Table *t, const TValue *key) { const TValue *p = luaH_get(t, key); t->flags = 0; if (p != luaO_nilobject) @@ -669,7 +669,7 @@ TValue *ICACHE_FLASH_ATTR luaH_set (lua_State *L, Table *t, const TValue *key) { } -TValue *ICACHE_FLASH_ATTR luaH_setnum (lua_State *L, Table *t, int key) { +TValue *luaH_setnum (lua_State *L, Table *t, int key) { const TValue *p = luaH_getnum(t, key); if (p != luaO_nilobject) return cast(TValue *, p); @@ -681,7 +681,7 @@ TValue *ICACHE_FLASH_ATTR luaH_setnum (lua_State *L, Table *t, int key) { } -TValue *ICACHE_FLASH_ATTR luaH_setstr (lua_State *L, Table *t, TString *key) { +TValue *luaH_setstr (lua_State *L, Table *t, TString *key) { const TValue *p = luaH_getstr(t, key); if (p != luaO_nilobject) return cast(TValue *, p); @@ -693,7 +693,7 @@ TValue *ICACHE_FLASH_ATTR luaH_setstr (lua_State *L, Table *t, TString *key) { } -static int ICACHE_FLASH_ATTR unbound_search (Table *t, unsigned int j) { +static int unbound_search (Table *t, unsigned int j) { unsigned int i = j; /* i is zero or a present index */ j++; /* find `i' and `j' such that i is present and j is not */ @@ -721,7 +721,7 @@ static int ICACHE_FLASH_ATTR unbound_search (Table *t, unsigned int j) { ** Try to find a boundary in table `t'. A `boundary' is an integer index ** such that t[i] is non-nil and t[i+1] is nil (and 0 if t[1] is nil). */ -int ICACHE_FLASH_ATTR luaH_getn (Table *t) { +int luaH_getn (Table *t) { unsigned int j = t->sizearray; if (j > 0 && ttisnil(&t->array[j - 1])) { /* there is a boundary in the array part: (binary) search for it */ @@ -740,7 +740,7 @@ int ICACHE_FLASH_ATTR luaH_getn (Table *t) { } /* same thing for rotables */ -int ICACHE_FLASH_ATTR luaH_getn_ro (void *t) { +int luaH_getn_ro (void *t) { int i = 1, len=0; while(luaR_findentry(t, NULL, i ++, NULL)) @@ -750,10 +750,10 @@ int ICACHE_FLASH_ATTR luaH_getn_ro (void *t) { #if defined(LUA_DEBUG) -Node *ICACHE_FLASH_ATTR luaH_mainposition (const Table *t, const TValue *key) { +Node *luaH_mainposition (const Table *t, const TValue *key) { return mainposition(t, key); } -int ICACHE_FLASH_ATTR luaH_isdummy (Node *n) { return n == dummynode; } +int luaH_isdummy (Node *n) { return n == dummynode; } #endif diff --git a/app/lua/ltablib.c b/app/lua/ltablib.c index 08e0d498..540c6572 100644 --- a/app/lua/ltablib.c +++ b/app/lua/ltablib.c @@ -20,7 +20,7 @@ #define aux_getn(L,n) (luaL_checktype(L, n, LUA_TTABLE), luaL_getn(L, n)) -static int ICACHE_FLASH_ATTR foreachi (lua_State *L) { +static int foreachi (lua_State *L) { int i; int n = aux_getn(L, 1); luaL_checkanyfunction(L, 2); @@ -37,7 +37,7 @@ static int ICACHE_FLASH_ATTR foreachi (lua_State *L) { } -static int ICACHE_FLASH_ATTR foreach (lua_State *L) { +static int foreach (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); luaL_checkanyfunction(L, 2); lua_pushnil(L); /* first key */ @@ -54,7 +54,7 @@ static int ICACHE_FLASH_ATTR foreach (lua_State *L) { } -static int ICACHE_FLASH_ATTR maxn (lua_State *L) { +static int maxn (lua_State *L) { lua_Number max = 0; luaL_checktype(L, 1, LUA_TTABLE); lua_pushnil(L); /* first key */ @@ -70,13 +70,13 @@ static int ICACHE_FLASH_ATTR maxn (lua_State *L) { } -static int ICACHE_FLASH_ATTR getn (lua_State *L) { +static int getn (lua_State *L) { lua_pushinteger(L, aux_getn(L, 1)); return 1; } -static int ICACHE_FLASH_ATTR setn (lua_State *L) { +static int setn (lua_State *L) { luaL_checktype(L, 1, LUA_TTABLE); #ifndef luaL_setn luaL_setn(L, 1, luaL_checkint(L, 2)); @@ -88,7 +88,7 @@ static int ICACHE_FLASH_ATTR setn (lua_State *L) { } -static int ICACHE_FLASH_ATTR tinsert (lua_State *L) { +static int tinsert (lua_State *L) { int e = aux_getn(L, 1) + 1; /* first empty element */ int pos; /* where to insert new element */ switch (lua_gettop(L)) { @@ -116,7 +116,7 @@ static int ICACHE_FLASH_ATTR tinsert (lua_State *L) { } -static int ICACHE_FLASH_ATTR tremove (lua_State *L) { +static int tremove (lua_State *L) { int e = aux_getn(L, 1); int pos = luaL_optint(L, 2, e); if (!(1 <= pos && pos <= e)) /* position is outside bounds? */ @@ -133,7 +133,7 @@ static int ICACHE_FLASH_ATTR tremove (lua_State *L) { } -static void ICACHE_FLASH_ATTR addfield (lua_State *L, luaL_Buffer *b, int i) { +static void addfield (lua_State *L, luaL_Buffer *b, int i) { lua_rawgeti(L, 1, i); if (!lua_isstring(L, -1)) luaL_error(L, "invalid value (%s) at index %d in table for " @@ -142,7 +142,7 @@ static void ICACHE_FLASH_ATTR addfield (lua_State *L, luaL_Buffer *b, int i) { } -static int ICACHE_FLASH_ATTR tconcat (lua_State *L) { +static int tconcat (lua_State *L) { luaL_Buffer b; size_t lsep; int i, last; @@ -171,12 +171,12 @@ static int ICACHE_FLASH_ATTR tconcat (lua_State *L) { */ -static void ICACHE_FLASH_ATTR set2 (lua_State *L, int i, int j) { +static void set2 (lua_State *L, int i, int j) { lua_rawseti(L, 1, i); lua_rawseti(L, 1, j); } -static int ICACHE_FLASH_ATTR sort_comp (lua_State *L, int a, int b) { +static int sort_comp (lua_State *L, int a, int b) { if (!lua_isnil(L, 2)) { /* function? */ int res; lua_pushvalue(L, 2); @@ -191,7 +191,7 @@ static int ICACHE_FLASH_ATTR sort_comp (lua_State *L, int a, int b) { return lua_lessthan(L, a, b); } -static void ICACHE_FLASH_ATTR auxsort (lua_State *L, int l, int u) { +static void auxsort (lua_State *L, int l, int u) { while (l < u) { /* for tail recursion */ int i, j; /* sort elements a[l], a[(l+u)/2] and a[u] */ @@ -254,7 +254,7 @@ static void ICACHE_FLASH_ATTR auxsort (lua_State *L, int l, int u) { } /* repeat the routine for the larger one */ } -static int ICACHE_FLASH_ATTR sort (lua_State *L) { +static int sort (lua_State *L) { int n = aux_getn(L, 1); luaL_checkstack(L, 40, ""); /* assume array is smaller than 2^40 */ if (!lua_isnoneornil(L, 2)) /* is there a 2nd argument? */ @@ -282,6 +282,6 @@ const LUA_REG_TYPE tab_funcs[] = { {LNILKEY, LNILVAL} }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_table (lua_State *L) { +LUALIB_API int luaopen_table (lua_State *L) { LREGISTER(L, LUA_TABLIBNAME, tab_funcs); } diff --git a/app/lua/ltm.c b/app/lua/ltm.c index bc916237..1cb14ff7 100644 --- a/app/lua/ltm.c +++ b/app/lua/ltm.c @@ -28,7 +28,7 @@ const char *const luaT_typenames[] = { }; -void ICACHE_FLASH_ATTR luaT_init (lua_State *L) { +void luaT_init (lua_State *L) { static const char *const luaT_eventname[] = { /* ORDER TM */ "__index", "__newindex", "__gc", "__mode", "__eq", @@ -48,7 +48,7 @@ void ICACHE_FLASH_ATTR luaT_init (lua_State *L) { ** function to be used with macro "fasttm": optimized for absence of ** tag methods */ -const TValue *ICACHE_FLASH_ATTR luaT_gettm (Table *events, TMS event, TString *ename) { +const TValue *luaT_gettm (Table *events, TMS event, TString *ename) { const TValue *tm = luaR_isrotable(events) ? luaH_getstr_ro(events, ename) : luaH_getstr(events, ename); lua_assert(event <= TM_EQ); if (ttisnil(tm)) { /* no tag method? */ @@ -60,7 +60,7 @@ const TValue *ICACHE_FLASH_ATTR luaT_gettm (Table *events, TMS event, TString *e } -const TValue *ICACHE_FLASH_ATTR luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { +const TValue *luaT_gettmbyobj (lua_State *L, const TValue *o, TMS event) { Table *mt; switch (ttype(o)) { case LUA_TTABLE: diff --git a/app/lua/lua.c b/app/lua/lua.c index a803a306..43325550 100644 --- a/app/lua/lua.c +++ b/app/lua/lua.c @@ -35,14 +35,14 @@ int led_high_count = LED_HIGH_COUNT_DEFAULT; int led_low_count = LED_LOW_COUNT_DEFAULT; static int led_count = 0; #if 0 -static void ICACHE_FLASH_ATTR lstop (lua_State *L, lua_Debug *ar) { +static void lstop (lua_State *L, lua_Debug *ar) { (void)ar; /* unused arg. */ lua_sethook(L, NULL, 0, 0); luaL_error(L, "interrupted!"); } -static void ICACHE_FLASH_ATTR laction (int i) { +static void laction (int i) { // signal(i, SIG_DFL); /* if another SIGINT happens before lstop, terminate process (default action) */ @@ -50,7 +50,7 @@ static void ICACHE_FLASH_ATTR laction (int i) { } -static void ICACHE_FLASH_ATTR print_usage (void) { +static void print_usage (void) { #if defined(LUA_USE_STDIO) c_fprintf(c_stderr, #else @@ -73,7 +73,7 @@ static void ICACHE_FLASH_ATTR print_usage (void) { } #endif -static void ICACHE_FLASH_ATTR l_message (const char *pname, const char *msg) { +static void l_message (const char *pname, const char *msg) { #if defined(LUA_USE_STDIO) if (pname) c_fprintf(c_stderr, "%s: ", pname); c_fprintf(c_stderr, "%s\n", msg); @@ -85,7 +85,7 @@ static void ICACHE_FLASH_ATTR l_message (const char *pname, const char *msg) { } -static int ICACHE_FLASH_ATTR report (lua_State *L, int status) { +static int report (lua_State *L, int status) { if (status && !lua_isnil(L, -1)) { const char *msg = lua_tostring(L, -1); if (msg == NULL) msg = "(error object is not a string)"; @@ -96,7 +96,7 @@ static int ICACHE_FLASH_ATTR report (lua_State *L, int status) { } -static int ICACHE_FLASH_ATTR traceback (lua_State *L) { +static int traceback (lua_State *L) { if (!lua_isstring(L, 1)) /* 'message' not a string? */ return 1; /* keep it intact */ lua_getfield(L, LUA_GLOBALSINDEX, "debug"); @@ -116,7 +116,7 @@ static int ICACHE_FLASH_ATTR traceback (lua_State *L) { } -static int ICACHE_FLASH_ATTR docall (lua_State *L, int narg, int clear) { +static int docall (lua_State *L, int narg, int clear) { int status; int base = lua_gettop(L) - narg; /* function index */ lua_pushcfunction(L, traceback); /* push traceback function */ @@ -131,13 +131,13 @@ static int ICACHE_FLASH_ATTR docall (lua_State *L, int narg, int clear) { } -static void ICACHE_FLASH_ATTR print_version (void) { +static void print_version (void) { // l_message(NULL, LUA_RELEASE " " LUA_COPYRIGHT); l_message(NULL, NODE_VERSION " " BUILD_DATE " powered by " LUA_RELEASE); } -static int ICACHE_FLASH_ATTR getargs (lua_State *L, char **argv, int n) { +static int getargs (lua_State *L, char **argv, int n) { int narg; int i; int argc = 0; @@ -155,30 +155,30 @@ static int ICACHE_FLASH_ATTR getargs (lua_State *L, char **argv, int n) { } #if 0 -static int ICACHE_FLASH_ATTR dofile (lua_State *L, const char *name) { +static int dofile (lua_State *L, const char *name) { int status = luaL_loadfile(L, name) || docall(L, 0, 1); return report(L, status); } #else -static int ICACHE_FLASH_ATTR dofsfile (lua_State *L, const char *name) { +static int dofsfile (lua_State *L, const char *name) { int status = luaL_loadfsfile(L, name) || docall(L, 0, 1); return report(L, status); } #endif -static int ICACHE_FLASH_ATTR dostring (lua_State *L, const char *s, const char *name) { +static int dostring (lua_State *L, const char *s, const char *name) { int status = luaL_loadbuffer(L, s, c_strlen(s), name) || docall(L, 0, 1); return report(L, status); } -static int ICACHE_FLASH_ATTR dolibrary (lua_State *L, const char *name) { +static int dolibrary (lua_State *L, const char *name) { lua_getglobal(L, "require"); lua_pushstring(L, name); return report(L, docall(L, 1, 1)); } -static const char *ICACHE_FLASH_ATTR get_prompt (lua_State *L, int firstline) { +static const char *get_prompt (lua_State *L, int firstline) { const char *p; lua_getfield(L, LUA_GLOBALSINDEX, firstline ? "_PROMPT" : "_PROMPT2"); p = lua_tostring(L, -1); @@ -188,7 +188,7 @@ static const char *ICACHE_FLASH_ATTR get_prompt (lua_State *L, int firstline) { } -static int ICACHE_FLASH_ATTR incomplete (lua_State *L, int status) { +static int incomplete (lua_State *L, int status) { if (status == LUA_ERRSYNTAX) { size_t lmsg; const char *msg = lua_tolstring(L, -1, &lmsg); @@ -202,7 +202,7 @@ static int ICACHE_FLASH_ATTR incomplete (lua_State *L, int status) { } #if 0 -static int ICACHE_FLASH_ATTR pushline (lua_State *L, int firstline) { +static int pushline (lua_State *L, int firstline) { char buffer[LUA_MAXINPUT]; char *b = buffer; size_t l; @@ -221,7 +221,7 @@ static int ICACHE_FLASH_ATTR pushline (lua_State *L, int firstline) { } -static int ICACHE_FLASH_ATTR loadline (lua_State *L) { +static int loadline (lua_State *L) { int status; lua_settop(L, 0); if (!pushline(L, 1)) @@ -241,7 +241,7 @@ static int ICACHE_FLASH_ATTR loadline (lua_State *L) { } -static void ICACHE_FLASH_ATTR dotty (lua_State *L) { +static void dotty (lua_State *L) { int status; const char *oldprogname = progname; progname = NULL; @@ -270,7 +270,7 @@ static void ICACHE_FLASH_ATTR dotty (lua_State *L) { } -static int ICACHE_FLASH_ATTR handle_script (lua_State *L, char **argv, int n) { +static int handle_script (lua_State *L, char **argv, int n) { int status; const char *fname; int narg = getargs(L, argv, n); /* collect arguments */ @@ -292,7 +292,7 @@ static int ICACHE_FLASH_ATTR handle_script (lua_State *L, char **argv, int n) { #define notail(x) {if ((x)[2] != '\0') return -1;} -static int ICACHE_FLASH_ATTR collectargs (char **argv, int *pi, int *pv, int *pe) { +static int collectargs (char **argv, int *pi, int *pv, int *pe) { int i; for (i = 1; argv[i] != NULL; i++) { if (argv[i][0] != '-') /* not an option? */ @@ -326,7 +326,7 @@ static int ICACHE_FLASH_ATTR collectargs (char **argv, int *pi, int *pv, int *pe } -static int ICACHE_FLASH_ATTR runargs (lua_State *L, char **argv, int n) { +static int runargs (lua_State *L, char **argv, int n) { int i; for (i = 1; i < n; i++) { if (argv[i] == NULL) continue; @@ -364,7 +364,7 @@ static int ICACHE_FLASH_ATTR runargs (lua_State *L, char **argv, int n) { } -static int ICACHE_FLASH_ATTR handle_luainit (lua_State *L) { +static int handle_luainit (lua_State *L) { const char *init = c_getenv(LUA_INIT); if (init == NULL) return 0; /* status OK */ else if (init[0] == '@') @@ -385,7 +385,7 @@ struct Smain { }; -static int ICACHE_FLASH_ATTR pmain (lua_State *L) { +static int pmain (lua_State *L) { struct Smain *s = (struct Smain *)lua_touserdata(L, 1); char **argv = s->argv; int script; @@ -433,9 +433,9 @@ void readline(lua_Load *load); char line_buffer[LUA_MAXINPUT]; #ifdef LUA_RPC -int ICACHE_FLASH_ATTR main (int argc, char **argv) { +int main (int argc, char **argv) { #else -int ICACHE_FLASH_ATTR lua_main (int argc, char **argv) { +int lua_main (int argc, char **argv) { #endif int status; struct Smain s; @@ -469,7 +469,7 @@ int ICACHE_FLASH_ATTR lua_main (int argc, char **argv) { return (status || s.status) ? EXIT_FAILURE : EXIT_SUCCESS; } -void ICACHE_FLASH_ATTR donejob(lua_Load *load){ +void donejob(lua_Load *load){ lua_close(load->L); } @@ -478,7 +478,7 @@ int log_fd = -1; int noparse = 0; #endif -void ICACHE_FLASH_ATTR dojob(lua_Load *load){ +void dojob(lua_Load *load){ size_t l, rs; int status; char *b = load->line; @@ -545,7 +545,7 @@ extern void key_long_press(void *arg); extern void key_short_press(void *arg); static bool key_short_pressed = false; static bool key_long_pressed = false; -void ICACHE_FLASH_ATTR update_key_led(){ +void update_key_led(){ uint8_t temp = 1, level = 1; led_count++; if(led_count>led_low_count+led_high_count){ @@ -588,7 +588,7 @@ extern bool uart0_echo; extern bool run_input; extern uint16_t need_len; extern int16_t end_char; -void ICACHE_FLASH_ATTR readline(lua_Load *load){ +void readline(lua_Load *load){ // NODE_DBG("readline() is called.\n"); update_key_led(); char ch; diff --git a/app/lua/lundump.c b/app/lua/lundump.c index f2062b29..92aa5b4f 100644 --- a/app/lua/lundump.c +++ b/app/lua/lundump.c @@ -37,7 +37,7 @@ typedef struct { #else #define IF(c,s) if (c) error(S,s) -static void ICACHE_FLASH_ATTR error(LoadState* S, const char* why) +static void error(LoadState* S, const char* why) { luaO_pushfstring(S->L,"%s: %s in precompiled chunk",S->name,why); luaD_throw(S->L,LUA_ERRSYNTAX); @@ -48,14 +48,14 @@ static void ICACHE_FLASH_ATTR error(LoadState* S, const char* why) #define LoadVar(S,x) LoadMem(S,&x,1,sizeof(x)) #define LoadVector(S,b,n,size) LoadMem(S,b,n,size) -static void ICACHE_FLASH_ATTR LoadBlock(LoadState* S, void* b, size_t size) +static void LoadBlock(LoadState* S, void* b, size_t size) { size_t r=luaZ_read(S->Z,b,size); IF (r!=0, "unexpected end"); S->total+=size; } -static void ICACHE_FLASH_ATTR LoadMem (LoadState* S, void* b, int n, size_t size) +static void LoadMem (LoadState* S, void* b, int n, size_t size) { LoadBlock(S,b,n*size); if (S->swap && b) @@ -98,20 +98,20 @@ static void ICACHE_FLASH_ATTR LoadMem (LoadState* S, void* b, int n, size_t size } } -static int ICACHE_FLASH_ATTR LoadChar(LoadState* S) +static int LoadChar(LoadState* S) { char x; LoadVar(S,x); return x; } -static void ICACHE_FLASH_ATTR Align4(LoadState* S) +static void Align4(LoadState* S) { while(S->total&3) LoadChar(S); } -static int ICACHE_FLASH_ATTR LoadInt(LoadState* S) +static int LoadInt(LoadState* S) { int x; LoadVar(S,x); @@ -119,7 +119,7 @@ static int ICACHE_FLASH_ATTR LoadInt(LoadState* S) return x; } -static lua_Number ICACHE_FLASH_ATTR LoadNumber(LoadState* S) +static lua_Number LoadNumber(LoadState* S) { lua_Number x; if(S->toflt) @@ -158,7 +158,7 @@ static lua_Number ICACHE_FLASH_ATTR LoadNumber(LoadState* S) return x; } -static TString* ICACHE_FLASH_ATTR LoadString(LoadState* S) +static TString* LoadString(LoadState* S) { int32_t size; LoadVar(S,size); @@ -179,7 +179,7 @@ static TString* ICACHE_FLASH_ATTR LoadString(LoadState* S) } } -static void ICACHE_FLASH_ATTR LoadCode(LoadState* S, Proto* f) +static void LoadCode(LoadState* S, Proto* f) { int n=LoadInt(S); Align4(S); @@ -195,7 +195,7 @@ static void ICACHE_FLASH_ATTR LoadCode(LoadState* S, Proto* f) static Proto* LoadFunction(LoadState* S, TString* p); -static void ICACHE_FLASH_ATTR LoadConstants(LoadState* S, Proto* f) +static void LoadConstants(LoadState* S, Proto* f) { int i,n; n=LoadInt(S); @@ -232,7 +232,7 @@ static void ICACHE_FLASH_ATTR LoadConstants(LoadState* S, Proto* f) for (i=0; ip[i]=LoadFunction(S,f->source); } -static void ICACHE_FLASH_ATTR LoadDebug(LoadState* S, Proto* f) +static void LoadDebug(LoadState* S, Proto* f) { int i,n; n=LoadInt(S); @@ -262,7 +262,7 @@ static void ICACHE_FLASH_ATTR LoadDebug(LoadState* S, Proto* f) for (i=0; iupvalues[i]=LoadString(S); } -static Proto* ICACHE_FLASH_ATTR LoadFunction(LoadState* S, TString* p) +static Proto* LoadFunction(LoadState* S, TString* p) { Proto* f; if (++S->L->nCcalls > LUAI_MAXCCALLS) error(S,"code too deep"); @@ -285,7 +285,7 @@ static Proto* ICACHE_FLASH_ATTR LoadFunction(LoadState* S, TString* p) return f; } -static void ICACHE_FLASH_ATTR LoadHeader(LoadState* S) +static void LoadHeader(LoadState* S) { char h[LUAC_HEADERSIZE]; char s[LUAC_HEADERSIZE]; @@ -302,7 +302,7 @@ static void ICACHE_FLASH_ATTR LoadHeader(LoadState* S) /* ** load precompiled chunk */ -Proto* ICACHE_FLASH_ATTR luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) +Proto* luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const char* name) { LoadState S; if (*name=='@' || *name=='=') @@ -322,7 +322,7 @@ Proto* ICACHE_FLASH_ATTR luaU_undump (lua_State* L, ZIO* Z, Mbuffer* buff, const /* * make header */ -void ICACHE_FLASH_ATTR luaU_header (char* h) +void luaU_header (char* h) { int x=1; c_memcpy(h,LUA_SIGNATURE,sizeof(LUA_SIGNATURE)-1); diff --git a/app/lua/lvm.c b/app/lua/lvm.c index 729706c0..fe0243e2 100644 --- a/app/lua/lvm.c +++ b/app/lua/lvm.c @@ -32,7 +32,7 @@ #define MAXTAGLOOP 100 #if defined LUA_NUMBER_INTEGRAL -LUA_NUMBER ICACHE_FLASH_ATTR luai_ipow(LUA_NUMBER a, LUA_NUMBER b) { +LUA_NUMBER luai_ipow(LUA_NUMBER a, LUA_NUMBER b) { if (b < 0) return 0; else if (b == 0) @@ -51,7 +51,7 @@ LUA_NUMBER ICACHE_FLASH_ATTR luai_ipow(LUA_NUMBER a, LUA_NUMBER b) { } #endif -const TValue *ICACHE_FLASH_ATTR luaV_tonumber (const TValue *obj, TValue *n) { +const TValue *luaV_tonumber (const TValue *obj, TValue *n) { lua_Number num; if (ttisnumber(obj)) return obj; if (ttisstring(obj) && luaO_str2d(svalue(obj), &num)) { @@ -63,7 +63,7 @@ const TValue *ICACHE_FLASH_ATTR luaV_tonumber (const TValue *obj, TValue *n) { } -int ICACHE_FLASH_ATTR luaV_tostring (lua_State *L, StkId obj) { +int luaV_tostring (lua_State *L, StkId obj) { if (!ttisnumber(obj)) return 0; else { @@ -77,7 +77,7 @@ int ICACHE_FLASH_ATTR luaV_tostring (lua_State *L, StkId obj) { } -static void ICACHE_FLASH_ATTR traceexec (lua_State *L, const Instruction *pc) { +static void traceexec (lua_State *L, const Instruction *pc) { lu_byte mask = L->hookmask; const Instruction *oldpc = L->savedpc; L->savedpc = pc; @@ -97,7 +97,7 @@ static void ICACHE_FLASH_ATTR traceexec (lua_State *L, const Instruction *pc) { } -static void ICACHE_FLASH_ATTR callTMres (lua_State *L, StkId res, const TValue *f, +static void callTMres (lua_State *L, StkId res, const TValue *f, const TValue *p1, const TValue *p2) { ptrdiff_t result = savestack(L, res); setobj2s(L, L->top, f); /* push function */ @@ -113,7 +113,7 @@ static void ICACHE_FLASH_ATTR callTMres (lua_State *L, StkId res, const TValue * -static void ICACHE_FLASH_ATTR callTM (lua_State *L, const TValue *f, const TValue *p1, +static void callTM (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, const TValue *p3) { setobj2s(L, L->top, f); /* push function */ setobj2s(L, L->top+1, p1); /* 1st argument */ @@ -125,7 +125,7 @@ static void ICACHE_FLASH_ATTR callTM (lua_State *L, const TValue *f, const TValu } -void ICACHE_FLASH_ATTR luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { +void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { int loop; TValue temp; for (loop = 0; loop < MAXTAGLOOP; loop++) { @@ -154,7 +154,7 @@ void ICACHE_FLASH_ATTR luaV_gettable (lua_State *L, const TValue *t, TValue *key } -void ICACHE_FLASH_ATTR luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { +void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { int loop; TValue temp; setnilvalue(L->top); @@ -195,7 +195,7 @@ void ICACHE_FLASH_ATTR luaV_settable (lua_State *L, const TValue *t, TValue *key } -static int ICACHE_FLASH_ATTR call_binTM (lua_State *L, const TValue *p1, const TValue *p2, +static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event) { const TValue *tm = luaT_gettmbyobj(L, p1, event); /* try first operand */ if (ttisnil(tm)) @@ -206,7 +206,7 @@ static int ICACHE_FLASH_ATTR call_binTM (lua_State *L, const TValue *p1, const T } -static const TValue *ICACHE_FLASH_ATTR get_compTM (lua_State *L, Table *mt1, Table *mt2, +static const TValue *get_compTM (lua_State *L, Table *mt1, Table *mt2, TMS event) { const TValue *tm1 = fasttm(L, mt1, event); const TValue *tm2; @@ -220,7 +220,7 @@ static const TValue *ICACHE_FLASH_ATTR get_compTM (lua_State *L, Table *mt1, Tab } -static int ICACHE_FLASH_ATTR call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, +static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, TMS event) { const TValue *tm1 = luaT_gettmbyobj(L, p1, event); const TValue *tm2; @@ -233,7 +233,7 @@ static int ICACHE_FLASH_ATTR call_orderTM (lua_State *L, const TValue *p1, const } -static int ICACHE_FLASH_ATTR l_strcmp (const TString *ls, const TString *rs) { +static int l_strcmp (const TString *ls, const TString *rs) { const char *l = getstr(ls); size_t ll = ls->tsv.len; const char *r = getstr(rs); @@ -255,7 +255,7 @@ static int ICACHE_FLASH_ATTR l_strcmp (const TString *ls, const TString *rs) { } -int ICACHE_FLASH_ATTR luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { +int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r) { int res; if (ttype(l) != ttype(r)) return luaG_ordererror(L, l, r); @@ -269,7 +269,7 @@ int ICACHE_FLASH_ATTR luaV_lessthan (lua_State *L, const TValue *l, const TValue } -static int ICACHE_FLASH_ATTR lessequal (lua_State *L, const TValue *l, const TValue *r) { +static int lessequal (lua_State *L, const TValue *l, const TValue *r) { int res; if (ttype(l) != ttype(r)) return luaG_ordererror(L, l, r); @@ -285,7 +285,7 @@ static int ICACHE_FLASH_ATTR lessequal (lua_State *L, const TValue *l, const TVa } -int ICACHE_FLASH_ATTR luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { +int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2) { const TValue *tm; lua_assert(ttype(t1) == ttype(t2)); switch (ttype(t1)) { @@ -315,7 +315,7 @@ int ICACHE_FLASH_ATTR luaV_equalval (lua_State *L, const TValue *t1, const TValu } -void ICACHE_FLASH_ATTR luaV_concat (lua_State *L, int total, int last) { +void luaV_concat (lua_State *L, int total, int last) { lu_mem max_sizet = MAX_SIZET; if (G(L)->memlimit < max_sizet) max_sizet = G(L)->memlimit; do { @@ -359,7 +359,7 @@ void ICACHE_FLASH_ATTR luaV_concat (lua_State *L, int total, int last) { } -static void ICACHE_FLASH_ATTR Arith (lua_State *L, StkId ra, const TValue *rb, +static void Arith (lua_State *L, StkId ra, const TValue *rb, const TValue *rc, TMS op) { TValue tempb, tempc; const TValue *b, *c; @@ -424,7 +424,7 @@ static void ICACHE_FLASH_ATTR Arith (lua_State *L, StkId ra, const TValue *rb, -void ICACHE_FLASH_ATTR luaV_execute (lua_State *L, int nexeccalls) { +void luaV_execute (lua_State *L, int nexeccalls) { LClosure *cl; StkId base; TValue *k; diff --git a/app/lua/lzio.c b/app/lua/lzio.c index fc3ce0c1..e01dedeb 100644 --- a/app/lua/lzio.c +++ b/app/lua/lzio.c @@ -18,7 +18,7 @@ #include "lzio.h" -int ICACHE_FLASH_ATTR luaZ_fill (ZIO *z) { +int luaZ_fill (ZIO *z) { size_t size; lua_State *L = z->L; const char *buff; @@ -32,7 +32,7 @@ int ICACHE_FLASH_ATTR luaZ_fill (ZIO *z) { } -int ICACHE_FLASH_ATTR luaZ_lookahead (ZIO *z) { +int luaZ_lookahead (ZIO *z) { if (z->n == 0) { if (luaZ_fill(z) == EOZ) return EOZ; @@ -45,7 +45,7 @@ int ICACHE_FLASH_ATTR luaZ_lookahead (ZIO *z) { } -void ICACHE_FLASH_ATTR luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { +void luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void *data) { z->L = L; z->reader = reader; z->data = data; @@ -55,7 +55,7 @@ void ICACHE_FLASH_ATTR luaZ_init (lua_State *L, ZIO *z, lua_Reader reader, void /* --------------------------------------------------------------- read --- */ -size_t ICACHE_FLASH_ATTR luaZ_read (ZIO *z, void *b, size_t n) { +size_t luaZ_read (ZIO *z, void *b, size_t n) { while (n) { size_t m; if (luaZ_lookahead(z) == EOZ) @@ -74,7 +74,7 @@ size_t ICACHE_FLASH_ATTR luaZ_read (ZIO *z, void *b, size_t n) { } /* ------------------------------------------------------------------------ */ -char *ICACHE_FLASH_ATTR luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { +char *luaZ_openspace (lua_State *L, Mbuffer *buff, size_t n) { if (n > buff->buffsize) { if (n < LUA_MINBUFFER) n = LUA_MINBUFFER; luaZ_resizebuffer(L, buff, n); diff --git a/app/lua/not_used/ldblib.c b/app/lua/not_used/ldblib.c index e2bad1c1..cd61775f 100644 --- a/app/lua/not_used/ldblib.c +++ b/app/lua/not_used/ldblib.c @@ -20,13 +20,13 @@ -static int ICACHE_FLASH_ATTR db_getregistry (lua_State *L) { +static int db_getregistry (lua_State *L) { lua_pushvalue(L, LUA_REGISTRYINDEX); return 1; } -static int ICACHE_FLASH_ATTR db_getmetatable (lua_State *L) { +static int db_getmetatable (lua_State *L) { luaL_checkany(L, 1); if (!lua_getmetatable(L, 1)) { lua_pushnil(L); /* no metatable */ @@ -35,7 +35,7 @@ static int ICACHE_FLASH_ATTR db_getmetatable (lua_State *L) { } -static int ICACHE_FLASH_ATTR db_setmetatable (lua_State *L) { +static int db_setmetatable (lua_State *L) { int t = lua_type(L, 2); luaL_argcheck(L, t == LUA_TNIL || t == LUA_TTABLE, 2, "nil or table expected"); @@ -45,14 +45,14 @@ static int ICACHE_FLASH_ATTR db_setmetatable (lua_State *L) { } -static int ICACHE_FLASH_ATTR db_getfenv (lua_State *L) { +static int db_getfenv (lua_State *L) { luaL_checkany(L, 1); lua_getfenv(L, 1); return 1; } -static int ICACHE_FLASH_ATTR db_setfenv (lua_State *L) { +static int db_setfenv (lua_State *L) { luaL_checktype(L, 2, LUA_TTABLE); lua_settop(L, 2); if (lua_setfenv(L, 1) == 0) @@ -62,19 +62,19 @@ static int ICACHE_FLASH_ATTR db_setfenv (lua_State *L) { } -static void ICACHE_FLASH_ATTR settabss (lua_State *L, const char *i, const char *v) { +static void settabss (lua_State *L, const char *i, const char *v) { lua_pushstring(L, v); lua_setfield(L, -2, i); } -static void ICACHE_FLASH_ATTR settabsi (lua_State *L, const char *i, int v) { +static void settabsi (lua_State *L, const char *i, int v) { lua_pushinteger(L, v); lua_setfield(L, -2, i); } -static lua_State *ICACHE_FLASH_ATTR getthread (lua_State *L, int *arg) { +static lua_State *getthread (lua_State *L, int *arg) { if (lua_isthread(L, 1)) { *arg = 1; return lua_tothread(L, 1); @@ -86,7 +86,7 @@ static lua_State *ICACHE_FLASH_ATTR getthread (lua_State *L, int *arg) { } -static void ICACHE_FLASH_ATTR treatstackoption (lua_State *L, lua_State *L1, const char *fname) { +static void treatstackoption (lua_State *L, lua_State *L1, const char *fname) { if (L == L1) { lua_pushvalue(L, -2); lua_remove(L, -3); @@ -97,7 +97,7 @@ static void ICACHE_FLASH_ATTR treatstackoption (lua_State *L, lua_State *L1, con } -static int ICACHE_FLASH_ATTR db_getinfo (lua_State *L) { +static int db_getinfo (lua_State *L) { lua_Debug ar; int arg; lua_State *L1 = getthread(L, &arg); @@ -142,7 +142,7 @@ static int ICACHE_FLASH_ATTR db_getinfo (lua_State *L) { } -static int ICACHE_FLASH_ATTR db_getlocal (lua_State *L) { +static int db_getlocal (lua_State *L) { int arg; lua_State *L1 = getthread(L, &arg); lua_Debug ar; @@ -163,7 +163,7 @@ static int ICACHE_FLASH_ATTR db_getlocal (lua_State *L) { } -static int ICACHE_FLASH_ATTR db_setlocal (lua_State *L) { +static int db_setlocal (lua_State *L) { int arg; lua_State *L1 = getthread(L, &arg); lua_Debug ar; @@ -177,7 +177,7 @@ static int ICACHE_FLASH_ATTR db_setlocal (lua_State *L) { } -static int ICACHE_FLASH_ATTR auxupvalue (lua_State *L, int get) { +static int auxupvalue (lua_State *L, int get) { const char *name; int n = luaL_checkint(L, 2); luaL_checktype(L, 1, LUA_TFUNCTION); @@ -190,12 +190,12 @@ static int ICACHE_FLASH_ATTR auxupvalue (lua_State *L, int get) { } -static int ICACHE_FLASH_ATTR db_getupvalue (lua_State *L) { +static int db_getupvalue (lua_State *L) { return auxupvalue(L, 1); } -static int ICACHE_FLASH_ATTR db_setupvalue (lua_State *L) { +static int db_setupvalue (lua_State *L) { luaL_checkany(L, 3); return auxupvalue(L, 0); } @@ -205,7 +205,7 @@ static int ICACHE_FLASH_ATTR db_setupvalue (lua_State *L) { static const char KEY_HOOK = 'h'; -static void ICACHE_FLASH_ATTR hookf (lua_State *L, lua_Debug *ar) { +static void hookf (lua_State *L, lua_Debug *ar) { static const char *const hooknames[] = {"call", "return", "line", "count", "tail return"}; lua_pushlightuserdata(L, (void *)&KEY_HOOK); @@ -223,7 +223,7 @@ static void ICACHE_FLASH_ATTR hookf (lua_State *L, lua_Debug *ar) { } -static int ICACHE_FLASH_ATTR makemask (const char *smask, int count) { +static int makemask (const char *smask, int count) { int mask = 0; if (c_strchr(smask, 'c')) mask |= LUA_MASKCALL; if (c_strchr(smask, 'r')) mask |= LUA_MASKRET; @@ -233,7 +233,7 @@ static int ICACHE_FLASH_ATTR makemask (const char *smask, int count) { } -static char *ICACHE_FLASH_ATTR unmakemask (int mask, char *smask) { +static char *unmakemask (int mask, char *smask) { int i = 0; if (mask & LUA_MASKCALL) smask[i++] = 'c'; if (mask & LUA_MASKRET) smask[i++] = 'r'; @@ -243,7 +243,7 @@ static char *ICACHE_FLASH_ATTR unmakemask (int mask, char *smask) { } -static void ICACHE_FLASH_ATTR gethooktable (lua_State *L) { +static void gethooktable (lua_State *L) { lua_pushlightuserdata(L, (void *)&KEY_HOOK); lua_rawget(L, LUA_REGISTRYINDEX); if (!lua_istable(L, -1)) { @@ -256,7 +256,7 @@ static void ICACHE_FLASH_ATTR gethooktable (lua_State *L) { } -static int ICACHE_FLASH_ATTR db_sethook (lua_State *L) { +static int db_sethook (lua_State *L) { int arg, mask, count; lua_Hook func; lua_State *L1 = getthread(L, &arg); @@ -280,7 +280,7 @@ static int ICACHE_FLASH_ATTR db_sethook (lua_State *L) { } -static int ICACHE_FLASH_ATTR db_gethook (lua_State *L) { +static int db_gethook (lua_State *L) { int arg; lua_State *L1 = getthread(L, &arg); char buff[5]; @@ -300,7 +300,7 @@ static int ICACHE_FLASH_ATTR db_gethook (lua_State *L) { } -static int ICACHE_FLASH_ATTR db_debug (lua_State *L) { +static int db_debug (lua_State *L) { for (;;) { char buffer[LUA_MAXINPUT]; #if defined(LUA_USE_STDIO) @@ -329,7 +329,7 @@ static int ICACHE_FLASH_ATTR db_debug (lua_State *L) { #define LEVELS1 12 /* size of the first part of the stack */ #define LEVELS2 10 /* size of the second part of the stack */ -static int ICACHE_FLASH_ATTR db_errorfb (lua_State *L) { +static int db_errorfb (lua_State *L) { int level; int firstpart = 1; /* still before eventual `...' */ int arg; @@ -401,6 +401,6 @@ const LUA_REG_TYPE dblib[] = { {LNILKEY, LNILVAL} }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_debug (lua_State *L) { +LUALIB_API int luaopen_debug (lua_State *L) { LREGISTER(L, LUA_DBLIBNAME, dblib); } diff --git a/app/modules/adc.c b/app/modules/adc.c index 338a2507..b64697ba 100644 --- a/app/modules/adc.c +++ b/app/modules/adc.c @@ -10,7 +10,7 @@ #include "c_types.h" // Lua: read(id) , return system adc -static int ICACHE_FLASH_ATTR adc_sample( lua_State* L ) +static int adc_sample( lua_State* L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( adc, id ); @@ -31,7 +31,7 @@ const LUA_REG_TYPE adc_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_adc( lua_State *L ) +LUALIB_API int luaopen_adc( lua_State *L ) { #if LUA_OPTIMIZE_MEMORY > 0 return 0; diff --git a/app/modules/bit.c b/app/modules/bit.c index 8579cc26..ac2d19ba 100644 --- a/app/modules/bit.c +++ b/app/modules/bit.c @@ -34,13 +34,13 @@ typedef size_t lua_UInteger; */ #define MONADIC(name, op) \ - static int ICACHE_FLASH_ATTR bit_ ## name(lua_State *L) { \ + static int bit_ ## name(lua_State *L) { \ lua_pushinteger(L, op TOBIT(L, 1)); \ return 1; \ } #define VARIADIC(name, op) \ - static int ICACHE_FLASH_ATTR bit_ ## name(lua_State *L) { \ + static int bit_ ## name(lua_State *L) { \ int n = lua_gettop(L), i; \ lua_Integer w = TOBIT(L, 1); \ for (i = 2; i <= n; i++) \ @@ -50,14 +50,14 @@ typedef size_t lua_UInteger; } #define LOGICAL_SHIFT(name, op) \ - static int ICACHE_FLASH_ATTR bit_ ## name(lua_State *L) { \ + static int bit_ ## name(lua_State *L) { \ lua_pushinteger(L, (lua_UInteger)TOBIT(L, 1) op \ (unsigned)luaL_checknumber(L, 2)); \ return 1; \ } #define ARITHMETIC_SHIFT(name, op) \ - static int ICACHE_FLASH_ATTR bit_ ## name(lua_State *L) { \ + static int bit_ ## name(lua_State *L) { \ lua_pushinteger(L, (lua_Integer)TOBIT(L, 1) op \ (unsigned)luaL_checknumber(L, 2)); \ return 1; \ @@ -72,14 +72,14 @@ LOGICAL_SHIFT(rshift, >>) ARITHMETIC_SHIFT(arshift, >>) // Lua: res = bit( position ) -static int ICACHE_FLASH_ATTR bit_bit( lua_State* L ) +static int bit_bit( lua_State* L ) { lua_pushinteger( L, ( lua_Integer )( 1 << luaL_checkinteger( L, 1 ) ) ); return 1; } // Lua: res = isset( value, position ) -static int ICACHE_FLASH_ATTR bit_isset( lua_State* L ) +static int bit_isset( lua_State* L ) { lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 ); unsigned pos = ( unsigned )luaL_checkinteger( L, 2 ); @@ -89,7 +89,7 @@ static int ICACHE_FLASH_ATTR bit_isset( lua_State* L ) } // Lua: res = isclear( value, position ) -static int ICACHE_FLASH_ATTR bit_isclear( lua_State* L ) +static int bit_isclear( lua_State* L ) { lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 ); unsigned pos = ( unsigned )luaL_checkinteger( L, 2 ); @@ -99,7 +99,7 @@ static int ICACHE_FLASH_ATTR bit_isclear( lua_State* L ) } // Lua: res = set( value, pos1, pos2, ... ) -static int ICACHE_FLASH_ATTR bit_set( lua_State* L ) +static int bit_set( lua_State* L ) { lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 ); unsigned total = lua_gettop( L ), i; @@ -111,7 +111,7 @@ static int ICACHE_FLASH_ATTR bit_set( lua_State* L ) } // Lua: res = clear( value, pos1, pos2, ... ) -static int ICACHE_FLASH_ATTR bit_clear( lua_State* L ) +static int bit_clear( lua_State* L ) { lua_UInteger val = ( lua_UInteger )luaL_checkinteger( L, 1 ); unsigned total = lua_gettop( L ), i; @@ -140,6 +140,6 @@ const LUA_REG_TYPE bit_map[] = { { LNILKEY, LNILVAL} }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_bit (lua_State *L) { +LUALIB_API int luaopen_bit (lua_State *L) { LREGISTER( L, "bit", bit_map ); } diff --git a/app/modules/file.c b/app/modules/file.c index 760877d6..22782de3 100644 --- a/app/modules/file.c +++ b/app/modules/file.c @@ -14,7 +14,7 @@ static int file_fd = FS_OPEN_OK - 1; // Lua: open(filename, mode) -static int ICACHE_FLASH_ATTR file_open( lua_State* L ) +static int file_open( lua_State* L ) { size_t len; if((FS_OPEN_OK - 1)!=file_fd){ @@ -39,7 +39,7 @@ static int ICACHE_FLASH_ATTR file_open( lua_State* L ) } // Lua: close() -static int ICACHE_FLASH_ATTR file_close( lua_State* L ) +static int file_close( lua_State* L ) { if((FS_OPEN_OK - 1)!=file_fd){ fs_close(file_fd); @@ -50,7 +50,7 @@ static int ICACHE_FLASH_ATTR file_close( lua_State* L ) #if defined(BUILD_WOFS) // Lua: list() -static int ICACHE_FLASH_ATTR file_list( lua_State* L ) +static int file_list( lua_State* L ) { uint32_t start = 0; size_t act_len = 0; @@ -64,7 +64,7 @@ static int ICACHE_FLASH_ATTR file_list( lua_State* L ) } // Lua: format() -static int ICACHE_FLASH_ATTR file_format( lua_State* L ) +static int file_format( lua_State* L ) { size_t len; file_close(L); @@ -84,7 +84,7 @@ static int ICACHE_FLASH_ATTR file_format( lua_State* L ) extern spiffs fs; // Lua: list() -static int ICACHE_FLASH_ATTR file_list( lua_State* L ) +static int file_list( lua_State* L ) { spiffs_DIR d; struct spiffs_dirent e; @@ -101,7 +101,7 @@ static int ICACHE_FLASH_ATTR file_list( lua_State* L ) return 1; } -static int ICACHE_FLASH_ATTR file_seek (lua_State *L) +static int file_seek (lua_State *L) { static const int mode[] = {FS_SEEK_SET, FS_SEEK_CUR, FS_SEEK_END}; static const char *const modenames[] = {"set", "cur", "end", NULL}; @@ -118,7 +118,7 @@ static int ICACHE_FLASH_ATTR file_seek (lua_State *L) } // Lua: remove(filename) -static int ICACHE_FLASH_ATTR file_remove( lua_State* L ) +static int file_remove( lua_State* L ) { size_t len; const char *fname = luaL_checklstring( L, 1, &len ); @@ -130,7 +130,7 @@ static int ICACHE_FLASH_ATTR file_remove( lua_State* L ) } // Lua: flush() -static int ICACHE_FLASH_ATTR file_flush( lua_State* L ) +static int file_flush( lua_State* L ) { if((FS_OPEN_OK - 1)==file_fd) return luaL_error(L, "open a file first"); @@ -142,7 +142,7 @@ static int ICACHE_FLASH_ATTR file_flush( lua_State* L ) } #if 0 // Lua: check() -static int ICACHE_FLASH_ATTR file_check( lua_State* L ) +static int file_check( lua_State* L ) { file_close(L); lua_pushinteger(L, fs_check()); @@ -153,7 +153,7 @@ static int ICACHE_FLASH_ATTR file_check( lua_State* L ) #endif // g_read() -static int ICACHE_FLASH_ATTR file_g_read( lua_State* L, int n, int16_t end_char ) +static int file_g_read( lua_State* L, int n, int16_t end_char ) { if(n< 0 || n>LUAL_BUFFERSIZE) n = LUAL_BUFFERSIZE; @@ -197,7 +197,7 @@ static int ICACHE_FLASH_ATTR file_g_read( lua_State* L, int n, int16_t end_char // file.read() will read all byte in file // file.read(10) will read 10 byte from file, or EOF is reached. // file.read('q') will read until 'q' or EOF is reached. -static int ICACHE_FLASH_ATTR file_read( lua_State* L ) +static int file_read( lua_State* L ) { unsigned need_len = LUAL_BUFFERSIZE; int16_t end_char = EOF; @@ -222,13 +222,13 @@ static int ICACHE_FLASH_ATTR file_read( lua_State* L ) } // Lua: readline() -static int ICACHE_FLASH_ATTR file_readline( lua_State* L ) +static int file_readline( lua_State* L ) { return file_g_read(L, LUAL_BUFFERSIZE, '\n'); } // Lua: write("string") -static int ICACHE_FLASH_ATTR file_write( lua_State* L ) +static int file_write( lua_State* L ) { if((FS_OPEN_OK - 1)==file_fd) return luaL_error(L, "open a file first"); @@ -243,7 +243,7 @@ static int ICACHE_FLASH_ATTR file_write( lua_State* L ) } // Lua: writeline("string") -static int ICACHE_FLASH_ATTR file_writeline( lua_State* L ) +static int file_writeline( lua_State* L ) { if((FS_OPEN_OK - 1)==file_fd) return luaL_error(L, "open a file first"); @@ -290,7 +290,7 @@ const LUA_REG_TYPE file_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_file( lua_State *L ) +LUALIB_API int luaopen_file( lua_State *L ) { #if LUA_OPTIMIZE_MEMORY > 0 return 0; diff --git a/app/modules/gpio.c b/app/modules/gpio.c index e3fa319c..551dca8a 100644 --- a/app/modules/gpio.c +++ b/app/modules/gpio.c @@ -23,7 +23,7 @@ static int gpio_cb_ref[GPIO_PIN_NUM]; static lua_State* gL = NULL; -void ICACHE_FLASH_ATTR lua_gpio_unref(unsigned pin){ +void lua_gpio_unref(unsigned pin){ if(gpio_cb_ref[pin] != LUA_NOREF){ if(gL!=NULL) luaL_unref(gL, LUA_REGISTRYINDEX, gpio_cb_ref[pin]); @@ -31,7 +31,7 @@ void ICACHE_FLASH_ATTR lua_gpio_unref(unsigned pin){ gpio_cb_ref[pin] = LUA_NOREF; } -void ICACHE_FLASH_ATTR gpio_intr_callback( unsigned pin, unsigned level ) +void gpio_intr_callback( unsigned pin, unsigned level ) { NODE_DBG("pin:%d, level:%d \n", pin, level); if(gpio_cb_ref[pin] == LUA_NOREF) @@ -44,7 +44,7 @@ void ICACHE_FLASH_ATTR gpio_intr_callback( unsigned pin, unsigned level ) } // Lua: trig( pin, type, function ) -static int ICACHE_FLASH_ATTR lgpio_trig( lua_State* L ) +static int lgpio_trig( lua_State* L ) { unsigned type; unsigned pin; @@ -87,7 +87,7 @@ static int ICACHE_FLASH_ATTR lgpio_trig( lua_State* L ) #endif // Lua: mode( pin, mode, pullup ) -static int ICACHE_FLASH_ATTR lgpio_mode( lua_State* L ) +static int lgpio_mode( lua_State* L ) { unsigned mode, pullup = FLOAT; unsigned pin; @@ -119,7 +119,7 @@ static int ICACHE_FLASH_ATTR lgpio_mode( lua_State* L ) } // Lua: read( pin ) -static int ICACHE_FLASH_ATTR lgpio_read( lua_State* L ) +static int lgpio_read( lua_State* L ) { unsigned pin; @@ -132,7 +132,7 @@ static int ICACHE_FLASH_ATTR lgpio_read( lua_State* L ) } // Lua: write( pin, level ) -static int ICACHE_FLASH_ATTR lgpio_write( lua_State* L ) +static int lgpio_write( lua_State* L ) { unsigned level; unsigned pin; @@ -171,7 +171,7 @@ const LUA_REG_TYPE gpio_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_gpio( lua_State *L ) +LUALIB_API int luaopen_gpio( lua_State *L ) { #ifdef GPIO_INTERRUPT_ENABLE int i; diff --git a/app/modules/i2c.c b/app/modules/i2c.c index ae8f1fbc..c231aeec 100644 --- a/app/modules/i2c.c +++ b/app/modules/i2c.c @@ -8,7 +8,7 @@ #include "lrotable.h" // Lua: speed = i2c.setup( id, sda, scl, speed ) -static int ICACHE_FLASH_ATTR i2c_setup( lua_State *L ) +static int i2c_setup( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); unsigned sda = luaL_checkinteger( L, 2 ); @@ -29,7 +29,7 @@ static int ICACHE_FLASH_ATTR i2c_setup( lua_State *L ) } // Lua: i2c.start( id ) -static int ICACHE_FLASH_ATTR i2c_start( lua_State *L ) +static int i2c_start( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); @@ -39,7 +39,7 @@ static int ICACHE_FLASH_ATTR i2c_start( lua_State *L ) } // Lua: i2c.stop( id ) -static int ICACHE_FLASH_ATTR i2c_stop( lua_State *L ) +static int i2c_stop( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); @@ -49,7 +49,7 @@ static int ICACHE_FLASH_ATTR i2c_stop( lua_State *L ) } // Lua: status = i2c.address( id, address, direction ) -static int ICACHE_FLASH_ATTR i2c_address( lua_State *L ) +static int i2c_address( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); int address = luaL_checkinteger( L, 2 ); @@ -64,7 +64,7 @@ static int ICACHE_FLASH_ATTR i2c_address( lua_State *L ) // Lua: wrote = i2c.write( id, data1, [data2], ..., [datan] ) // data can be either a string, a table or an 8-bit number -static int ICACHE_FLASH_ATTR i2c_write( lua_State *L ) +static int i2c_write( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); const char *pdata; @@ -122,7 +122,7 @@ static int ICACHE_FLASH_ATTR i2c_write( lua_State *L ) } // Lua: read = i2c.read( id, size ) -static int ICACHE_FLASH_ATTR i2c_read( lua_State *L ) +static int i2c_read( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); u32 size = ( u32 )luaL_checkinteger( L, 2 ), i; @@ -162,7 +162,7 @@ const LUA_REG_TYPE i2c_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_i2c( lua_State *L ) +LUALIB_API int luaopen_i2c( lua_State *L ) { #if LUA_OPTIMIZE_MEMORY > 0 return 0; diff --git a/app/modules/net.c b/app/modules/net.c index 125b2f62..dba4fc7e 100644 --- a/app/modules/net.c +++ b/app/modules/net.c @@ -55,8 +55,7 @@ typedef struct lnet_userdata #endif }lnet_userdata; -static void ICACHE_FLASH_ATTR -net_server_disconnected(void *arg) // for tcp server only +static void net_server_disconnected(void *arg) // for tcp server only { NODE_DBG("net_server_disconnected is called.\n"); struct espconn *pesp_conn = arg; @@ -99,8 +98,7 @@ net_server_disconnected(void *arg) // for tcp server only lua_gc(gL, LUA_GCRESTART, 0); } -static void ICACHE_FLASH_ATTR -net_socket_disconnected(void *arg) // tcp only +static void net_socket_disconnected(void *arg) // tcp only { NODE_DBG("net_socket_disconnected is called.\n"); struct espconn *pesp_conn = arg; @@ -130,22 +128,19 @@ net_socket_disconnected(void *arg) // tcp only lua_gc(gL, LUA_GCRESTART, 0); } -static void ICACHE_FLASH_ATTR -net_server_reconnected(void *arg, sint8_t err) +static void net_server_reconnected(void *arg, sint8_t err) { NODE_DBG("net_server_reconnected is called.\n"); net_server_disconnected(arg); } -static void ICACHE_FLASH_ATTR -net_socket_reconnected(void *arg, sint8_t err) +static void net_socket_reconnected(void *arg, sint8_t err) { NODE_DBG("net_socket_reconnected is called.\n"); net_socket_disconnected(arg); } -static void ICACHE_FLASH_ATTR -net_socket_received(void *arg, char *pdata, unsigned short len) +static void net_socket_received(void *arg, char *pdata, unsigned short len) { NODE_DBG("net_socket_received is called.\n"); struct espconn *pesp_conn = arg; @@ -169,8 +164,7 @@ net_socket_received(void *arg, char *pdata, unsigned short len) lua_call(gL, 2, 0); } -static void ICACHE_FLASH_ATTR -net_socket_sent(void *arg) +static void net_socket_sent(void *arg) { // NODE_DBG("net_socket_sent is called.\n"); struct espconn *pesp_conn = arg; @@ -188,8 +182,7 @@ net_socket_sent(void *arg) lua_call(gL, 1, 0); } -static void ICACHE_FLASH_ATTR -net_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) +static void net_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) { NODE_DBG("net_dns_found is called.\n"); struct espconn *pesp_conn = arg; @@ -242,8 +235,7 @@ net_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) } } -static void ICACHE_FLASH_ATTR -net_server_connected(void *arg) // for tcp only +static void net_server_connected(void *arg) // for tcp only { NODE_DBG("net_server_connected is called.\n"); struct espconn *pesp_conn = arg; @@ -324,8 +316,7 @@ net_server_connected(void *arg) // for tcp only lua_call(gL, 1, 0); // function(conn) } -static void ICACHE_FLASH_ATTR -net_socket_connected(void *arg) +static void net_socket_connected(void *arg) { NODE_DBG("net_socket_connected is called.\n"); struct espconn *pesp_conn = arg; @@ -349,8 +340,7 @@ net_socket_connected(void *arg) } // Lua: s = net.create(type, secure/timeout, function(conn)) -static int ICACHE_FLASH_ATTR -net_create( lua_State* L, const char* mt ) +static int net_create( lua_State* L, const char* mt ) { NODE_DBG("net_create is called.\n"); struct espconn *pesp_conn = NULL; @@ -496,8 +486,7 @@ net_create( lua_State* L, const char* mt ) // call close() first // server: disconnect server, unref everything // socket: unref everything -static int ICACHE_FLASH_ATTR -net_delete( lua_State* L, const char* mt ) +static int net_delete( lua_State* L, const char* mt ) { NODE_DBG("net_delete is called.\n"); bool isserver = false; @@ -571,7 +560,7 @@ net_delete( lua_State* L, const char* mt ) return 0; } -static void ICACHE_FLASH_ATTR socket_connect(struct espconn *pesp_conn) +static void socket_connect(struct espconn *pesp_conn) { if(pesp_conn == NULL) return; @@ -600,8 +589,7 @@ static void ICACHE_FLASH_ATTR socket_connect(struct espconn *pesp_conn) static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg); static dns_reconn_count = 0; -static void ICACHE_FLASH_ATTR -socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) +static void socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) { NODE_DBG("socket_dns_found is called.\n"); struct espconn *pesp_conn = arg; @@ -647,8 +635,7 @@ socket_dns_found(const char *name, ip_addr_t *ipaddr, void *arg) // Lua: server:listen( port, ip, function(con) ) // Lua: socket:connect( port, ip, function(con) ) -static int ICACHE_FLASH_ATTR -net_start( lua_State* L, const char* mt ) +static int net_start( lua_State* L, const char* mt ) { NODE_DBG("net_start is called.\n"); struct espconn *pesp_conn = NULL; @@ -819,8 +806,7 @@ net_start( lua_State* L, const char* mt ) // Lua: server/socket:close() // server disconnect everything, unref everything // client disconnect and unref itself -static int ICACHE_FLASH_ATTR -net_close( lua_State* L, const char* mt ) +static int net_close( lua_State* L, const char* mt ) { NODE_DBG("net_close is called.\n"); bool isserver = false; @@ -929,8 +915,7 @@ net_close( lua_State* L, const char* mt ) } // Lua: socket/udpserver:on( "method", function(s) ) -static int ICACHE_FLASH_ATTR -net_on( lua_State* L, const char* mt ) +static int net_on( lua_State* L, const char* mt ) { NODE_DBG("net_on is called.\n"); bool isserver = false; @@ -994,8 +979,7 @@ net_on( lua_State* L, const char* mt ) } // Lua: server/socket:send( string, function(sent) ) -static int ICACHE_FLASH_ATTR -net_send( lua_State* L, const char* mt ) +static int net_send( lua_State* L, const char* mt ) { // NODE_DBG("net_send is called.\n"); bool isserver = false; @@ -1061,8 +1045,7 @@ net_send( lua_State* L, const char* mt ) } // Lua: socket:dns( string, function(socket, ip) ) -static int ICACHE_FLASH_ATTR -net_dns( lua_State* L, const char* mt ) +static int net_dns( lua_State* L, const char* mt ) { NODE_DBG("net_dns is called.\n"); bool isserver = false; @@ -1115,111 +1098,98 @@ net_dns( lua_State* L, const char* mt ) // Lua: s = net.createServer(type, function(server)) -static int ICACHE_FLASH_ATTR net_createServer( lua_State* L ) +static int net_createServer( lua_State* L ) { const char *mt = "net.server"; return net_create(L, mt); } // Lua: server:delete() -static int ICACHE_FLASH_ATTR -net_server_delete( lua_State* L ) +static int net_server_delete( lua_State* L ) { const char *mt = "net.server"; return net_delete(L, mt); } // Lua: server:listen( port, ip ) -static int ICACHE_FLASH_ATTR -net_server_listen( lua_State* L ) +static int net_server_listen( lua_State* L ) { const char *mt = "net.server"; return net_start(L, mt); } // Lua: server:close() -static int ICACHE_FLASH_ATTR -net_server_close( lua_State* L ) +static int net_server_close( lua_State* L ) { const char *mt = "net.server"; return net_close(L, mt); } // Lua: udpserver:on( "method", function(udpserver) ) -static int ICACHE_FLASH_ATTR -net_udpserver_on( lua_State* L ) +static int net_udpserver_on( lua_State* L ) { const char *mt = "net.server"; return net_on(L, mt); } // Lua: udpserver:send(string, function() ) -static int ICACHE_FLASH_ATTR -net_udpserver_send( lua_State* L ) +static int net_udpserver_send( lua_State* L ) { const char *mt = "net.server"; return net_send(L, mt);; } // Lua: s = net.createConnection(type, function(conn)) -static int ICACHE_FLASH_ATTR -net_createConnection( lua_State* L ) +static int net_createConnection( lua_State* L ) { const char *mt = "net.socket"; return net_create(L, mt); } // Lua: socket:delete() -static int ICACHE_FLASH_ATTR -net_socket_delete( lua_State* L ) +static int net_socket_delete( lua_State* L ) { const char *mt = "net.socket"; return net_delete(L, mt); } // Lua: socket:connect( port, ip ) -static int ICACHE_FLASH_ATTR -net_socket_connect( lua_State* L ) +static int net_socket_connect( lua_State* L ) { const char *mt = "net.socket"; return net_start(L, mt); } // Lua: socket:close() -static int ICACHE_FLASH_ATTR -net_socket_close( lua_State* L ) +static int net_socket_close( lua_State* L ) { const char *mt = "net.socket"; return net_close(L, mt); } // Lua: socket:on( "method", function(socket) ) -static int ICACHE_FLASH_ATTR -net_socket_on( lua_State* L ) +static int net_socket_on( lua_State* L ) { const char *mt = "net.socket"; return net_on(L, mt); } // Lua: socket:send( string, function() ) -static int ICACHE_FLASH_ATTR -net_socket_send( lua_State* L ) +static int net_socket_send( lua_State* L ) { const char *mt = "net.socket"; return net_send(L, mt); } // Lua: socket:dns( string, function(ip) ) -static int ICACHE_FLASH_ATTR -net_socket_dns( lua_State* L ) +static int net_socket_dns( lua_State* L ) { const char *mt = "net.socket"; return net_dns(L, mt); } #if 0 -static int ICACHE_FLASH_ATTR -net_array_index( lua_State* L ) +static int net_array_index( lua_State* L ) { char** parray = luaL_checkudata(L, 1, "net.array"); int index = luaL_checkint(L, 2); @@ -1227,8 +1197,7 @@ net_array_index( lua_State* L ) return 1; } -static int ICACHE_FLASH_ATTR -net_array_newindex( lua_State* L ) +static int net_array_newindex( lua_State* L ) { char** parray = luaL_checkudata(L, 1, "net.array"); int index = luaL_checkint(L, 2); @@ -1238,8 +1207,7 @@ net_array_newindex( lua_State* L ) } // expose an array to lua, by storing it in a userdata with the array metatable -static int ICACHE_FLASH_ATTR -expose_array(lua_State* L, char *array, unsigned short len) { +static int expose_array(lua_State* L, char *array, unsigned short len) { char** parray = lua_newuserdata(L, len); *parray = array; luaL_getmetatable(L, "net.array"); @@ -1300,7 +1268,7 @@ const LUA_REG_TYPE net_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_net( lua_State *L ) +LUALIB_API int luaopen_net( lua_State *L ) { int i; for(i=0;i=TX_BUFF_SIZE){ // NODE_ERR("output too long.\n"); // return; @@ -242,7 +242,7 @@ void ICACHE_FLASH_ATTR output_redirect(const char *str){ } // Lua: output(function(c), debug) -static int ICACHE_FLASH_ATTR node_output( lua_State* L ) +static int node_output( lua_State* L ) { gL = L; // luaL_checkanyfunction(L, 1); @@ -293,7 +293,7 @@ const LUA_REG_TYPE node_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_node( lua_State *L ) +LUALIB_API int luaopen_node( lua_State *L ) { #if LUA_OPTIMIZE_MEMORY > 0 return 0; diff --git a/app/modules/ow.c b/app/modules/ow.c index 6a399752..c9cbfa1a 100644 --- a/app/modules/ow.c +++ b/app/modules/ow.c @@ -8,7 +8,7 @@ #include "driver/onewire.h" // Lua: ow.setup( id ) -static int ICACHE_FLASH_ATTR ow_setup( lua_State *L ) +static int ow_setup( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); @@ -22,7 +22,7 @@ static int ICACHE_FLASH_ATTR ow_setup( lua_State *L ) } // Lua: r = ow.reset( id ) -static int ICACHE_FLASH_ATTR ow_reset( lua_State *L ) +static int ow_reset( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( ow, id ); @@ -31,7 +31,7 @@ static int ICACHE_FLASH_ATTR ow_reset( lua_State *L ) } // Lua: ow.skip( id ) -static int ICACHE_FLASH_ATTR ow_skip( lua_State *L ) +static int ow_skip( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( ow, id ); @@ -40,7 +40,7 @@ static int ICACHE_FLASH_ATTR ow_skip( lua_State *L ) } // Lua: ow.select( id, buf[8]) -static int ICACHE_FLASH_ATTR ow_select( lua_State *L ) +static int ow_select( lua_State *L ) { uint8_t rom[8]; size_t datalen; @@ -79,7 +79,7 @@ static int ICACHE_FLASH_ATTR ow_select( lua_State *L ) } // Lua: ow.write( id, v, power) -static int ICACHE_FLASH_ATTR ow_write( lua_State *L ) +static int ow_write( lua_State *L ) { int power = 0; unsigned id = luaL_checkinteger( L, 1 ); @@ -99,7 +99,7 @@ static int ICACHE_FLASH_ATTR ow_write( lua_State *L ) } // Lua: ow.write_bytes( id, buf, power) -static int ICACHE_FLASH_ATTR ow_write_bytes( lua_State *L ) +static int ow_write_bytes( lua_State *L ) { int power = 0; size_t datalen; @@ -119,7 +119,7 @@ static int ICACHE_FLASH_ATTR ow_write_bytes( lua_State *L ) } // Lua: r = ow.read( id ) -static int ICACHE_FLASH_ATTR ow_read( lua_State *L ) +static int ow_read( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( ow, id ); @@ -128,7 +128,7 @@ static int ICACHE_FLASH_ATTR ow_read( lua_State *L ) } // Lua: r = ow.read_bytes( id, size ) -static int ICACHE_FLASH_ATTR ow_read_bytes( lua_State *L ) +static int ow_read_bytes( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( ow, id ); @@ -148,7 +148,7 @@ static int ICACHE_FLASH_ATTR ow_read_bytes( lua_State *L ) } // Lua: ow.depower( id ) -static int ICACHE_FLASH_ATTR ow_depower( lua_State *L ) +static int ow_depower( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( ow, id ); @@ -159,7 +159,7 @@ static int ICACHE_FLASH_ATTR ow_depower( lua_State *L ) #if ONEWIRE_SEARCH // Clear the search state so that if will start from the beginning again. // Lua: ow.reset_search( id ) -static int ICACHE_FLASH_ATTR ow_reset_search( lua_State *L ) +static int ow_reset_search( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( ow, id ); @@ -171,7 +171,7 @@ static int ICACHE_FLASH_ATTR ow_reset_search( lua_State *L ) // Setup the search to find the device type 'family_code' on the next call // to search(*newAddr) if it is present. // Lua: ow.target_search( id, family_code) -static int ICACHE_FLASH_ATTR ow_target_search( lua_State *L ) +static int ow_target_search( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( ow, id ); @@ -193,7 +193,7 @@ static int ICACHE_FLASH_ATTR ow_target_search( lua_State *L ) // the same devices in the same order. // Lua: r = ow.search( id ) -static int ICACHE_FLASH_ATTR ow_search( lua_State *L ) +static int ow_search( lua_State *L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( ow, id ); @@ -217,7 +217,7 @@ static int ICACHE_FLASH_ATTR ow_search( lua_State *L ) #if ONEWIRE_CRC // uint8_t onewire_crc8(const uint8_t *addr, uint8_t len); // Lua: r = ow.crc8( buf ) -static int ICACHE_FLASH_ATTR ow_crc8( lua_State *L ) +static int ow_crc8( lua_State *L ) { size_t datalen; const uint8_t *pdata = luaL_checklstring( L, 1, &datalen ); @@ -230,7 +230,7 @@ static int ICACHE_FLASH_ATTR ow_crc8( lua_State *L ) #if ONEWIRE_CRC16 // bool onewire_check_crc16(const uint8_t* input, uint16_t len, const uint8_t* inverted_crc, uint16_t crc); // Lua: b = ow.check_crc16( buf, inverted_crc0, inverted_crc1, crc ) -static int ICACHE_FLASH_ATTR ow_check_crc16( lua_State *L ) +static int ow_check_crc16( lua_State *L ) { size_t datalen; uint8_t inverted_crc[2]; @@ -262,7 +262,7 @@ static int ICACHE_FLASH_ATTR ow_check_crc16( lua_State *L ) // uint16_t onewire_crc16(const uint8_t* input, uint16_t len, uint16_t crc); // Lua: r = ow.crc16( buf, crc ) -static int ICACHE_FLASH_ATTR ow_crc16( lua_State *L ) +static int ow_crc16( lua_State *L ) { size_t datalen; const uint8_t *pdata = luaL_checklstring( L, 1, &datalen ); @@ -313,7 +313,7 @@ const LUA_REG_TYPE ow_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_ow( lua_State *L ) +LUALIB_API int luaopen_ow( lua_State *L ) { #if LUA_OPTIMIZE_MEMORY > 0 return 0; diff --git a/app/modules/pwm.c b/app/modules/pwm.c index ead3f064..fbf29fe4 100644 --- a/app/modules/pwm.c +++ b/app/modules/pwm.c @@ -10,7 +10,7 @@ #include "c_types.h" // Lua: realfrequency = setup( id, frequency, duty ) -static int ICACHE_FLASH_ATTR lpwm_setup( lua_State* L ) +static int lpwm_setup( lua_State* L ) { s32 freq; // signed, to error check for negative values unsigned duty; @@ -35,7 +35,7 @@ static int ICACHE_FLASH_ATTR lpwm_setup( lua_State* L ) } // Lua: close( id ) -static int ICACHE_FLASH_ATTR lpwm_close( lua_State* L ) +static int lpwm_close( lua_State* L ) { unsigned id; @@ -46,7 +46,7 @@ static int ICACHE_FLASH_ATTR lpwm_close( lua_State* L ) } // Lua: start( id ) -static int ICACHE_FLASH_ATTR lpwm_start( lua_State* L ) +static int lpwm_start( lua_State* L ) { unsigned id; id = luaL_checkinteger( L, 1 ); @@ -56,7 +56,7 @@ static int ICACHE_FLASH_ATTR lpwm_start( lua_State* L ) } // Lua: stop( id ) -static int ICACHE_FLASH_ATTR lpwm_stop( lua_State* L ) +static int lpwm_stop( lua_State* L ) { unsigned id; @@ -67,7 +67,7 @@ static int ICACHE_FLASH_ATTR lpwm_stop( lua_State* L ) } // Lua: realclock = setclock( id, clock ) -static int ICACHE_FLASH_ATTR lpwm_setclock( lua_State* L ) +static int lpwm_setclock( lua_State* L ) { unsigned id; s32 clk; // signed to error-check for negative values @@ -83,7 +83,7 @@ static int ICACHE_FLASH_ATTR lpwm_setclock( lua_State* L ) } // Lua: clock = getclock( id ) -static int ICACHE_FLASH_ATTR lpwm_getclock( lua_State* L ) +static int lpwm_getclock( lua_State* L ) { unsigned id; u32 clk; @@ -96,7 +96,7 @@ static int ICACHE_FLASH_ATTR lpwm_getclock( lua_State* L ) } // Lua: realduty = setduty( id, duty ) -static int ICACHE_FLASH_ATTR lpwm_setduty( lua_State* L ) +static int lpwm_setduty( lua_State* L ) { unsigned id; s32 duty; // signed to error-check for negative values @@ -112,7 +112,7 @@ static int ICACHE_FLASH_ATTR lpwm_setduty( lua_State* L ) } // Lua: duty = getduty( id ) -static int ICACHE_FLASH_ATTR lpwm_getduty( lua_State* L ) +static int lpwm_getduty( lua_State* L ) { unsigned id; u32 duty; @@ -143,7 +143,7 @@ const LUA_REG_TYPE pwm_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_pwm( lua_State *L ) +LUALIB_API int luaopen_pwm( lua_State *L ) { #if LUA_OPTIMIZE_MEMORY > 0 return 0; diff --git a/app/modules/tmr.c b/app/modules/tmr.c index 83f54ff8..7d67d6be 100644 --- a/app/modules/tmr.c +++ b/app/modules/tmr.c @@ -12,57 +12,50 @@ static os_timer_t alarm_timer[NUM_TMR]; static int alarm_timer_cb_ref[NUM_TMR] = {LUA_NOREF,LUA_NOREF,LUA_NOREF,LUA_NOREF,LUA_NOREF,LUA_NOREF,LUA_NOREF}; -void ICACHE_FLASH_ATTR alarm_timer_common(lua_State* L, unsigned id){ +void alarm_timer_common(lua_State* L, unsigned id){ if(alarm_timer_cb_ref[id] == LUA_NOREF) return; lua_rawgeti(L, LUA_REGISTRYINDEX, alarm_timer_cb_ref[id]); lua_call(L, 0, 0); } -void ICACHE_FLASH_ATTR -alarm_timer_cb0(void *arg){ +void alarm_timer_cb0(void *arg){ if( !arg ) return; alarm_timer_common((lua_State*)arg, 0); } -void ICACHE_FLASH_ATTR -alarm_timer_cb1(void *arg){ +void alarm_timer_cb1(void *arg){ if( !arg ) return; alarm_timer_common((lua_State*)arg, 1); } -void ICACHE_FLASH_ATTR -alarm_timer_cb2(void *arg){ +void alarm_timer_cb2(void *arg){ if( !arg ) return; alarm_timer_common((lua_State*)arg, 2); } -void ICACHE_FLASH_ATTR -alarm_timer_cb3(void *arg){ +void alarm_timer_cb3(void *arg){ if( !arg ) return; alarm_timer_common((lua_State*)arg, 3); } -void ICACHE_FLASH_ATTR -alarm_timer_cb4(void *arg){ +void alarm_timer_cb4(void *arg){ if( !arg ) return; alarm_timer_common((lua_State*)arg, 4); } -void ICACHE_FLASH_ATTR -alarm_timer_cb5(void *arg){ +void alarm_timer_cb5(void *arg){ if( !arg ) return; alarm_timer_common((lua_State*)arg, 5); } -void ICACHE_FLASH_ATTR -alarm_timer_cb6(void *arg){ +void alarm_timer_cb6(void *arg){ if( !arg ) return; alarm_timer_common((lua_State*)arg, 6); @@ -72,7 +65,7 @@ typedef void (*alarm_timer_callback)(void *arg); static alarm_timer_callback alarm_timer_cb[NUM_TMR] = {alarm_timer_cb0,alarm_timer_cb1,alarm_timer_cb2,alarm_timer_cb3,alarm_timer_cb4,alarm_timer_cb5,alarm_timer_cb6}; // Lua: delay( us ) -static int ICACHE_FLASH_ATTR tmr_delay( lua_State* L ) +static int tmr_delay( lua_State* L ) { s32 us; us = luaL_checkinteger( L, 1 ); @@ -91,7 +84,7 @@ static int ICACHE_FLASH_ATTR tmr_delay( lua_State* L ) } // Lua: now() , return system timer in us -static int ICACHE_FLASH_ATTR tmr_now( lua_State* L ) +static int tmr_now( lua_State* L ) { unsigned now = 0x7FFFFFFF & system_get_time(); lua_pushinteger( L, now ); @@ -99,7 +92,7 @@ static int ICACHE_FLASH_ATTR tmr_now( lua_State* L ) } // Lua: alarm( id, interval, repeat, function ) -static int ICACHE_FLASH_ATTR tmr_alarm( lua_State* L ) +static int tmr_alarm( lua_State* L ) { s32 interval; unsigned repeat = 0; @@ -136,7 +129,7 @@ static int ICACHE_FLASH_ATTR tmr_alarm( lua_State* L ) } // Lua: stop( id ) -static int ICACHE_FLASH_ATTR tmr_stop( lua_State* L ) +static int tmr_stop( lua_State* L ) { unsigned id = luaL_checkinteger( L, 1 ); MOD_CHECK_ID( tmr, id ); @@ -147,7 +140,7 @@ static int ICACHE_FLASH_ATTR tmr_stop( lua_State* L ) // extern void update_key_led(); // Lua: wdclr() -static int ICACHE_FLASH_ATTR tmr_wdclr( lua_State* L ) +static int tmr_wdclr( lua_State* L ) { WRITE_PERI_REG(0x60000914, 0x73); // update_key_led(); @@ -155,7 +148,7 @@ static int ICACHE_FLASH_ATTR tmr_wdclr( lua_State* L ) } // Lua: time() , return rtc time in us -static int ICACHE_FLASH_ATTR tmr_time( lua_State* L ) +static int tmr_time( lua_State* L ) { unsigned t = 0xFFFFFFFF & system_get_rtc_time(); unsigned c = 0xFFFFFFFF & system_rtc_clock_cali_proc(); @@ -181,7 +174,7 @@ const LUA_REG_TYPE tmr_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_tmr( lua_State *L ) +LUALIB_API int luaopen_tmr( lua_State *L ) { int i = 0; for(i=0;i 0 return 0; diff --git a/app/modules/wifi.c b/app/modules/wifi.c index 30e266f7..74c24930 100644 --- a/app/modules/wifi.c +++ b/app/modules/wifi.c @@ -15,7 +15,7 @@ static int wifi_smart_succeed = LUA_NOREF; -static void ICACHE_FLASH_ATTR wifi_smart_succeed_cb(void *arg){ +static void wifi_smart_succeed_cb(void *arg){ NODE_DBG("wifi_smart_succeed_cb is called.\n"); if( !arg ) return; @@ -34,8 +34,7 @@ static lua_State* gL = NULL; * @param status: scan over status * @retval None */ -static void ICACHE_FLASH_ATTR -wifi_scan_done(void *arg, STATUS status) +static void wifi_scan_done(void *arg, STATUS status) { uint8 ssid[33]; char temp[128]; @@ -82,7 +81,7 @@ wifi_scan_done(void *arg, STATUS status) } // Lua: smart(channel, function succeed_cb) -static int ICACHE_FLASH_ATTR wifi_start_smart( lua_State* L ) +static int wifi_start_smart( lua_State* L ) { unsigned channel; int stack = 1; @@ -114,7 +113,7 @@ static int ICACHE_FLASH_ATTR wifi_start_smart( lua_State* L ) } // Lua: exit_smart(channel) -static int ICACHE_FLASH_ATTR wifi_exit_smart( lua_State* L ) +static int wifi_exit_smart( lua_State* L ) { smart_end(); if(wifi_smart_succeed != LUA_NOREF) @@ -124,7 +123,7 @@ static int ICACHE_FLASH_ATTR wifi_exit_smart( lua_State* L ) } // Lua: realmode = setmode(mode) -static int ICACHE_FLASH_ATTR wifi_setmode( lua_State* L ) +static int wifi_setmode( lua_State* L ) { unsigned mode; @@ -139,7 +138,7 @@ static int ICACHE_FLASH_ATTR wifi_setmode( lua_State* L ) } // Lua: realmode = getmode() -static int ICACHE_FLASH_ATTR wifi_getmode( lua_State* L ) +static int wifi_getmode( lua_State* L ) { unsigned mode; mode = (unsigned)wifi_get_opmode(); @@ -149,7 +148,7 @@ static int ICACHE_FLASH_ATTR wifi_getmode( lua_State* L ) // Lua: mac = wifi.xx.getmac() -static int ICACHE_FLASH_ATTR wifi_getmac( lua_State* L, uint8_t mode ) +static int wifi_getmac( lua_State* L, uint8_t mode ) { char temp[64]; uint8_t mac[6]; @@ -160,7 +159,7 @@ static int ICACHE_FLASH_ATTR wifi_getmac( lua_State* L, uint8_t mode ) } // Lua: mac = wifi.xx.setmac() -static int ICACHE_FLASH_ATTR wifi_setmac( lua_State* L, uint8_t mode ) +static int wifi_setmac( lua_State* L, uint8_t mode ) { unsigned len = 0; const char *mac = luaL_checklstring( L, 1, &len ); @@ -172,7 +171,7 @@ static int ICACHE_FLASH_ATTR wifi_setmac( lua_State* L, uint8_t mode ) } // Lua: ip = wifi.xx.getip() -static int ICACHE_FLASH_ATTR wifi_getip( lua_State* L, uint8_t mode ) +static int wifi_getip( lua_State* L, uint8_t mode ) { struct ip_info pTempIp; char temp[64]; @@ -204,7 +203,7 @@ static uint32_t parse_key(lua_State* L, const char * key){ } // Lua: ip = wifi.xx.setip() -static int ICACHE_FLASH_ATTR wifi_setip( lua_State* L, uint8_t mode ) +static int wifi_setip( lua_State* L, uint8_t mode ) { struct ip_info pTempIp; wifi_get_ip_info(mode, &pTempIp); @@ -228,7 +227,7 @@ static int ICACHE_FLASH_ATTR wifi_setip( lua_State* L, uint8_t mode ) } // Lua: realtype = sleeptype(type) -static int ICACHE_FLASH_ATTR wifi_sleeptype( lua_State* L ) +static int wifi_sleeptype( lua_State* L ) { unsigned type; @@ -248,27 +247,27 @@ static int ICACHE_FLASH_ATTR wifi_sleeptype( lua_State* L ) } // Lua: wifi.sta.getmac() -static int ICACHE_FLASH_ATTR wifi_station_getmac( lua_State* L ){ +static int wifi_station_getmac( lua_State* L ){ return wifi_getmac(L, STATION_IF); } // Lua: wifi.sta.setmac() -static int ICACHE_FLASH_ATTR wifi_station_setmac( lua_State* L ){ +static int wifi_station_setmac( lua_State* L ){ return wifi_setmac(L, STATION_IF); } // Lua: wifi.sta.getip() -static int ICACHE_FLASH_ATTR wifi_station_getip( lua_State* L ){ +static int wifi_station_getip( lua_State* L ){ return wifi_getip(L, STATION_IF); } // Lua: wifi.sta.setip() -static int ICACHE_FLASH_ATTR wifi_station_setip( lua_State* L ){ +static int wifi_station_setip( lua_State* L ){ return wifi_setip(L, STATION_IF); } // Lua: wifi.sta.config(ssid, password) -static int ICACHE_FLASH_ATTR wifi_station_config( lua_State* L ) +static int wifi_station_config( lua_State* L ) { size_t sl, pl; struct station_config sta_conf; @@ -301,21 +300,21 @@ static int ICACHE_FLASH_ATTR wifi_station_config( lua_State* L ) } // Lua: wifi.sta.connect() -static int ICACHE_FLASH_ATTR wifi_station_connect4lua( lua_State* L ) +static int wifi_station_connect4lua( lua_State* L ) { wifi_station_connect(); return 0; } // Lua: wifi.sta.disconnect() -static int ICACHE_FLASH_ATTR wifi_station_disconnect4lua( lua_State* L ) +static int wifi_station_disconnect4lua( lua_State* L ) { wifi_station_disconnect(); return 0; } // Lua: wifi.sta.auto(true/false) -static int ICACHE_FLASH_ATTR wifi_station_setauto( lua_State* L ) +static int wifi_station_setauto( lua_State* L ) { unsigned a; @@ -330,7 +329,7 @@ static int ICACHE_FLASH_ATTR wifi_station_setauto( lua_State* L ) return 0; } -static int ICACHE_FLASH_ATTR wifi_station_listap( lua_State* L ) +static int wifi_station_listap( lua_State* L ) { if(wifi_get_opmode() == SOFTAP_MODE) { @@ -352,7 +351,7 @@ static int ICACHE_FLASH_ATTR wifi_station_listap( lua_State* L ) } // Lua: wifi.sta.status() -static int ICACHE_FLASH_ATTR wifi_station_status( lua_State* L ) +static int wifi_station_status( lua_State* L ) { uint8_t status = wifi_station_get_connect_status(); lua_pushinteger( L, status ); @@ -360,27 +359,27 @@ static int ICACHE_FLASH_ATTR wifi_station_status( lua_State* L ) } // Lua: wifi.ap.getmac() -static int ICACHE_FLASH_ATTR wifi_ap_getmac( lua_State* L ){ +static int wifi_ap_getmac( lua_State* L ){ return wifi_getmac(L, SOFTAP_IF); } // Lua: wifi.ap.setmac() -static int ICACHE_FLASH_ATTR wifi_ap_setmac( lua_State* L ){ +static int wifi_ap_setmac( lua_State* L ){ return wifi_setmac(L, SOFTAP_IF); } // Lua: wifi.ap.getip() -static int ICACHE_FLASH_ATTR wifi_ap_getip( lua_State* L ){ +static int wifi_ap_getip( lua_State* L ){ return wifi_getip(L, SOFTAP_IF); } // Lua: wifi.ap.setip() -static int ICACHE_FLASH_ATTR wifi_ap_setip( lua_State* L ){ +static int wifi_ap_setip( lua_State* L ){ return wifi_setip(L, SOFTAP_IF); } // Lua: wifi.ap.config(table) -static int ICACHE_FLASH_ATTR wifi_ap_config( lua_State* L ) +static int wifi_ap_config( lua_State* L ) { struct softap_config config; size_t len; @@ -495,7 +494,7 @@ const LUA_REG_TYPE wifi_map[] = { LNILKEY, LNILVAL } }; -LUALIB_API int ICACHE_FLASH_ATTR luaopen_wifi( lua_State *L ) +LUALIB_API int luaopen_wifi( lua_State *L ) { #if LUA_OPTIMIZE_MEMORY > 0 return 0; diff --git a/app/platform/common.c b/app/platform/common.c index ae6a4e9f..fed7b89b 100644 --- a/app/platform/common.c +++ b/app/platform/common.c @@ -5,7 +5,7 @@ #include "c_string.h" #include "c_stdio.h" -void ICACHE_FLASH_ATTR cmn_platform_init(void) +void cmn_platform_init(void) { } @@ -13,7 +13,7 @@ void ICACHE_FLASH_ATTR cmn_platform_init(void) // **************************************************************************** // GPIO functions -int ICACHE_FLASH_ATTR platform_gpio_exists( unsigned pin ) +int platform_gpio_exists( unsigned pin ) { return pin < NUM_GPIO; } @@ -21,7 +21,7 @@ int ICACHE_FLASH_ATTR platform_gpio_exists( unsigned pin ) // **************************************************************************** // CAN functions -int ICACHE_FLASH_ATTR platform_can_exists( unsigned id ) +int platform_can_exists( unsigned id ) { return id < NUM_CAN; } @@ -30,7 +30,7 @@ int ICACHE_FLASH_ATTR platform_can_exists( unsigned id ) // SPI functions -int ICACHE_FLASH_ATTR platform_spi_exists( unsigned id ) +int platform_spi_exists( unsigned id ) { return id < NUM_SPI; } @@ -38,7 +38,7 @@ int ICACHE_FLASH_ATTR platform_spi_exists( unsigned id ) // **************************************************************************** // PWM functions -int ICACHE_FLASH_ATTR platform_pwm_exists( unsigned id ) +int platform_pwm_exists( unsigned id ) { return ((id < NUM_PWM) && (id > 0)); } @@ -46,7 +46,7 @@ int ICACHE_FLASH_ATTR platform_pwm_exists( unsigned id ) // **************************************************************************** // ADC functions -int ICACHE_FLASH_ATTR platform_adc_exists( unsigned id ) +int platform_adc_exists( unsigned id ) { return id < NUM_ADC; } @@ -54,7 +54,7 @@ int ICACHE_FLASH_ATTR platform_adc_exists( unsigned id ) // **************************************************************************** // UART functions -int ICACHE_FLASH_ATTR platform_uart_exists( unsigned id ) +int platform_uart_exists( unsigned id ) { return id < NUM_UART; } @@ -62,7 +62,7 @@ int ICACHE_FLASH_ATTR platform_uart_exists( unsigned id ) // **************************************************************************** // OneWire functions -int ICACHE_FLASH_ATTR platform_ow_exists( unsigned id ) +int platform_ow_exists( unsigned id ) { return ((id < NUM_OW) && (id > 0)); } @@ -70,13 +70,13 @@ int ICACHE_FLASH_ATTR platform_ow_exists( unsigned id ) // **************************************************************************** // Timer functions -int ICACHE_FLASH_ATTR platform_tmr_exists( unsigned id ) +int platform_tmr_exists( unsigned id ) { return id < NUM_TMR; } // I2C support -int ICACHE_FLASH_ATTR platform_i2c_exists( unsigned id ) +int platform_i2c_exists( unsigned id ) { #ifndef NUM_I2C return 0; @@ -99,7 +99,7 @@ extern char _flash_used_end[]; // Helper function: find the flash sector in which an address resides // Return the sector number, as well as the start and end address of the sector -static uint32_t ICACHE_FLASH_ATTR flashh_find_sector( uint32_t address, uint32_t *pstart, uint32_t *pend ) +static uint32_t flashh_find_sector( uint32_t address, uint32_t *pstart, uint32_t *pend ) { address -= INTERNAL_FLASH_START_ADDRESS; #ifdef INTERNAL_FLASH_SECTOR_SIZE @@ -127,12 +127,12 @@ static uint32_t ICACHE_FLASH_ATTR flashh_find_sector( uint32_t address, uint32_t #endif // #ifdef INTERNAL_FLASH_SECTOR_SIZE } -uint32_t ICACHE_FLASH_ATTR platform_flash_get_sector_of_address( uint32_t addr ) +uint32_t platform_flash_get_sector_of_address( uint32_t addr ) { return flashh_find_sector( addr, NULL, NULL ); } -uint32_t ICACHE_FLASH_ATTR platform_flash_get_num_sectors(void) +uint32_t platform_flash_get_num_sectors(void) { #ifdef INTERNAL_FLASH_SECTOR_SIZE return INTERNAL_FLASH_SIZE / INTERNAL_FLASH_SECTOR_SIZE; @@ -143,7 +143,7 @@ uint32_t ICACHE_FLASH_ATTR platform_flash_get_num_sectors(void) #endif // #ifdef INTERNAL_FLASH_SECTOR_SIZE } -uint32_t ICACHE_FLASH_ATTR platform_flash_get_first_free_block_address( uint32_t *psect ) +uint32_t platform_flash_get_first_free_block_address( uint32_t *psect ) { // Round the total used flash size to the closest flash block address uint32_t start, end, sect; @@ -162,7 +162,7 @@ uint32_t ICACHE_FLASH_ATTR platform_flash_get_first_free_block_address( uint32_t } } -uint32_t ICACHE_FLASH_ATTR platform_flash_write( const void *from, uint32_t toaddr, uint32_t size ) +uint32_t platform_flash_write( const void *from, uint32_t toaddr, uint32_t size ) { #ifndef INTERNAL_FLASH_WRITE_UNIT_SIZE return platform_s_flash_write( from, toaddr, size ); @@ -212,7 +212,7 @@ uint32_t ICACHE_FLASH_ATTR platform_flash_write( const void *from, uint32_t toad #endif // #ifndef INTERNAL_FLASH_WRITE_UNIT_SIZE } -uint32_t ICACHE_FLASH_ATTR platform_flash_read( void *to, uint32_t fromaddr, uint32_t size ) +uint32_t platform_flash_read( void *to, uint32_t fromaddr, uint32_t size ) { #ifndef INTERNAL_FLASH_READ_UNIT_SIZE return platform_s_flash_read( to, fromaddr, size ); diff --git a/app/platform/flash_api.c b/app/platform/flash_api.c index 7a85e5bf..164cfdb7 100644 --- a/app/platform/flash_api.c +++ b/app/platform/flash_api.c @@ -7,74 +7,69 @@ #include "flash_api.h" #include "spi_flash.h" -SPIFlashInfo *ICACHE_FLASH_ATTR -flash_get_info(void) -{ - static SPIFlashInfo spi_flash_info NODE_STORE_ATTR; - static bool is_spi_flash_info_initialized = false; - // Make the code more fast - if (!is_spi_flash_info_initialized) - { - SPIRead(0, &spi_flash_info, sizeof(spi_flash_info)); - is_spi_flash_info_initialized = true; - } - // return (SPIFlashInfo *)(0x40200000); - return &spi_flash_info; +static volatile const uint8_t flash_init_data[128] ICACHE_STORE_ATTR ICACHE_FLASH_ATTR = +{ + 0x05, 0x00, 0x04, 0x02, 0x05, 0x05, 0x05, 0x02, 0x05, 0x00, 0x04, 0x05, 0x05, 0x04, 0x05, 0x05, + 0x04, 0xFE, 0xFD, 0xFF, 0xF0, 0xF0, 0xF0, 0xE0, 0xE0, 0xE0, 0xE1, 0x0A, 0xFF, 0xFF, 0xF8, 0x00, + 0xF8, 0xF8, 0x52, 0x4E, 0x4A, 0x44, 0x40, 0x38, 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x05, + 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xE1, 0x0A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x93, 0x43, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; + +SPIFlashInfo flash_get_info(void) +{ + volatile SPIFlashInfo spi_flash_info ICACHE_STORE_ATTR; + spi_flash_info = *((SPIFlashInfo *)(FLASH_MAP_START_ADDRESS)); + return spi_flash_info; } -uint8_t ICACHE_FLASH_ATTR -flash_get_size(void) +uint8_t flash_get_size(void) { - SPIFlashInfo *p_spi_flash_info = flash_get_info(); - return p_spi_flash_info->size; + return flash_get_info().size; } -uint32_t ICACHE_FLASH_ATTR -flash_get_size_byte(void) +uint32_t flash_get_size_byte(void) { - static uint32_t flash_size = 0; - // Make the code more fast - if (flash_size == 0 ) + uint32_t flash_size = 0; + switch (flash_get_info().size) { - SPIFlashInfo *p_spi_flash_info = flash_get_info(); - switch (p_spi_flash_info->size) - { - case SIZE_2MBIT: - // 2Mbit, 256kByte - flash_size = 256 * 1024; - break; - case SIZE_4MBIT: - // 4Mbit, 512kByte - flash_size = 512 * 1024; - break; - case SIZE_8MBIT: - // 8Mbit, 1MByte - flash_size = 1 * 1024 * 1024; - break; - case SIZE_16MBIT: - // 16Mbit, 2MByte - flash_size = 2 * 1024 * 1024; - break; - case SIZE_32MBIT: - // 32Mbit, 4MByte - flash_size = 4 * 1024 * 1024; - break; - default: - // Unknown flash size, fall back mode. - flash_size = 512 * 1024; - break; - } + case SIZE_2MBIT: + // 2Mbit, 256kByte + flash_size = 256 * 1024; + break; + case SIZE_4MBIT: + // 4Mbit, 512kByte + flash_size = 512 * 1024; + break; + case SIZE_8MBIT: + // 8Mbit, 1MByte + flash_size = 1 * 1024 * 1024; + break; + case SIZE_16MBIT: + // 16Mbit, 2MByte + flash_size = 2 * 1024 * 1024; + break; + case SIZE_32MBIT: + // 32Mbit, 4MByte + flash_size = 4 * 1024 * 1024; + break; + default: + // Unknown flash size, fall back mode. + flash_size = 512 * 1024; + break; } return flash_size; } -bool ICACHE_FLASH_ATTR -flash_set_size(uint8_t size) +bool flash_set_size(uint8_t size) { // Dangerous, here are dinosaur infested!!!!! // Reboot required!!! // If you don't know what you're doing, your nodemcu may turn into stone ... - uint8_t data[SPI_FLASH_SEC_SIZE] NODE_STORE_ATTR; + uint8_t data[SPI_FLASH_SEC_SIZE] ICACHE_STORE_ATTR; SPIRead(0, data, sizeof(data)); SPIFlashInfo *p_spi_flash_info = (SPIFlashInfo *)(data); p_spi_flash_info->size = size; @@ -85,8 +80,7 @@ flash_set_size(uint8_t size) return true; } -bool ICACHE_FLASH_ATTR -flash_set_size_byte(uint32_t size) +bool flash_set_size_byte(uint32_t size) { // Dangerous, here are dinosaur infested!!!!! // Reboot required!!! @@ -128,23 +122,15 @@ flash_set_size_byte(uint32_t size) return result; } -uint16_t ICACHE_FLASH_ATTR -flash_get_sec_num(void) +uint16_t flash_get_sec_num(void) { - static uint16_t result = 0; - // Make the code more fast - if (result == 0 ) - { - result = flash_get_size_byte() / SPI_FLASH_SEC_SIZE; - } - return result; + return flash_get_size_byte() / SPI_FLASH_SEC_SIZE; } -uint8_t ICACHE_FLASH_ATTR -flash_get_mode(void) +uint8_t flash_get_mode(void) { - SPIFlashInfo *p_spi_flash_info = flash_get_info(); - switch (p_spi_flash_info->mode) + SPIFlashInfo spi_flash_info = flash_get_info(); + switch (spi_flash_info.mode) { // Reserved for future use case MODE_QIO: @@ -156,15 +142,14 @@ flash_get_mode(void) case MODE_DOUT: break; } - return p_spi_flash_info->mode; + return spi_flash_info.mode; } -uint32_t ICACHE_FLASH_ATTR -flash_get_speed(void) +uint32_t flash_get_speed(void) { uint32_t speed = 0; - SPIFlashInfo *p_spi_flash_info = flash_get_info(); - switch (p_spi_flash_info->speed) + SPIFlashInfo spi_flash_info = flash_get_info(); + switch (spi_flash_info.speed) { case SPEED_40MHZ: // 40MHz @@ -186,8 +171,7 @@ flash_get_speed(void) return speed; } -bool ICACHE_FLASH_ATTR -flash_init_data_default(void) +bool flash_init_data_default(void) { // FLASH SEC - 4 // Dangerous, here are dinosaur infested!!!!! @@ -195,12 +179,11 @@ flash_init_data_default(void) // It will init system data to default! SPIEraseSector((flash_get_sec_num() - 4)); - SPIWrite((flash_get_sec_num() - 4) * SPI_FLASH_SEC_SIZE, 0x10000 - SPI_FLASH_SEC_SIZE + (0), 128); + SPIWrite((flash_get_sec_num() - 4) * SPI_FLASH_SEC_SIZE, (uint32_t *)flash_init_data, 128); return true; } -bool ICACHE_FLASH_ATTR -flash_init_data_blank(void) +bool flash_init_data_blank(void) { // FLASH SEC - 2 // Dangerous, here are dinosaur infested!!!!! @@ -211,8 +194,7 @@ flash_init_data_blank(void) return true; } -bool ICACHE_FLASH_ATTR -flash_self_destruct(void) +bool flash_self_destruct(void) { // Erase your flash. Good bye! SPIEraseChip(); diff --git a/app/platform/flash_api.h b/app/platform/flash_api.h index a88e0504..bbdd7530 100644 --- a/app/platform/flash_api.h +++ b/app/platform/flash_api.h @@ -2,6 +2,8 @@ #define __FLASH_API_H__ #include "ets_sys.h" #include "user_config.h" +#include "cpu_esp8266.h" +#define FLASH_MAP_START_ADDRESS (INTERNAL_FLASH_START_ADDRESS) typedef struct { @@ -29,9 +31,9 @@ typedef struct SIZE_16MBIT = 3, SIZE_32MBIT = 4, } size : 4; -} NODE_STORE_TYPEDEF_ATTR SPIFlashInfo; +} ICACHE_STORE_TYPEDEF_ATTR SPIFlashInfo; -SPIFlashInfo *flash_get_info(void); +SPIFlashInfo flash_get_info(void); uint8_t flash_get_size(void); uint32_t flash_get_size_byte(void); bool flash_set_size(uint8_t); diff --git a/app/platform/flash_fs.c b/app/platform/flash_fs.c index b8f6373a..ad0e6629 100644 --- a/app/platform/flash_fs.c +++ b/app/platform/flash_fs.c @@ -7,7 +7,7 @@ #include "spiffs.h" #endif -int ICACHE_FLASH_ATTR fs_mode2flag(const char *mode){ +int fs_mode2flag(const char *mode){ if(c_strlen(mode)==1){ if(c_strcmp(mode,"w")==0) return FS_WRONLY|FS_CREAT|FS_TRUNC; diff --git a/app/platform/platform.c b/app/platform/platform.c index b69599c2..9db3f9f6 100644 --- a/app/platform/platform.c +++ b/app/platform/platform.c @@ -11,7 +11,7 @@ static void pwms_init(); -int ICACHE_FLASH_ATTR platform_init() +int platform_init() { // Setup PWMs pwms_init(); @@ -23,7 +23,7 @@ int ICACHE_FLASH_ATTR platform_init() // **************************************************************************** // KEY_LED functions -uint8_t ICACHE_FLASH_ATTR platform_key_led( uint8_t level){ +uint8_t platform_key_led( uint8_t level){ uint8_t temp; gpio16_output_set(1); // set to high first, for reading key low level gpio16_input_conf(); @@ -38,7 +38,7 @@ uint8_t ICACHE_FLASH_ATTR platform_key_led( uint8_t level){ #ifdef GPIO_INTERRUPT_ENABLE extern void lua_gpio_unref(unsigned pin); #endif -int ICACHE_FLASH_ATTR platform_gpio_mode( unsigned pin, unsigned mode, unsigned pull ) +int platform_gpio_mode( unsigned pin, unsigned mode, unsigned pull ) { // NODE_DBG("Function platform_gpio_mode() is called. pin_mux:%d, func:%d\n",pin_mux[pin],pin_func[pin]); if (pin >= NUM_GPIO) @@ -108,7 +108,7 @@ int ICACHE_FLASH_ATTR platform_gpio_mode( unsigned pin, unsigned mode, unsigned return 1; } -int ICACHE_FLASH_ATTR platform_gpio_write( unsigned pin, unsigned level ) +int platform_gpio_write( unsigned pin, unsigned level ) { // NODE_DBG("Function platform_gpio_write() is called. pin:%d, level:%d\n",GPIO_ID_PIN(pin_num[pin]),level); if (pin >= NUM_GPIO) @@ -122,7 +122,7 @@ int ICACHE_FLASH_ATTR platform_gpio_write( unsigned pin, unsigned level ) GPIO_OUTPUT_SET(GPIO_ID_PIN(pin_num[pin]), level); } -int ICACHE_FLASH_ATTR platform_gpio_read( unsigned pin ) +int platform_gpio_read( unsigned pin ) { // NODE_DBG("Function platform_gpio_read() is called. pin:%d\n",GPIO_ID_PIN(pin_num[pin])); if (pin >= NUM_GPIO) @@ -138,7 +138,7 @@ int ICACHE_FLASH_ATTR platform_gpio_read( unsigned pin ) } #ifdef GPIO_INTERRUPT_ENABLE -static void ICACHE_FLASH_ATTR platform_gpio_intr_dispatcher( platform_gpio_intr_handler_fn_t cb){ +static void platform_gpio_intr_dispatcher( platform_gpio_intr_handler_fn_t cb){ uint8 i, level; uint32 gpio_status = GPIO_REG_READ(GPIO_STATUS_ADDRESS); for (i = 0; i < GPIO_PIN_NUM; i++) { @@ -156,12 +156,12 @@ static void ICACHE_FLASH_ATTR platform_gpio_intr_dispatcher( platform_gpio_intr_ } } -void ICACHE_FLASH_ATTR platform_gpio_init( platform_gpio_intr_handler_fn_t cb ) +void platform_gpio_init( platform_gpio_intr_handler_fn_t cb ) { ETS_GPIO_INTR_ATTACH(platform_gpio_intr_dispatcher, cb); } -int ICACHE_FLASH_ATTR platform_gpio_intr_init( unsigned pin, GPIO_INT_TYPE type ) +int platform_gpio_intr_init( unsigned pin, GPIO_INT_TYPE type ) { if (pin >= NUM_GPIO) return -1; @@ -181,7 +181,7 @@ int ICACHE_FLASH_ATTR platform_gpio_intr_init( unsigned pin, GPIO_INT_TYPE type // UartDev is defined and initialized in rom code. extern UartDevice UartDev; -uint32_t ICACHE_FLASH_ATTR platform_uart_setup( unsigned id, uint32_t baud, int databits, int parity, int stopbits ) +uint32_t platform_uart_setup( unsigned id, uint32_t baud, int databits, int parity, int stopbits ) { switch( baud ) { @@ -262,7 +262,7 @@ void platform_uart_send( unsigned id, u8 data ) static uint16_t pwms_duty[NUM_PWM] = {0}; -static void ICACHE_FLASH_ATTR pwms_init() +static void pwms_init() { int i; for(i=0;i= NUM_PWM) @@ -288,7 +288,7 @@ uint32_t ICACHE_FLASH_ATTR platform_pwm_get_clock( unsigned pin ) } // Set the PWM clock -uint32_t ICACHE_FLASH_ATTR platform_pwm_set_clock( unsigned pin, uint32_t clock ) +uint32_t platform_pwm_set_clock( unsigned pin, uint32_t clock ) { // NODE_DBG("Function platform_pwm_set_clock() is called.\n"); if( pin >= NUM_PWM) @@ -301,7 +301,7 @@ uint32_t ICACHE_FLASH_ATTR platform_pwm_set_clock( unsigned pin, uint32_t clock return (uint32_t)pwm_get_freq( pin ); } -uint32_t ICACHE_FLASH_ATTR platform_pwm_get_duty( unsigned pin ) +uint32_t platform_pwm_get_duty( unsigned pin ) { // NODE_DBG("Function platform_pwm_get_duty() is called.\n"); if( pin < NUM_PWM){ @@ -314,7 +314,7 @@ uint32_t ICACHE_FLASH_ATTR platform_pwm_get_duty( unsigned pin ) } // Set the PWM duty -uint32_t ICACHE_FLASH_ATTR platform_pwm_set_duty( unsigned pin, uint32_t duty ) +uint32_t platform_pwm_set_duty( unsigned pin, uint32_t duty ) { // NODE_DBG("Function platform_pwm_set_duty() is called.\n"); if ( pin < NUM_PWM) @@ -330,7 +330,7 @@ uint32_t ICACHE_FLASH_ATTR platform_pwm_set_duty( unsigned pin, uint32_t duty ) return pwms_duty[pin]; } -uint32_t ICACHE_FLASH_ATTR platform_pwm_setup( unsigned pin, uint32_t frequency, unsigned duty ) +uint32_t platform_pwm_setup( unsigned pin, uint32_t frequency, unsigned duty ) { uint32_t clock; if ( pin < NUM_PWM) @@ -350,7 +350,7 @@ uint32_t ICACHE_FLASH_ATTR platform_pwm_setup( unsigned pin, uint32_t frequency, return clock; } -void ICACHE_FLASH_ATTR platform_pwm_close( unsigned pin ) +void platform_pwm_close( unsigned pin ) { // NODE_DBG("Function platform_pwm_stop() is called.\n"); if ( pin < NUM_PWM) @@ -360,7 +360,7 @@ void ICACHE_FLASH_ATTR platform_pwm_close( unsigned pin ) } } -void ICACHE_FLASH_ATTR platform_pwm_start( unsigned pin ) +void platform_pwm_start( unsigned pin ) { // NODE_DBG("Function platform_pwm_start() is called.\n"); if ( pin < NUM_PWM) @@ -372,7 +372,7 @@ void ICACHE_FLASH_ATTR platform_pwm_start( unsigned pin ) } } -void ICACHE_FLASH_ATTR platform_pwm_stop( unsigned pin ) +void platform_pwm_stop( unsigned pin ) { // NODE_DBG("Function platform_pwm_stop() is called.\n"); if ( pin < NUM_PWM) @@ -387,7 +387,7 @@ void ICACHE_FLASH_ATTR platform_pwm_stop( unsigned pin ) // ***************************************************************************** // I2C platform interface -uint32_t ICACHE_FLASH_ATTR platform_i2c_setup( unsigned id, uint8_t sda, uint8_t scl, uint32_t speed ){ +uint32_t platform_i2c_setup( unsigned id, uint8_t sda, uint8_t scl, uint32_t speed ){ if (sda >= NUM_GPIO || scl >= NUM_GPIO) return 0; @@ -402,15 +402,15 @@ uint32_t ICACHE_FLASH_ATTR platform_i2c_setup( unsigned id, uint8_t sda, uint8_t return PLATFORM_I2C_SPEED_SLOW; } -void ICACHE_FLASH_ATTR platform_i2c_send_start( unsigned id ){ +void platform_i2c_send_start( unsigned id ){ i2c_master_start(); } -void ICACHE_FLASH_ATTR platform_i2c_send_stop( unsigned id ){ +void platform_i2c_send_stop( unsigned id ){ i2c_master_stop(); } -int ICACHE_FLASH_ATTR platform_i2c_send_address( unsigned id, uint16_t address, int direction ){ +int platform_i2c_send_address( unsigned id, uint16_t address, int direction ){ // Convert enum codes to R/w bit value. // If TX == 0 and RX == 1, this test will be removed by the compiler if ( ! ( PLATFORM_I2C_DIRECTION_TRANSMITTER == 0 && @@ -423,13 +423,13 @@ int ICACHE_FLASH_ATTR platform_i2c_send_address( unsigned id, uint16_t address, return ! i2c_master_getAck(); } -int ICACHE_FLASH_ATTR platform_i2c_send_byte( unsigned id, uint8_t data ){ +int platform_i2c_send_byte( unsigned id, uint8_t data ){ i2c_master_writeByte(data); // Low-level returns nack (0=acked); we return ack (1=acked). return ! i2c_master_getAck(); } -int ICACHE_FLASH_ATTR platform_i2c_recv_byte( unsigned id, int ack ){ +int platform_i2c_recv_byte( unsigned id, int ack ){ uint8_t r = i2c_master_readByte(); i2c_master_setAck( !ack ); return r; @@ -438,7 +438,7 @@ int ICACHE_FLASH_ATTR platform_i2c_recv_byte( unsigned id, int ack ){ // **************************************************************************** // Flash access functions -uint32_t ICACHE_FLASH_ATTR platform_s_flash_write( const void *from, uint32_t toaddr, uint32_t size ) +uint32_t platform_s_flash_write( const void *from, uint32_t toaddr, uint32_t size ) { toaddr -= INTERNAL_FLASH_START_ADDRESS; SpiFlashOpResult r; @@ -462,7 +462,7 @@ uint32_t ICACHE_FLASH_ATTR platform_s_flash_write( const void *from, uint32_t to } } -uint32_t ICACHE_FLASH_ATTR platform_s_flash_read( void *to, uint32_t fromaddr, uint32_t size ) +uint32_t platform_s_flash_read( void *to, uint32_t fromaddr, uint32_t size ) { fromaddr -= INTERNAL_FLASH_START_ADDRESS; SpiFlashOpResult r; @@ -476,7 +476,7 @@ uint32_t ICACHE_FLASH_ATTR platform_s_flash_read( void *to, uint32_t fromaddr, u } } -int ICACHE_FLASH_ATTR platform_flash_erase_sector( uint32_t sector_id ) +int platform_flash_erase_sector( uint32_t sector_id ) { WRITE_PERI_REG(0x60000914, 0x73); return flash_erase( sector_id ) == SPI_FLASH_RESULT_OK ? PLATFORM_OK : PLATFORM_ERR; diff --git a/app/smart/smart.c b/app/smart/smart.c index 71808de5..b8114836 100644 --- a/app/smart/smart.c +++ b/app/smart/smart.c @@ -32,7 +32,7 @@ static smart_succeed succeed = NULL; static void *smart_succeed_arg = NULL; void smart_end(); -int ICACHE_FLASH_ATTR smart_check(uint8_t *nibble, uint16_t len, uint8_t *dst, uint8_t *got){ +int smart_check(uint8_t *nibble, uint16_t len, uint8_t *dst, uint8_t *got){ if(len == 0) return 0; uint16_t dst_len = len/NIBBLE_PER_BYTE; @@ -127,7 +127,7 @@ int ICACHE_FLASH_ATTR smart_check(uint8_t *nibble, uint16_t len, uint8_t *dst, u return res; } -void ICACHE_FLASH_ATTR detect(uint8 *buf, uint16 len){ +void detect(uint8 *buf, uint16 len){ uint16_t seq; int16_t seq_delta = 0; uint16_t byte_num = 0, bit_num = 0; @@ -435,7 +435,7 @@ end: return; } -void ICACHE_FLASH_ATTR reset_map(smart_addr_map **am, size_t num){ +void reset_map(smart_addr_map **am, size_t num){ int i; for (i = 0; i < num; ++i) { @@ -461,15 +461,15 @@ void ICACHE_FLASH_ATTR reset_map(smart_addr_map **am, size_t num){ } } -void ICACHE_FLASH_ATTR smart_enable(void){ +void smart_enable(void){ wifi_promiscuous_enable(1); } -void ICACHE_FLASH_ATTR smart_disable(void){ +void smart_disable(void){ wifi_promiscuous_enable(0); } -void ICACHE_FLASH_ATTR smart_end(){ +void smart_end(){ int i; os_timer_disarm(&smart_timer); smart_disable(); @@ -532,7 +532,7 @@ void ICACHE_FLASH_ATTR smart_end(){ // system_restart(); // restart to enable the mode } -void ICACHE_FLASH_ATTR smart_next_channel(){ +void smart_next_channel(){ smart_disable(); switch(cur_channel){ case 1: @@ -586,7 +586,7 @@ void ICACHE_FLASH_ATTR smart_next_channel(){ smart_enable(); } -void ICACHE_FLASH_ATTR smart_begin(int chnl, smart_succeed s, void *arg){ +void smart_begin(int chnl, smart_succeed s, void *arg){ int i; alldone = 0; for (i = 0; i < ADDR_MAP_NUM; ++i) @@ -674,7 +674,7 @@ void ICACHE_FLASH_ATTR smart_begin(int chnl, smart_succeed s, void *arg){ smart_enable(); } -void ICACHE_FLASH_ATTR station_check_connect(bool smart){ +void station_check_connect(bool smart){ mode = wifi_get_opmode(); if( (STATION_MODE != mode) && (mode != STATIONAP_MODE) ){ return; diff --git a/app/spiffs/spiffs.c b/app/spiffs/spiffs.c index c4fa2b14..005dab1a 100644 --- a/app/spiffs/spiffs.c +++ b/app/spiffs/spiffs.c @@ -10,17 +10,17 @@ static u8_t spiffs_work_buf[LOG_PAGE_SIZE*2]; static u8_t spiffs_fds[32*4]; static u8_t spiffs_cache[(LOG_PAGE_SIZE+32)*4]; -static s32_t ICACHE_FLASH_ATTR my_spiffs_read(u32_t addr, u32_t size, u8_t *dst) { +static s32_t my_spiffs_read(u32_t addr, u32_t size, u8_t *dst) { platform_flash_read(dst, addr, size); return SPIFFS_OK; } -static s32_t ICACHE_FLASH_ATTR my_spiffs_write(u32_t addr, u32_t size, u8_t *src) { +static s32_t my_spiffs_write(u32_t addr, u32_t size, u8_t *src) { platform_flash_write(src, addr, size); return SPIFFS_OK; } -static s32_t ICACHE_FLASH_ATTR my_spiffs_erase(u32_t addr, u32_t size) { +static s32_t my_spiffs_erase(u32_t addr, u32_t size) { u32_t sect_first = platform_flash_get_sector_of_address(addr); u32_t sect_last = sect_first; while( sect_first <= sect_last ) @@ -42,7 +42,7 @@ The small 4KB sectors allow for greater flexibility in applications th ********************/ -void ICACHE_FLASH_ATTR spiffs_mount() { +void spiffs_mount() { spiffs_config cfg; cfg.phys_addr = ( u32_t )platform_flash_get_first_free_block_address( NULL ); cfg.phys_size = INTERNAL_FLASH_SIZE - ( ( u32_t )cfg.phys_addr - INTERNAL_FLASH_START_ADDRESS ); @@ -69,7 +69,7 @@ void ICACHE_FLASH_ATTR spiffs_mount() { // FS formatting function // Returns 1 if OK, 0 for error -int ICACHE_FLASH_ATTR myspiffs_format( void ) +int myspiffs_format( void ) { SPIFFS_unmount(&fs); u32_t sect_first, sect_last; @@ -84,7 +84,7 @@ int ICACHE_FLASH_ATTR myspiffs_format( void ) return 1; } -int ICACHE_FLASH_ATTR myspiffs_check( void ) +int myspiffs_check( void ) { // ets_wdt_disable(); // int res = (int)SPIFFS_check(&fs); @@ -92,15 +92,15 @@ int ICACHE_FLASH_ATTR myspiffs_check( void ) // return res; } -int ICACHE_FLASH_ATTR myspiffs_open(const char *name, int flags){ +int myspiffs_open(const char *name, int flags){ return (int)SPIFFS_open(&fs, name, (spiffs_flags)flags, 0); } -int ICACHE_FLASH_ATTR myspiffs_close( int fd ){ +int myspiffs_close( int fd ){ SPIFFS_close(&fs, (spiffs_file)fd); return 0; } -size_t ICACHE_FLASH_ATTR myspiffs_write( int fd, const void* ptr, size_t len ){ +size_t myspiffs_write( int fd, const void* ptr, size_t len ){ #if 0 if(fd==c_stdout || fd==c_stderr){ uart0_tx_buffer((u8_t*)ptr, len); @@ -109,39 +109,39 @@ size_t ICACHE_FLASH_ATTR myspiffs_write( int fd, const void* ptr, size_t len ){ #endif return SPIFFS_write(&fs, (spiffs_file)fd, (void *)ptr, len); } -size_t ICACHE_FLASH_ATTR myspiffs_read( int fd, void* ptr, size_t len){ +size_t myspiffs_read( int fd, void* ptr, size_t len){ return SPIFFS_read(&fs, (spiffs_file)fd, ptr, len); } -int ICACHE_FLASH_ATTR myspiffs_lseek( int fd, int off, int whence ){ +int myspiffs_lseek( int fd, int off, int whence ){ return SPIFFS_lseek(&fs, (spiffs_file)fd, off, whence); } -int ICACHE_FLASH_ATTR myspiffs_eof( int fd ){ +int myspiffs_eof( int fd ){ return SPIFFS_eof(&fs, (spiffs_file)fd); } -int ICACHE_FLASH_ATTR myspiffs_tell( int fd ){ +int myspiffs_tell( int fd ){ return SPIFFS_tell(&fs, (spiffs_file)fd); } -int ICACHE_FLASH_ATTR myspiffs_getc( int fd ){ +int myspiffs_getc( int fd ){ char c = EOF; if(!myspiffs_eof(fd)){ SPIFFS_read(&fs, (spiffs_file)fd, &c, 1); } return (int)c; } -int ICACHE_FLASH_ATTR myspiffs_ungetc( int c, int fd ){ +int myspiffs_ungetc( int c, int fd ){ return SPIFFS_lseek(&fs, (spiffs_file)fd, -1, SEEK_CUR); } -int ICACHE_FLASH_ATTR myspiffs_flush( int fd ){ +int myspiffs_flush( int fd ){ return SPIFFS_fflush(&fs, (spiffs_file)fd); } -int ICACHE_FLASH_ATTR myspiffs_error( int fd ){ +int myspiffs_error( int fd ){ return SPIFFS_errno(&fs); } -void ICACHE_FLASH_ATTR myspiffs_clearerr( int fd ){ +void myspiffs_clearerr( int fd ){ fs.errno = SPIFFS_OK; } #if 0 -void ICACHE_FLASH_ATTR test_spiffs() { +void test_spiffs() { char buf[12]; // Surely, I've mounted spiffs before entering here diff --git a/app/spiffs/spiffs_cache.c b/app/spiffs/spiffs_cache.c index d56823cc..7c1c6d50 100644 --- a/app/spiffs/spiffs_cache.c +++ b/app/spiffs/spiffs_cache.c @@ -11,7 +11,7 @@ #if SPIFFS_CACHE // returns cached page for give page index, or null if no such cached page -static spiffs_cache_page *ICACHE_FLASH_ATTR spiffs_cache_page_get(spiffs *fs, spiffs_page_ix pix) { +static spiffs_cache_page *spiffs_cache_page_get(spiffs *fs, spiffs_page_ix pix) { spiffs_cache *cache = spiffs_get_cache(fs); if ((cache->cpage_use_map & cache->cpage_use_mask) == 0) return 0; int i; @@ -30,7 +30,7 @@ static spiffs_cache_page *ICACHE_FLASH_ATTR spiffs_cache_page_get(spiffs *fs, sp } // frees cached page -static s32_t ICACHE_FLASH_ATTR spiffs_cache_page_free(spiffs *fs, int ix, u8_t write_back) { +static s32_t spiffs_cache_page_free(spiffs *fs, int ix, u8_t write_back) { s32_t res = SPIFFS_OK; spiffs_cache *cache = spiffs_get_cache(fs); spiffs_cache_page *cp = spiffs_get_cache_page_hdr(fs, cache, ix); @@ -56,7 +56,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_cache_page_free(spiffs *fs, int ix, u8_t w } // removes the oldest accessed cached page -static s32_t ICACHE_FLASH_ATTR spiffs_cache_page_remove_oldest(spiffs *fs, u8_t flag_mask, u8_t flags) { +static s32_t spiffs_cache_page_remove_oldest(spiffs *fs, u8_t flag_mask, u8_t flags) { s32_t res = SPIFFS_OK; spiffs_cache *cache = spiffs_get_cache(fs); @@ -86,7 +86,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_cache_page_remove_oldest(spiffs *fs, u8_t } // allocates a new cached page and returns it, or null if all cache pages are busy -static spiffs_cache_page *ICACHE_FLASH_ATTR spiffs_cache_page_allocate(spiffs *fs) { +static spiffs_cache_page *spiffs_cache_page_allocate(spiffs *fs) { spiffs_cache *cache = spiffs_get_cache(fs); if (cache->cpage_use_map == 0xffffffff) { // out of cache memory @@ -107,7 +107,7 @@ static spiffs_cache_page *ICACHE_FLASH_ATTR spiffs_cache_page_allocate(spiffs *f } // drops the cache page for give page index -void ICACHE_FLASH_ATTR spiffs_cache_drop_page(spiffs *fs, spiffs_page_ix pix) { +void spiffs_cache_drop_page(spiffs *fs, spiffs_page_ix pix) { spiffs_cache_page *cp = spiffs_cache_page_get(fs, pix); if (cp) { spiffs_cache_page_free(fs, cp->ix, 0); @@ -117,7 +117,7 @@ void ICACHE_FLASH_ATTR spiffs_cache_drop_page(spiffs *fs, spiffs_page_ix pix) { // ------------------------------ // reads from spi flash or the cache -s32_t ICACHE_FLASH_ATTR spiffs_phys_rd( +s32_t spiffs_phys_rd( spiffs *fs, u8_t op, spiffs_file fh, @@ -165,7 +165,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_phys_rd( } // writes to spi flash and/or the cache -s32_t ICACHE_FLASH_ATTR spiffs_phys_wr( +s32_t spiffs_phys_wr( spiffs *fs, u8_t op, spiffs_file fh, @@ -207,7 +207,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_phys_wr( #if SPIFFS_CACHE_WR // returns the cache page that this fd refers, or null if no cache page -spiffs_cache_page *ICACHE_FLASH_ATTR spiffs_cache_page_get_by_fd(spiffs *fs, spiffs_fd *fd) { +spiffs_cache_page *spiffs_cache_page_get_by_fd(spiffs *fs, spiffs_fd *fd) { spiffs_cache *cache = spiffs_get_cache(fs); if ((cache->cpage_use_map & cache->cpage_use_mask) == 0) { @@ -230,7 +230,7 @@ spiffs_cache_page *ICACHE_FLASH_ATTR spiffs_cache_page_get_by_fd(spiffs *fs, spi // allocates a new cache page and refers this to given fd - flushes an old cache // page if all cache is busy -spiffs_cache_page *ICACHE_FLASH_ATTR spiffs_cache_page_allocate_by_fd(spiffs *fs, spiffs_fd *fd) { +spiffs_cache_page *spiffs_cache_page_allocate_by_fd(spiffs *fs, spiffs_fd *fd) { // before this function is called, it is ensured that there is no already existing // cache page with same object id spiffs_cache_page_remove_oldest(fs, SPIFFS_CACHE_FLAG_TYPE_WR, 0); @@ -247,7 +247,7 @@ spiffs_cache_page *ICACHE_FLASH_ATTR spiffs_cache_page_allocate_by_fd(spiffs *fs } // unrefers all fds that this cache page refers to and releases the cache page -void ICACHE_FLASH_ATTR spiffs_cache_fd_release(spiffs *fs, spiffs_cache_page *cp) { +void spiffs_cache_fd_release(spiffs *fs, spiffs_cache_page *cp) { if (cp == 0) return; int i; spiffs_fd *fds = (spiffs_fd *)fs->fd_space; @@ -265,7 +265,7 @@ void ICACHE_FLASH_ATTR spiffs_cache_fd_release(spiffs *fs, spiffs_cache_page *cp #endif // initializes the cache -void ICACHE_FLASH_ATTR spiffs_cache_init(spiffs *fs) { +void spiffs_cache_init(spiffs *fs) { if (fs->cache == 0) return; u32_t sz = fs->cache_size; u32_t cache_mask = 0; diff --git a/app/spiffs/spiffs_check.c b/app/spiffs/spiffs_check.c index f67b9652..3ccdc592 100644 --- a/app/spiffs/spiffs_check.c +++ b/app/spiffs/spiffs_check.c @@ -28,7 +28,7 @@ // searches in the object indices and returns the referenced page index given // the object id and the data span index // destroys fs->lu_work -static s32_t ICACHE_FLASH_ATTR spiffs_object_get_data_page_index_reference( +static s32_t spiffs_object_get_data_page_index_reference( spiffs *fs, spiffs_obj_id obj_id, spiffs_span_ix data_spix, @@ -59,7 +59,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_object_get_data_page_index_reference( } // copies page contents to a new page -static s32_t ICACHE_FLASH_ATTR spiffs_rewrite_page(spiffs *fs, spiffs_page_ix cur_pix, spiffs_page_header *p_hdr, spiffs_page_ix *new_pix) { +static s32_t spiffs_rewrite_page(spiffs *fs, spiffs_page_ix cur_pix, spiffs_page_header *p_hdr, spiffs_page_ix *new_pix) { s32_t res; res = spiffs_page_allocate_data(fs, p_hdr->obj_id, p_hdr, 0,0,0,0, new_pix); SPIFFS_CHECK_RES(res); @@ -73,7 +73,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_rewrite_page(spiffs *fs, spiffs_page_ix cu // rewrites the object index for given object id and replaces the // data page index to a new page index -static s32_t ICACHE_FLASH_ATTR spiffs_rewrite_index(spiffs *fs, spiffs_obj_id obj_id, spiffs_span_ix data_spix, spiffs_page_ix new_data_pix, spiffs_page_ix objix_pix) { +static s32_t spiffs_rewrite_index(spiffs *fs, spiffs_obj_id obj_id, spiffs_span_ix data_spix, spiffs_page_ix new_data_pix, spiffs_page_ix objix_pix) { s32_t res; spiffs_block_ix bix; int entry; @@ -137,7 +137,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_rewrite_index(spiffs *fs, spiffs_obj_id ob } // deletes an object just by marking object index header as deleted -static s32_t ICACHE_FLASH_ATTR spiffs_delete_obj_lazy(spiffs *fs, spiffs_obj_id obj_id) { +static s32_t spiffs_delete_obj_lazy(spiffs *fs, spiffs_obj_id obj_id) { spiffs_page_ix objix_hdr_pix; s32_t res; res = spiffs_obj_lu_find_id_and_span(fs, obj_id, 0, 0, &objix_hdr_pix); @@ -154,7 +154,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_delete_obj_lazy(spiffs *fs, spiffs_obj_id } // validates the given look up entry -static s32_t ICACHE_FLASH_ATTR spiffs_lookup_check_validate(spiffs *fs, spiffs_obj_id lu_obj_id, spiffs_page_header *p_hdr, +static s32_t spiffs_lookup_check_validate(spiffs *fs, spiffs_obj_id lu_obj_id, spiffs_page_header *p_hdr, spiffs_page_ix cur_pix, spiffs_block_ix cur_block, int cur_entry, int *reload_lu) { u8_t delete_page = 0; s32_t res = SPIFFS_OK; @@ -424,7 +424,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_lookup_check_validate(spiffs *fs, spiffs_o return res; } -static s32_t ICACHE_FLASH_ATTR spiffs_lookup_check_v(spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix cur_block, int cur_entry, +static s32_t spiffs_lookup_check_v(spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix cur_block, int cur_entry, u32_t user_data, void *user_p) { s32_t res = SPIFFS_OK; spiffs_page_header p_hdr; @@ -452,7 +452,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_lookup_check_v(spiffs *fs, spiffs_obj_id o // Scans all object look up. For each entry, corresponding page header is checked for validity. // If an object index header page is found, this is also checked -s32_t ICACHE_FLASH_ATTR spiffs_lookup_consistency_check(spiffs *fs, u8_t check_all_objects) { +s32_t spiffs_lookup_consistency_check(spiffs *fs, u8_t check_all_objects) { s32_t res = SPIFFS_OK; if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_LOOKUP, SPIFFS_CHECK_PROGRESS, 0, 0); @@ -485,7 +485,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_lookup_consistency_check(spiffs *fs, u8_t check_a // * x011 used, referenced only once, not index // * x101 used, unreferenced, index // The working memory might not fit all pages so several scans might be needed -static s32_t ICACHE_FLASH_ATTR spiffs_page_consistency_check_i(spiffs *fs) { +static s32_t spiffs_page_consistency_check_i(spiffs *fs) { const u32_t bits = 4; const spiffs_page_ix pages_per_scan = SPIFFS_CFG_LOG_PAGE_SZ(fs) * 8 / bits; @@ -822,7 +822,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_page_consistency_check_i(spiffs *fs) { } // Checks consistency amongst all pages and fixes irregularities -s32_t ICACHE_FLASH_ATTR spiffs_page_consistency_check(spiffs *fs) { +s32_t spiffs_page_consistency_check(spiffs *fs) { if (fs->check_cb_f) fs->check_cb_f(SPIFFS_CHECK_PAGE, SPIFFS_CHECK_PROGRESS, 0, 0); s32_t res = spiffs_page_consistency_check_i(fs); if (res != SPIFFS_OK) { @@ -837,7 +837,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_page_consistency_check(spiffs *fs) { // searches for given object id in temporary object id index, // returns the index or -1 -static int ICACHE_FLASH_ATTR spiffs_object_index_search(spiffs *fs, spiffs_obj_id obj_id) { +static int spiffs_object_index_search(spiffs *fs, spiffs_obj_id obj_id) { int i; spiffs_obj_id *obj_table = (spiffs_obj_id *)fs->work; obj_id &= ~SPIFFS_OBJ_ID_IX_FLAG; @@ -849,7 +849,7 @@ static int ICACHE_FLASH_ATTR spiffs_object_index_search(spiffs *fs, spiffs_obj_i return -1; } -s32_t ICACHE_FLASH_ATTR spiffs_object_index_consistency_check_v(spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix cur_block, +s32_t spiffs_object_index_consistency_check_v(spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix cur_block, int cur_entry, u32_t user_data, void *user_p) { s32_t res_c = SPIFFS_VIS_COUNTINUE; s32_t res = SPIFFS_OK; @@ -943,7 +943,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_index_consistency_check_v(spiffs *fs, spif // Scans for index pages. When an index page is found, corresponding index header is searched for. // If no such page exists, the index page cannot be reached as no index header exists and must be // deleted. -s32_t ICACHE_FLASH_ATTR spiffs_object_index_consistency_check(spiffs *fs) { +s32_t spiffs_object_index_consistency_check(spiffs *fs) { s32_t res = SPIFFS_OK; // impl note: // fs->work is used for a temporary object index memory, listing found object ids and diff --git a/app/spiffs/spiffs_gc.c b/app/spiffs/spiffs_gc.c index e7ec1d15..cfcf3a1d 100644 --- a/app/spiffs/spiffs_gc.c +++ b/app/spiffs/spiffs_gc.c @@ -4,7 +4,7 @@ // Erases a logical block and updates the erase counter. // If cache is enabled, all pages that might be cached in this block // is dropped. -static s32_t ICACHE_FLASH_ATTR spiffs_gc_erase_block( +static s32_t spiffs_gc_erase_block( spiffs *fs, spiffs_block_ix bix) { s32_t res; @@ -47,7 +47,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_gc_erase_block( // Searches for blocks where all entries are deleted - if one is found, // the block is erased. Compared to the non-quick gc, the quick one ensures // that no updates are needed on existing objects on pages that are erased. -s32_t ICACHE_FLASH_ATTR spiffs_gc_quick( +s32_t spiffs_gc_quick( spiffs *fs) { s32_t res = SPIFFS_OK; u32_t blocks = fs->block_count; @@ -111,7 +111,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_gc_quick( // Checks if garbaga collecting is necessary. If so a candidate block is found, // cleansed and erased -s32_t ICACHE_FLASH_ATTR spiffs_gc_check( +s32_t spiffs_gc_check( spiffs *fs, u32_t len) { s32_t res; @@ -179,7 +179,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_gc_check( } // Updates page statistics for a block that is about to be erased -s32_t ICACHE_FLASH_ATTR spiffs_gc_erase_page_stats( +s32_t spiffs_gc_erase_page_stats( spiffs *fs, spiffs_block_ix bix) { s32_t res = SPIFFS_OK; @@ -216,7 +216,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_gc_erase_page_stats( } // Finds block candidates to erase -s32_t ICACHE_FLASH_ATTR spiffs_gc_find_candidate( +s32_t spiffs_gc_find_candidate( spiffs *fs, spiffs_block_ix **block_candidates, int *candidate_count) { @@ -350,7 +350,7 @@ typedef struct { // repeat loop until end of object lookup // scan object lookup again for remaining object index pages, move to new page in other block // -s32_t ICACHE_FLASH_ATTR spiffs_gc_clean(spiffs *fs, spiffs_block_ix bix) { +s32_t spiffs_gc_clean(spiffs *fs, spiffs_block_ix bix) { s32_t res = SPIFFS_OK; u32_t entries_per_page = (SPIFFS_CFG_LOG_PAGE_SZ(fs) / sizeof(spiffs_obj_id)); int cur_entry = 0; diff --git a/app/spiffs/spiffs_hydrogen.c b/app/spiffs/spiffs_hydrogen.c index a4597c6a..fcedfb72 100644 --- a/app/spiffs/spiffs_hydrogen.c +++ b/app/spiffs/spiffs_hydrogen.c @@ -11,17 +11,17 @@ static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh); #if SPIFFS_BUFFER_HELP -u32_t ICACHE_FLASH_ATTR SPIFFS_buffer_bytes_for_filedescs(spiffs *fs, u32_t num_descs) { +u32_t SPIFFS_buffer_bytes_for_filedescs(spiffs *fs, u32_t num_descs) { return num_descs * sizeof(spiffs_fd); } #if SPIFFS_CACHE -u32_t ICACHE_FLASH_ATTR SPIFFS_buffer_bytes_for_cache(spiffs *fs, u32_t num_pages) { +u32_t SPIFFS_buffer_bytes_for_cache(spiffs *fs, u32_t num_pages) { return sizeof(spiffs_cache) + num_pages * (sizeof(spiffs_cache_page) + SPIFFS_CFG_LOG_PAGE_SZ(fs)); } #endif #endif -s32_t ICACHE_FLASH_ATTR SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work, +s32_t SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *work, u8_t *fd_space, u32_t fd_space_size, void *cache, u32_t cache_size, spiffs_check_callback check_cb_f) { @@ -82,7 +82,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_mount(spiffs *fs, spiffs_config *config, u8_t *wo return 0; } -void ICACHE_FLASH_ATTR SPIFFS_unmount(spiffs *fs) { +void SPIFFS_unmount(spiffs *fs) { if (!SPIFFS_CHECK_MOUNT(fs)) return; SPIFFS_LOCK(fs); int i; @@ -100,11 +100,11 @@ void ICACHE_FLASH_ATTR SPIFFS_unmount(spiffs *fs) { SPIFFS_UNLOCK(fs); } -s32_t ICACHE_FLASH_ATTR SPIFFS_errno(spiffs *fs) { +s32_t SPIFFS_errno(spiffs *fs) { return fs->errno; } -s32_t ICACHE_FLASH_ATTR SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode mode) { +s32_t SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode mode) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); spiffs_obj_id obj_id; @@ -118,7 +118,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_creat(spiffs *fs, const char *path, spiffs_mode m return 0; } -spiffs_file ICACHE_FLASH_ATTR SPIFFS_open(spiffs *fs, const char *path, spiffs_flags flags, spiffs_mode mode) { +spiffs_file SPIFFS_open(spiffs *fs, const char *path, spiffs_flags flags, spiffs_mode mode) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -175,7 +175,7 @@ spiffs_file ICACHE_FLASH_ATTR SPIFFS_open(spiffs *fs, const char *path, spiffs_f return fd->file_nbr; } -s32_t ICACHE_FLASH_ATTR SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, u32_t len) { +s32_t SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, u32_t len) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -220,7 +220,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_read(spiffs *fs, spiffs_file fh, void *buf, u32_t return len; } -static s32_t ICACHE_FLASH_ATTR spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, void *buf, u32_t offset, s32_t len) { +static s32_t spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, void *buf, u32_t offset, s32_t len) { s32_t res = SPIFFS_OK; s32_t remaining = len; if (fd->size != SPIFFS_UNDEFINED_LEN && offset < fd->size) { @@ -239,7 +239,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_hydro_write(spiffs *fs, spiffs_fd *fd, voi } -s32_t ICACHE_FLASH_ATTR SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, u32_t len) { +s32_t SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, u32_t len) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -357,7 +357,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_write(spiffs *fs, spiffs_file fh, void *buf, u32_ return res; } -s32_t ICACHE_FLASH_ATTR SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) { +s32_t SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int whence) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -401,7 +401,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_lseek(spiffs *fs, spiffs_file fh, s32_t offs, int return 0; } -s32_t ICACHE_FLASH_ATTR SPIFFS_remove(spiffs *fs, const char *path) { +s32_t SPIFFS_remove(spiffs *fs, const char *path) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -434,7 +434,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_remove(spiffs *fs, const char *path) { return 0; } -s32_t ICACHE_FLASH_ATTR SPIFFS_fremove(spiffs *fs, spiffs_file fh) { +s32_t SPIFFS_fremove(spiffs *fs, spiffs_file fh) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -461,7 +461,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_fremove(spiffs *fs, spiffs_file fh) { return 0; } -static s32_t ICACHE_FLASH_ATTR spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, spiffs_file fh, spiffs_stat *s) { +static s32_t spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, spiffs_file fh, spiffs_stat *s) { spiffs_page_object_ix_header objix_hdr; spiffs_obj_id obj_id; s32_t res =_spiffs_rd(fs, SPIFFS_OP_T_OBJ_IX | SPIFFS_OP_C_READ, fh, @@ -482,7 +482,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_stat_pix(spiffs *fs, spiffs_page_ix pix, s return res; } -s32_t ICACHE_FLASH_ATTR SPIFFS_stat(spiffs *fs, const char *path, spiffs_stat *s) { +s32_t SPIFFS_stat(spiffs *fs, const char *path, spiffs_stat *s) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -499,7 +499,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_stat(spiffs *fs, const char *path, spiffs_stat *s return res; } -s32_t ICACHE_FLASH_ATTR SPIFFS_fstat(spiffs *fs, spiffs_file fh, spiffs_stat *s) { +s32_t SPIFFS_fstat(spiffs *fs, spiffs_file fh, spiffs_stat *s) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -522,7 +522,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_fstat(spiffs *fs, spiffs_file fh, spiffs_stat *s) // Checks if there are any cached writes for the object id associated with // given filehandle. If so, these writes are flushed. -static s32_t ICACHE_FLASH_ATTR spiffs_fflush_cache(spiffs *fs, spiffs_file fh) { +static s32_t spiffs_fflush_cache(spiffs *fs, spiffs_file fh) { s32_t res = SPIFFS_OK; #if SPIFFS_CACHE_WR @@ -552,7 +552,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_fflush_cache(spiffs *fs, spiffs_file fh) { return res; } -s32_t ICACHE_FLASH_ATTR SPIFFS_fflush(spiffs *fs, spiffs_file fh) { +s32_t SPIFFS_fflush(spiffs *fs, spiffs_file fh) { SPIFFS_API_CHECK_MOUNT(fs); s32_t res = SPIFFS_OK; #if SPIFFS_CACHE_WR @@ -565,7 +565,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_fflush(spiffs *fs, spiffs_file fh) { return res; } -void ICACHE_FLASH_ATTR SPIFFS_close(spiffs *fs, spiffs_file fh) { +void SPIFFS_close(spiffs *fs, spiffs_file fh) { if (!SPIFFS_CHECK_MOUNT(fs)) { fs->errno = SPIFFS_ERR_NOT_MOUNTED; return; @@ -580,7 +580,7 @@ void ICACHE_FLASH_ATTR SPIFFS_close(spiffs *fs, spiffs_file fh) { SPIFFS_UNLOCK(fs); } -spiffs_DIR *ICACHE_FLASH_ATTR SPIFFS_opendir(spiffs *fs, const char *name, spiffs_DIR *d) { +spiffs_DIR *SPIFFS_opendir(spiffs *fs, const char *name, spiffs_DIR *d) { if (!SPIFFS_CHECK_MOUNT(fs)) { fs->errno = SPIFFS_ERR_NOT_MOUNTED; return 0; @@ -591,7 +591,7 @@ spiffs_DIR *ICACHE_FLASH_ATTR SPIFFS_opendir(spiffs *fs, const char *name, spiff return d; } -static s32_t ICACHE_FLASH_ATTR spiffs_read_dir_v( +static s32_t spiffs_read_dir_v( spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix bix, @@ -624,7 +624,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_read_dir_v( return SPIFFS_VIS_COUNTINUE; } -struct spiffs_dirent *ICACHE_FLASH_ATTR SPIFFS_readdir(spiffs_DIR *d, struct spiffs_dirent *e) { +struct spiffs_dirent *SPIFFS_readdir(spiffs_DIR *d, struct spiffs_dirent *e) { if (!SPIFFS_CHECK_MOUNT(d->fs)) { d->fs->errno = SPIFFS_ERR_NOT_MOUNTED; return 0; @@ -657,12 +657,12 @@ struct spiffs_dirent *ICACHE_FLASH_ATTR SPIFFS_readdir(spiffs_DIR *d, struct spi return ret; } -s32_t ICACHE_FLASH_ATTR SPIFFS_closedir(spiffs_DIR *d) { +s32_t SPIFFS_closedir(spiffs_DIR *d) { SPIFFS_API_CHECK_MOUNT(d->fs); return 0; } -s32_t ICACHE_FLASH_ATTR SPIFFS_check(spiffs *fs) { +s32_t SPIFFS_check(spiffs *fs) { s32_t res; SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -679,7 +679,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_check(spiffs *fs) { return res; } -s32_t ICACHE_FLASH_ATTR SPIFFS_eof(spiffs *fs, spiffs_file fh) { +s32_t SPIFFS_eof(spiffs *fs, spiffs_file fh) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -698,7 +698,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_eof(spiffs *fs, spiffs_file fh) { return res; } -s32_t ICACHE_FLASH_ATTR SPIFFS_tell(spiffs *fs, spiffs_file fh) { +s32_t SPIFFS_tell(spiffs *fs, spiffs_file fh) { SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); @@ -718,7 +718,7 @@ s32_t ICACHE_FLASH_ATTR SPIFFS_tell(spiffs *fs, spiffs_file fh) { } #if SPIFFS_TEST_VISUALISATION -s32_t ICACHE_FLASH_ATTR SPIFFS_vis(spiffs *fs) { +s32_t SPIFFS_vis(spiffs *fs) { s32_t res = SPIFFS_OK; SPIFFS_API_CHECK_MOUNT(fs); SPIFFS_LOCK(fs); diff --git a/app/spiffs/spiffs_nucleus.c b/app/spiffs/spiffs_nucleus.c index 01b5f94e..92ceec05 100644 --- a/app/spiffs/spiffs_nucleus.c +++ b/app/spiffs/spiffs_nucleus.c @@ -1,7 +1,7 @@ #include "spiffs.h" #include "spiffs_nucleus.h" -static s32_t ICACHE_FLASH_ATTR spiffs_page_data_check(spiffs *fs, spiffs_fd *fd, spiffs_page_ix pix, spiffs_span_ix spix) { +static s32_t spiffs_page_data_check(spiffs *fs, spiffs_fd *fd, spiffs_page_ix pix, spiffs_span_ix spix) { s32_t res = SPIFFS_OK; if (pix == (spiffs_page_ix)-1) { // referring to page 0xffff...., bad object index @@ -29,7 +29,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_page_data_check(spiffs *fs, spiffs_fd *fd, return res; } -static s32_t ICACHE_FLASH_ATTR spiffs_page_index_check(spiffs *fs, spiffs_fd *fd, spiffs_page_ix pix, spiffs_span_ix spix) { +static s32_t spiffs_page_index_check(spiffs *fs, spiffs_fd *fd, spiffs_page_ix pix, spiffs_span_ix spix) { s32_t res = SPIFFS_OK; if (pix == (spiffs_page_ix)-1) { // referring to page 0xffff...., bad object index @@ -59,7 +59,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_page_index_check(spiffs *fs, spiffs_fd *fd #if !SPIFFS_CACHE -s32_t ICACHE_FLASH_ATTR spiffs_phys_rd( +s32_t spiffs_phys_rd( spiffs *fs, u32_t addr, u32_t len, @@ -67,7 +67,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_phys_rd( return fs->cfg.hal_read_f(addr, len, dst); } -s32_t ICACHE_FLASH_ATTR spiffs_phys_wr( +s32_t spiffs_phys_wr( spiffs *fs, u32_t addr, u32_t len, @@ -77,7 +77,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_phys_wr( #endif -s32_t ICACHE_FLASH_ATTR spiffs_phys_cpy( +s32_t spiffs_phys_cpy( spiffs *fs, spiffs_file fh, u32_t dst, @@ -116,7 +116,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_phys_cpy( // @param user_p any pointer, passed to the callback visitor function // @param block_ix reported block index where match was found // @param lu_entry reported look up index where match was found -s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_entry_visitor( +s32_t spiffs_obj_lu_find_entry_visitor( spiffs *fs, spiffs_block_ix starting_block, int starting_lu_entry, @@ -214,7 +214,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_entry_visitor( } -static s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_scan_v( +static s32_t spiffs_obj_lu_scan_v( spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix bix, @@ -237,7 +237,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_scan_v( // Scans thru all obj lu and counts free, deleted and used pages // Find the maximum block erase count -s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_scan( +s32_t spiffs_obj_lu_scan( spiffs *fs) { s32_t res; spiffs_block_ix bix; @@ -299,7 +299,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_scan( // Find free object lookup entry // Iterate over object lookup pages in each block until a free object id entry is found -s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_free( +s32_t spiffs_obj_lu_find_free( spiffs *fs, spiffs_block_ix starting_block, int starting_lu_entry, @@ -331,7 +331,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_free( // Find object lookup entry containing given id // Iterate over object lookup pages in each block until a given object id entry is found -s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_id( +s32_t spiffs_obj_lu_find_id( spiffs *fs, spiffs_block_ix starting_block, int starting_lu_entry, @@ -347,7 +347,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_id( } -static s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_id_and_span_v( +static s32_t spiffs_obj_lu_find_id_and_span_v( spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix bix, @@ -373,7 +373,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_id_and_span_v( // Find object lookup entry containing given id and span index // Iterate over object lookup pages in each block until a given object id entry is found -s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_id_and_span( +s32_t spiffs_obj_lu_find_id_and_span( spiffs *fs, spiffs_obj_id obj_id, spiffs_span_ix spix, @@ -412,7 +412,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_id_and_span( // Find object lookup entry containing given id and span index in page headers only // Iterate over object lookup pages in each block until a given object id entry is found -s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_id_and_span_by_phdr( +s32_t spiffs_obj_lu_find_id_and_span_by_phdr( spiffs *fs, spiffs_obj_id obj_id, spiffs_span_ix spix, @@ -452,7 +452,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_id_and_span_by_phdr( // Allocates a free defined page with given obj_id // Occupies object lookup entry and page // data may be NULL; where only page header is stored, len and page_offs is ignored -s32_t ICACHE_FLASH_ATTR spiffs_page_allocate_data( +s32_t spiffs_page_allocate_data( spiffs *fs, spiffs_obj_id obj_id, spiffs_page_header *ph, @@ -509,7 +509,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_page_allocate_data( // Moves a page from src to a free page and finalizes it. Updates page index. Page data is given in param page. // If page data is null, provided header is used for metainfo and page data is physically copied. -s32_t ICACHE_FLASH_ATTR spiffs_page_move( +s32_t spiffs_page_move( spiffs *fs, spiffs_file fh, u8_t *page_data, @@ -571,7 +571,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_page_move( } // Deletes a page and removes it from object lookup. -s32_t ICACHE_FLASH_ATTR spiffs_page_delete( +s32_t spiffs_page_delete( spiffs *fs, spiffs_page_ix pix) { s32_t res; @@ -600,7 +600,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_page_delete( } // Create an object index header page with empty index and undefined length -s32_t ICACHE_FLASH_ATTR spiffs_object_create( +s32_t spiffs_object_create( spiffs *fs, spiffs_obj_id obj_id, u8_t name[SPIFFS_OBJ_NAME_LEN], @@ -655,7 +655,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_create( // new_objix_hdr_data may be null, if so the object index header page is loaded // name may be null, if so name is not changed // size may be null, if so size is not changed -s32_t ICACHE_FLASH_ATTR spiffs_object_update_index_hdr( +s32_t spiffs_object_update_index_hdr( spiffs *fs, spiffs_fd *fd, spiffs_obj_id obj_id, @@ -706,7 +706,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_update_index_hdr( return res; } -void ICACHE_FLASH_ATTR spiffs_cb_object_event( +void spiffs_cb_object_event( spiffs *fs, spiffs_fd *fd, int ev, @@ -745,7 +745,7 @@ void ICACHE_FLASH_ATTR spiffs_cb_object_event( } // Open object by id -s32_t ICACHE_FLASH_ATTR spiffs_object_open_by_id( +s32_t spiffs_object_open_by_id( spiffs *fs, spiffs_obj_id obj_id, spiffs_fd *fd, @@ -763,7 +763,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_open_by_id( } // Open object by page index -s32_t ICACHE_FLASH_ATTR spiffs_object_open_by_page( +s32_t spiffs_object_open_by_page( spiffs *fs, spiffs_page_ix pix, spiffs_fd *fd, @@ -801,7 +801,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_open_by_page( // Append to object // keep current object index (header) page in fs->work buffer -s32_t ICACHE_FLASH_ATTR spiffs_object_append(spiffs_fd *fd, u32_t offset, u8_t *data, u32_t len) { +s32_t spiffs_object_append(spiffs_fd *fd, u32_t offset, u8_t *data, u32_t len) { spiffs *fs = fd->fs; s32_t res = SPIFFS_OK; u32_t written = 0; @@ -1032,7 +1032,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_append(spiffs_fd *fd, u32_t offset, u8_t * // Modify object // keep current object index (header) page in fs->work buffer -s32_t ICACHE_FLASH_ATTR spiffs_object_modify(spiffs_fd *fd, u32_t offset, u8_t *data, u32_t len) { +s32_t spiffs_object_modify(spiffs_fd *fd, u32_t offset, u8_t *data, u32_t len) { spiffs *fs = fd->fs; s32_t res = SPIFFS_OK; u32_t written = 0; @@ -1231,7 +1231,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_modify(spiffs_fd *fd, u32_t offset, u8_t * return res; } -static s32_t ICACHE_FLASH_ATTR spiffs_object_find_object_index_header_by_name_v( +static s32_t spiffs_object_find_object_index_header_by_name_v( spiffs *fs, spiffs_obj_id obj_id, spiffs_block_ix bix, @@ -1260,7 +1260,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_object_find_object_index_header_by_name_v( } // Finds object index header page by name -s32_t ICACHE_FLASH_ATTR spiffs_object_find_object_index_header_by_name( +s32_t spiffs_object_find_object_index_header_by_name( spiffs *fs, u8_t name[SPIFFS_OBJ_NAME_LEN], spiffs_page_ix *pix) { @@ -1295,7 +1295,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_find_object_index_header_by_name( } // Truncates object to new size. If new size is null, object may be removed totally -s32_t ICACHE_FLASH_ATTR spiffs_object_truncate( +s32_t spiffs_object_truncate( spiffs_fd *fd, u32_t new_size, u8_t remove) { @@ -1502,7 +1502,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_object_truncate( return res; } -s32_t ICACHE_FLASH_ATTR spiffs_object_read( +s32_t spiffs_object_read( spiffs_fd *fd, u32_t offset, u32_t len, @@ -1586,7 +1586,7 @@ typedef struct { u32_t compaction; } spiffs_free_obj_id_state; -static s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_free_obj_id_bitmap_v(spiffs *fs, spiffs_obj_id id, spiffs_block_ix bix, int ix_entry, +static s32_t spiffs_obj_lu_find_free_obj_id_bitmap_v(spiffs *fs, spiffs_obj_id id, spiffs_block_ix bix, int ix_entry, u32_t user_data, void *user_p) { if (id != SPIFFS_OBJ_ID_FREE && id != SPIFFS_OBJ_ID_DELETED) { spiffs_obj_id min_obj_id = user_data; @@ -1600,7 +1600,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_free_obj_id_bitmap_v(spiffs *f return SPIFFS_VIS_COUNTINUE; } -static s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_free_obj_id_compact_v(spiffs *fs, spiffs_obj_id id, spiffs_block_ix bix, int ix_entry, +static s32_t spiffs_obj_lu_find_free_obj_id_compact_v(spiffs *fs, spiffs_obj_id id, spiffs_block_ix bix, int ix_entry, u32_t user_data, void *user_p) { if (id != SPIFFS_OBJ_ID_FREE && id != SPIFFS_OBJ_ID_DELETED && (id & SPIFFS_OBJ_ID_IX_FLAG)) { s32_t res; @@ -1629,7 +1629,7 @@ static s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_free_obj_id_compact_v(spiffs * // object ids cannot fit into a work buffer, these are grouped. When a group containing free // object ids is found, the object lu is again scanned for object ids within group and bitmasked. // Finally, the bitmasked is searched for a free id -s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_free_obj_id(spiffs *fs, spiffs_obj_id *obj_id) { +s32_t spiffs_obj_lu_find_free_obj_id(spiffs *fs, spiffs_obj_id *obj_id) { s32_t res = SPIFFS_OK; u32_t max_objects = (SPIFFS_CFG_PHYS_SZ(fs) / (u32_t)SPIFFS_CFG_LOG_PAGE_SZ(fs)) / 2; spiffs_free_obj_id_state state; @@ -1720,7 +1720,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_obj_lu_find_free_obj_id(spiffs *fs, spiffs_obj_id return res; } -s32_t ICACHE_FLASH_ATTR spiffs_fd_find_new(spiffs *fs, spiffs_fd **fd) { +s32_t spiffs_fd_find_new(spiffs *fs, spiffs_fd **fd) { int i; spiffs_fd *fds = (spiffs_fd *)fs->fd_space; for (i = 0; i < fs->fd_count; i++) { @@ -1734,7 +1734,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_fd_find_new(spiffs *fs, spiffs_fd **fd) { return SPIFFS_ERR_OUT_OF_FILE_DESCS; } -s32_t ICACHE_FLASH_ATTR spiffs_fd_return(spiffs *fs, spiffs_file f) { +s32_t spiffs_fd_return(spiffs *fs, spiffs_file f) { if (f <= 0 || f > fs->fd_count) { return SPIFFS_ERR_BAD_DESCRIPTOR; } @@ -1747,7 +1747,7 @@ s32_t ICACHE_FLASH_ATTR spiffs_fd_return(spiffs *fs, spiffs_file f) { return SPIFFS_OK; } -s32_t ICACHE_FLASH_ATTR spiffs_fd_get(spiffs *fs, spiffs_file f, spiffs_fd **fd) { +s32_t spiffs_fd_get(spiffs *fs, spiffs_file f, spiffs_fd **fd) { if (f <= 0 || f > fs->fd_count) { return SPIFFS_ERR_BAD_DESCRIPTOR; } diff --git a/app/wofs/romfs.c b/app/wofs/romfs.c index 29d0b8d4..41faad05 100644 --- a/app/wofs/romfs.c +++ b/app/wofs/romfs.c @@ -28,7 +28,7 @@ static int romfs_num_fd; // Length of the 'file size' field for both ROMFS/WOFS #define ROMFS_SIZE_LEN 4 -static int ICACHE_FLASH_ATTR romfs_find_empty_fd(void) +static int romfs_find_empty_fd(void) { int i; @@ -40,7 +40,7 @@ static int ICACHE_FLASH_ATTR romfs_find_empty_fd(void) return -1; } -static void ICACHE_FLASH_ATTR romfs_close_fd( int fd ) +static void romfs_close_fd( int fd ) { if(fd<0 || fd>=TOTAL_MAX_FDS) return; @@ -49,7 +49,7 @@ static void ICACHE_FLASH_ATTR romfs_close_fd( int fd ) } // Helper function: read a byte from the FS -static uint8_t ICACHE_FLASH_ATTR romfsh_read8( uint32_t addr, const FSDATA *pfs ) +static uint8_t romfsh_read8( uint32_t addr, const FSDATA *pfs ) { uint8_t temp; if( pfs->flags & ROMFS_FS_FLAG_DIRECT ) @@ -59,13 +59,13 @@ static uint8_t ICACHE_FLASH_ATTR romfsh_read8( uint32_t addr, const FSDATA *pfs } // Helper function: return 1 if PFS reffers to a WOFS, 0 otherwise -static int ICACHE_FLASH_ATTR romfsh_is_wofs( const FSDATA* pfs ) +static int romfsh_is_wofs( const FSDATA* pfs ) { return ( pfs->flags & ROMFS_FS_FLAG_WO ) != 0; } // Find the next file, returning FS_FILE_OK or FS_FILE_NOT_FOUND if there no file left. -static uint8_t ICACHE_FLASH_ATTR romfs_next_file( uint32_t *start, char* fname, size_t len, size_t *act_len, FSDATA *pfs ) +static uint8_t romfs_next_file( uint32_t *start, char* fname, size_t len, size_t *act_len, FSDATA *pfs ) { uint32_t i, j, n; uint32_t fsize; @@ -120,7 +120,7 @@ static uint8_t ICACHE_FLASH_ATTR romfs_next_file( uint32_t *start, char* fname, // Open the given file, returning one of FS_FILE_NOT_FOUND, FS_FILE_ALREADY_OPENED // or FS_FILE_OK -static uint8_t ICACHE_FLASH_ATTR romfs_open_file( const char* fname, FD* pfd, FSDATA *pfs, uint32_t *plast, uint32_t *pnameaddr ) +static uint8_t romfs_open_file( const char* fname, FD* pfd, FSDATA *pfs, uint32_t *plast, uint32_t *pnameaddr ) { uint32_t i, j, n; char fsname[ MAX_FNAME_LENGTH + 1 ]; @@ -184,7 +184,7 @@ static uint8_t ICACHE_FLASH_ATTR romfs_open_file( const char* fname, FD* pfd, FS return FS_FILE_NOT_FOUND; } -static int ICACHE_FLASH_ATTR romfs_open( const char *path, int flags, int mode, void *pdata ) +static int romfs_open( const char *path, int flags, int mode, void *pdata ) { FD tempfs; int i; @@ -295,7 +295,7 @@ static int ICACHE_FLASH_ATTR romfs_open( const char *path, int flags, int mode, return i; } -static int ICACHE_FLASH_ATTR romfs_close( int fd, void *pdata ) +static int romfs_close( int fd, void *pdata ) { if(fd<0 || fd>=TOTAL_MAX_FDS) return 0; @@ -320,7 +320,7 @@ static int ICACHE_FLASH_ATTR romfs_close( int fd, void *pdata ) return 0; } -static _ssize_t ICACHE_FLASH_ATTR romfs_write( int fd, const void* ptr, size_t len, void *pdata ) +static _ssize_t romfs_write( int fd, const void* ptr, size_t len, void *pdata ) { if(fd<0 || fd>=TOTAL_MAX_FDS) return -1; @@ -350,7 +350,7 @@ static _ssize_t ICACHE_FLASH_ATTR romfs_write( int fd, const void* ptr, size_t l return len; } -static _ssize_t ICACHE_FLASH_ATTR romfs_read( int fd, void* ptr, size_t len, void *pdata ) +static _ssize_t romfs_read( int fd, void* ptr, size_t len, void *pdata ) { if(fd<0 || fd>=TOTAL_MAX_FDS) return -1; @@ -374,7 +374,7 @@ static _ssize_t ICACHE_FLASH_ATTR romfs_read( int fd, void* ptr, size_t len, voi } // lseek -static int ICACHE_FLASH_ATTR romfs_lseek( int fd, int off, int whence, void *pdata ) +static int romfs_lseek( int fd, int off, int whence, void *pdata ) { if(fd<0 || fd>=TOTAL_MAX_FDS) return -1; @@ -409,7 +409,7 @@ static int ICACHE_FLASH_ATTR romfs_lseek( int fd, int off, int whence, void *pda // WOFS functions and instance descriptor for real hardware #if defined( BUILD_WOFS ) -static uint32_t ICACHE_FLASH_ATTR sim_wofs_write( const void *from, uint32_t toaddr, uint32_t size, const void *pdata ) +static uint32_t sim_wofs_write( const void *from, uint32_t toaddr, uint32_t size, const void *pdata ) { const FSDATA *pfsdata = ( const FSDATA* )pdata; if(toaddr>=INTERNAL_FLASH_SIZE) @@ -421,7 +421,7 @@ static uint32_t ICACHE_FLASH_ATTR sim_wofs_write( const void *from, uint32_t toa return platform_flash_write( from, toaddr, size ); } -static uint32_t ICACHE_FLASH_ATTR sim_wofs_read( void *to, uint32_t fromaddr, uint32_t size, const void *pdata ) +static uint32_t sim_wofs_read( void *to, uint32_t fromaddr, uint32_t size, const void *pdata ) { const FSDATA *pfsdata = ( const FSDATA* )pdata; if(fromaddr>=INTERNAL_FLASH_SIZE) @@ -445,7 +445,7 @@ static FSDATA wofs_fsdata = // WOFS formatting function // Returns 1 if OK, 0 for error -int ICACHE_FLASH_ATTR wofs_format( void ) +int wofs_format( void ) { uint32_t sect_first, sect_last; FD tempfd; @@ -460,27 +460,27 @@ int ICACHE_FLASH_ATTR wofs_format( void ) return 1; } -int ICACHE_FLASH_ATTR wofs_open(const char *_name, int flags){ +int wofs_open(const char *_name, int flags){ return romfs_open( _name, flags, 0, &wofs_fsdata ); } -int ICACHE_FLASH_ATTR wofs_close( int fd ){ +int wofs_close( int fd ){ return romfs_close( fd, &wofs_fsdata ); } -size_t ICACHE_FLASH_ATTR wofs_write( int fd, const void* ptr, size_t len ){ +size_t wofs_write( int fd, const void* ptr, size_t len ){ return romfs_write( fd, ptr, len, &wofs_fsdata ); } -size_t ICACHE_FLASH_ATTR wofs_read( int fd, void* ptr, size_t len){ +size_t wofs_read( int fd, void* ptr, size_t len){ return romfs_read( fd, ptr, len, &wofs_fsdata ); } -int ICACHE_FLASH_ATTR wofs_lseek( int fd, int off, int whence ){ +int wofs_lseek( int fd, int off, int whence ){ return romfs_lseek( fd, off, whence, &wofs_fsdata ); } -int ICACHE_FLASH_ATTR wofs_eof( int fd ){ +int wofs_eof( int fd ){ if(fd<0 || fd>=TOTAL_MAX_FDS) return -1; FD* pfd = fd_table + fd; @@ -488,7 +488,7 @@ int ICACHE_FLASH_ATTR wofs_eof( int fd ){ return pfd->offset == pfd->size; } -int ICACHE_FLASH_ATTR wofs_getc( int fd ){ +int wofs_getc( int fd ){ char c = EOF; if(!wofs_eof(fd)){ romfs_read( fd, &c, 1, &wofs_fsdata ); @@ -497,19 +497,19 @@ int ICACHE_FLASH_ATTR wofs_getc( int fd ){ return (int)c; } -int ICACHE_FLASH_ATTR wofs_ungetc( int c, int fd ){ +int wofs_ungetc( int c, int fd ){ return romfs_lseek( fd, -1, SEEK_CUR, &wofs_fsdata ); } // Find the next file, returning FS_FILE_OK or FS_FILE_NOT_FOUND if there no file left. -uint8_t ICACHE_FLASH_ATTR wofs_next( uint32_t *start, char* fname, size_t len, size_t *act_len ){ +uint8_t wofs_next( uint32_t *start, char* fname, size_t len, size_t *act_len ){ return romfs_next_file( start, fname, len, act_len, &wofs_fsdata ); } #endif // #ifdef BUILD_WOFS // Initialize both ROMFS and WOFS as needed -int ICACHE_FLASH_ATTR romfs_init( void ) +int romfs_init( void ) { unsigned i; @@ -529,13 +529,13 @@ int ICACHE_FLASH_ATTR romfs_init( void ) #else // #if defined( BUILD_ROMFS ) || defined( BUILD_WOFS ) -int ICACHE_FLASH_ATTR romfs_init( void ) +int romfs_init( void ) { } #endif // #if defined( BUILD_ROMFS ) || defined( BUILD_WOFS ) -int ICACHE_FLASH_ATTR test_romfs() +int test_romfs() { int fd; int i, size; diff --git a/include/spi_flash.h b/include/spi_flash.h index 12dd6e17..5918c6b3 100644 --- a/include/spi_flash.h +++ b/include/spi_flash.h @@ -24,6 +24,8 @@ typedef struct{ #define SPI_FLASH_SEC_SIZE 4096 uint32 spi_flash_get_id(void); +SpiFlashOpResult spi_flash_read_status(uint32 *status); +SpiFlashOpResult spi_flash_write_status(uint32 status_value); SpiFlashOpResult spi_flash_erase_sector(uint16 sec); SpiFlashOpResult spi_flash_write(uint32 des_addr, uint32 *src_addr, uint32 size); SpiFlashOpResult spi_flash_read(uint32 src_addr, uint32 *des_addr, uint32 size); diff --git a/include/user_interface.h b/include/user_interface.h index 8002faa5..1306dfce 100644 --- a/include/user_interface.h +++ b/include/user_interface.h @@ -151,9 +151,9 @@ enum { STATION_GOT_IP }; -enum dhcp_status{ - DHCP_ENABLE, - DHCP_DISABLE +enum dhcp_status { + DHCP_STOPPED, + DHCP_STARTED }; uint8 wifi_station_get_connect_status(void); @@ -201,7 +201,7 @@ struct dhcps_lease { struct station_info * wifi_softap_get_station_info(void); void wifi_softap_free_station_info(void); -bool wifi_station_get_ap_info(struct station_config config[]); +uint8 wifi_station_get_ap_info(struct station_config config[]); bool wifi_softap_dhcps_start(void); bool wifi_softap_dhcps_stop(void); diff --git a/ld/eagle.app.v6.ld b/ld/eagle.app.v6.ld index e3a1d223..b8f45bea 100644 --- a/ld/eagle.app.v6.ld +++ b/ld/eagle.app.v6.ld @@ -66,6 +66,40 @@ SECTIONS _dport0_data_end = ABSOLUTE(.); } >dport0_0_seg :dport0_0_phdr + .irom0.text : ALIGN(4) + { + _irom0_text_start = ABSOLUTE(.); + *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) + *(.literal.* .text.*) + _irom0_text_end = ABSOLUTE(.); + _flash_used_end = ABSOLUTE(.); + } >irom0_0_seg :irom0_0_phdr + + .text : ALIGN(4) + { + _stext = .; + _text_start = ABSOLUTE(.); + *(.entry.text) + *(.init.literal) + *(.init) + /* *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) */ + *(.literal .text .iram0.text .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) + *(.fini.literal) + *(.fini) + *(.gnu.version) + _text_end = ABSOLUTE(.); + _etext = .; + } >iram1_0_seg :iram1_0_phdr + + .lit4 : ALIGN(4) + { + _lit4_start = ABSOLUTE(.); + *(*.lit4) + *(.lit4.*) + *(.gnu.linkonce.lit4.*) + _lit4_end = ABSOLUTE(.); + } >iram1_0_seg :iram1_0_phdr + .data : ALIGN(4) { _data_start = ABSOLUTE(.); @@ -145,40 +179,6 @@ SECTIONS } >dram0_0_seg :dram0_0_bss_phdr /* __stack = 0x3ffc8000; */ - .text : ALIGN(4) - { - _stext = .; - _text_start = ABSOLUTE(.); - *(.entry.text) - *(.init.literal) - *(.init) - *(.literal .text .literal.* .text.* .stub .gnu.warning .gnu.linkonce.literal.* .gnu.linkonce.t.*.literal .gnu.linkonce.t.*) - *(.fini.literal) - *(.fini) - *(.gnu.version) - _text_end = ABSOLUTE(.); - _etext = .; - } >iram1_0_seg :iram1_0_phdr - - .lit4 : ALIGN(4) - { - _lit4_start = ABSOLUTE(.); - *(*.lit4) - *(.lit4.*) - *(.gnu.linkonce.lit4.*) - _lit4_end = ABSOLUTE(.); - } >iram1_0_seg :iram1_0_phdr - - .irom0.text : ALIGN(4) - { - _crypt_fixed_start = ABSOLUTE(.); - *(.crypt_fixed) - _crypt_fixed_end = ABSOLUTE(.); - _irom0_text_start = ABSOLUTE(.); - *(.irom0.literal .irom.literal .irom.text.literal .irom0.text .irom.text) - _irom0_text_end = ABSOLUTE(.); - _flash_used_end = ABSOLUTE(.); - } >irom0_0_seg :irom0_0_phdr } /* get ROM code address */ diff --git a/ld/eagle.rom.addr.v6.ld b/ld/eagle.rom.addr.v6.ld index c5c1b652..0ca83963 100644 --- a/ld/eagle.rom.addr.v6.ld +++ b/ld/eagle.rom.addr.v6.ld @@ -16,6 +16,8 @@ PROVIDE ( SHA1Final = 0x4000b648 ); PROVIDE ( SHA1Init = 0x4000b584 ); PROVIDE ( SHA1Transform = 0x4000a364 ); PROVIDE ( SHA1Update = 0x4000b5a8 ); +PROVIDE ( SPI_read_status = 0x400043c8 ); +PROVIDE ( SPI_write_status = 0x40004400 ); PROVIDE ( Wait_SPI_Idle = 0x4000448c ); PROVIDE ( SPIEraseArea = 0x40004b44 ); PROVIDE ( SPIEraseBlock = 0x400049b4 ); diff --git a/lib/libjson.a b/lib/libjson.a index 0cd54651..a9492522 100644 Binary files a/lib/libjson.a and b/lib/libjson.a differ diff --git a/lib/liblwip.a b/lib/liblwip.a index ffe5f74b..04dd604a 100644 Binary files a/lib/liblwip.a and b/lib/liblwip.a differ diff --git a/lib/libmain.a b/lib/libmain.a index 231a218c..271a35fd 100644 Binary files a/lib/libmain.a and b/lib/libmain.a differ diff --git a/lib/libnet80211.a b/lib/libnet80211.a index f9f8c16c..7bcb84f0 100644 Binary files a/lib/libnet80211.a and b/lib/libnet80211.a differ diff --git a/lib/libpp.a b/lib/libpp.a index 6f7980d5..bf1a397d 100644 Binary files a/lib/libpp.a and b/lib/libpp.a differ diff --git a/lib/libssl.a b/lib/libssl.a index 48a82ebe..3fd56320 100644 Binary files a/lib/libssl.a and b/lib/libssl.a differ diff --git a/lib/libupgrade.a b/lib/libupgrade.a index 27d4616b..a4206383 100644 Binary files a/lib/libupgrade.a and b/lib/libupgrade.a differ diff --git a/lib/libwpa.a b/lib/libwpa.a index efdb76f4..85f334ef 100644 Binary files a/lib/libwpa.a and b/lib/libwpa.a differ