[FL-3579, FL-3601, FL-3714] JavaScript runner (#3286)
* FBT: cdefines to env, libs order
* API: strtod, modf, itoa, calloc
* Apps: elk js
* Apps: mjs
* JS: scripts as assets
* mjs: composite resolver
* mjs: stack trace
* ELK JS example removed
* MJS thread, MJS lib modified to support script interruption
* JS console UI
* Module system, BadUSB bindings rework
* JS notifications, simple dialog, BadUSB demo
* Custom dialogs, dialog demo
* MJS as system library, some dirty hacks to make it compile
* Plugin-based js modules
* js_uart(BadUART) module
* js_uart: support for byte array arguments
* Script icon and various fixes
* File browser: multiple extensions filter, running js scripts from app loader
* Running js scripts from archive browser
* JS Runner as system app
* Example scripts moved to /ext/apps/Scripts
* JS bytecode listing generation
* MJS builtin printf cleanup
* JS examples cleanup
* mbedtls version fix
* Unused lib cleanup
* Making PVS happy & TODOs cleanup
* TODOs cleanup #2
* MJS: initial typed arrays support
* JS: fix mem leak in uart destructor
Co-authored-by: SG <who.just.the.doctor@gmail.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2024-02-12 08:54:32 +00:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2016 Cesanta Software Limited
|
|
|
|
* All rights reserved
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef MJS_STRING_H_
|
|
|
|
#define MJS_STRING_H_
|
|
|
|
|
|
|
|
#include "mjs_internal.h"
|
|
|
|
#include "mjs_string_public.h"
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Size of the extra space for strings mbuf that is needed to avoid frequent
|
|
|
|
* reallocations
|
|
|
|
*/
|
|
|
|
#define _MJS_STRING_BUF_RESERVE 100
|
|
|
|
|
|
|
|
MJS_PRIVATE unsigned long cstr_to_ulong(const char* s, size_t len, int* ok);
|
|
|
|
MJS_PRIVATE mjs_err_t str_to_ulong(struct mjs* mjs, mjs_val_t v, int* ok, unsigned long* res);
|
|
|
|
MJS_PRIVATE int s_cmp(struct mjs* mjs, mjs_val_t a, mjs_val_t b);
|
|
|
|
MJS_PRIVATE mjs_val_t s_concat(struct mjs* mjs, mjs_val_t a, mjs_val_t b);
|
|
|
|
|
|
|
|
MJS_PRIVATE void embed_string(
|
|
|
|
struct mbuf* m,
|
|
|
|
size_t offset,
|
|
|
|
const char* p,
|
|
|
|
size_t len,
|
|
|
|
uint8_t /*enum embstr_flags*/ flags);
|
|
|
|
|
|
|
|
MJS_PRIVATE void mjs_mkstr(struct mjs* mjs);
|
|
|
|
|
2024-10-31 05:22:05 +00:00
|
|
|
MJS_PRIVATE void mjs_string_to_lower_case(struct mjs* mjs);
|
|
|
|
MJS_PRIVATE void mjs_string_to_upper_case(struct mjs* mjs);
|
[FL-3579, FL-3601, FL-3714] JavaScript runner (#3286)
* FBT: cdefines to env, libs order
* API: strtod, modf, itoa, calloc
* Apps: elk js
* Apps: mjs
* JS: scripts as assets
* mjs: composite resolver
* mjs: stack trace
* ELK JS example removed
* MJS thread, MJS lib modified to support script interruption
* JS console UI
* Module system, BadUSB bindings rework
* JS notifications, simple dialog, BadUSB demo
* Custom dialogs, dialog demo
* MJS as system library, some dirty hacks to make it compile
* Plugin-based js modules
* js_uart(BadUART) module
* js_uart: support for byte array arguments
* Script icon and various fixes
* File browser: multiple extensions filter, running js scripts from app loader
* Running js scripts from archive browser
* JS Runner as system app
* Example scripts moved to /ext/apps/Scripts
* JS bytecode listing generation
* MJS builtin printf cleanup
* JS examples cleanup
* mbedtls version fix
* Unused lib cleanup
* Making PVS happy & TODOs cleanup
* TODOs cleanup #2
* MJS: initial typed arrays support
* JS: fix mem leak in uart destructor
Co-authored-by: SG <who.just.the.doctor@gmail.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
2024-02-12 08:54:32 +00:00
|
|
|
MJS_PRIVATE void mjs_string_slice(struct mjs* mjs);
|
|
|
|
MJS_PRIVATE void mjs_string_index_of(struct mjs* mjs);
|
|
|
|
MJS_PRIVATE void mjs_string_char_code_at(struct mjs* mjs);
|
|
|
|
|
|
|
|
#define EMBSTR_ZERO_TERM 1
|
|
|
|
#define EMBSTR_UNESCAPE 2
|
|
|
|
|
|
|
|
#if defined(__cplusplus)
|
|
|
|
}
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
|
|
|
#endif /* MJS_STRING_H_ */
|