Loading...
Searching...
No Matches
mjs_string.h
1/*
2 * Copyright (c) 2016 Cesanta Software Limited
3 * All rights reserved
4 */
5
6#ifndef MJS_STRING_H_
7#define MJS_STRING_H_
8
9#include "mjs_internal.h"
10#include "mjs_string_public.h"
11
12#if defined(__cplusplus)
13extern "C" {
14#endif /* __cplusplus */
15
16/*
17 * Size of the extra space for strings mbuf that is needed to avoid frequent
18 * reallocations
19 */
20#define _MJS_STRING_BUF_RESERVE 100
21
22MJS_PRIVATE unsigned long cstr_to_ulong(const char* s, size_t len, int* ok);
23MJS_PRIVATE mjs_err_t str_to_ulong(struct mjs* mjs, mjs_val_t v, int* ok, unsigned long* res);
24MJS_PRIVATE int s_cmp(struct mjs* mjs, mjs_val_t a, mjs_val_t b);
25MJS_PRIVATE mjs_val_t s_concat(struct mjs* mjs, mjs_val_t a, mjs_val_t b);
26
27MJS_PRIVATE void embed_string(
28 struct mbuf* m,
29 size_t offset,
30 const char* p,
31 size_t len,
32 uint8_t /*enum embstr_flags*/ flags);
33
34MJS_PRIVATE void mjs_mkstr(struct mjs* mjs);
35
36MJS_PRIVATE void mjs_string_to_lower_case(struct mjs* mjs);
37MJS_PRIVATE void mjs_string_to_upper_case(struct mjs* mjs);
38MJS_PRIVATE void mjs_string_slice(struct mjs* mjs);
39MJS_PRIVATE void mjs_string_index_of(struct mjs* mjs);
40MJS_PRIVATE void mjs_string_char_code_at(struct mjs* mjs);
41
42#define EMBSTR_ZERO_TERM 1
43#define EMBSTR_UNESCAPE 2
44
45#if defined(__cplusplus)
46}
47#endif /* __cplusplus */
48
49#endif /* MJS_STRING_H_ */
Definition mbuf.h:48
Definition mjs_core.h:63