unleashed-firmware/lib/mjs/mjs_string.h
WillyJL c807ffc324
JS: Backport³ and more additions & fixes (#3961)
* JS: Fix file select for fbt launch js_app
* JS: badusb: Add numpad keys
  Co-authored-by: oldip <oldip@users.noreply.github.com>
* JS: badusb: Layout support
* JS: badusb: altPrint() and altPrintln()
  Co-authored-by: oldip <oldip@users.noreply.github.com>
* JS: badusb: quit()
* JS: serial: readAny()
* JS: serial: end()
* JS: serial: Auto disable expansion service
* JS: storage: Add example script
* JS: gui: text_input: Fix NULL ptr when no prop given
* JS: gui: text_input: Default text props
  Co-authored-by: xMasterX <xMasterX@users.noreply.github.com>
* JS: gui: byte_input
  Co-authored-by: xMasterX <xMasterX@users.noreply.github.com>
* JS: gui: file_picker
* JS: gui: viewDispatcher.currentView
* JS: gui: view.hasProperty()
* JS: gui: Add some missing typedefs comments
* JS: globals: Fix toString() with negative numbers
* JS: globals: parseInt()
  Co-authored-by: Spooks4576 <Spooks4576@users.noreply.github.com>
* JS: globals: toUpperCase() and toLowerCase()
  Co-authored-by: Spooks4576 <Spooks4576@users.noreply.github.com>
* JS: globals: Add some missing typedefs
* JS: Add example for string functions
  Co-authored-by: Spooks4576 <Spooks4576@users.noreply.github.com>
* JS: globals: __dirpath and __filepath
  Co-authored-by: jamisonderek <jamisonderek@users.noreply.github.com>
* JS: globals: load() typedef missing scope param
* JS: Add interactive REPL script example
* JS: Add missing icon for file picker
* JS: Rename to __filename and __dirname
* JS: Move toUpperCase() and toLowerCase() to string class
* JS: parseInt() refactor
* JS: Typedef base param for parseInt()
* Revert "JS: gui: view.hasProperty()"
  This reverts commit 1967ec06d4f2e9cafc4e18384ad370f7a7c44468.
* JS: Move toString() to Number class
* JS: Fix duplicate plugin files
  in plugins, `requires` is used to determine which app to distribute the .fal under `apps_data/appid/plugins`
* JS: math: Missing typedefs, use camelCase
* JS: badusb: layoutPath is optional in typedef
* Fix ASS scoping
* Rename mjs term prop type value
* Change load() description
* Enlarge buffers in default prop assign
* More checks for default data/text size
* Make PVS happy
* Fix icon symbol
* Update types for JS SDK
* toString() was moved to number class

Co-authored-by: oldip <oldip@users.noreply.github.com>
Co-authored-by: xMasterX <xMasterX@users.noreply.github.com>
Co-authored-by: Spooks4576 <Spooks4576@users.noreply.github.com>
Co-authored-by: jamisonderek <jamisonderek@users.noreply.github.com>
Co-authored-by: hedger <hedger@users.noreply.github.com>
Co-authored-by: あく <alleteam@gmail.com>
2024-10-31 14:22:05 +09:00

49 lines
1.3 KiB
C

/*
* 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);
MJS_PRIVATE void mjs_string_to_lower_case(struct mjs* mjs);
MJS_PRIVATE void mjs_string_to_upper_case(struct mjs* mjs);
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_ */