40 memcpy(nbuf, fs->
buf,
sizeof(*fs->
buf) * fs->
pos);
47 MEM_delete(fs->
accum);
54 for (i = 0; i <
len; i++) {
55 fs->
buf[fs->
pos + i] = c[i];
71 for (r = 0, i = 0; *
in; r++) {
101 MEM_delete(fs->
accum);
135 const char *
str = *str_p;
157 const char *
str = *str_p;
160 memset(fmt, type,
len);
172static ListBaseT<TextFormatType>
tft_lb = {
nullptr,
nullptr};
181 const char *text_ext = strchr(text->id.name + 2,
'.');
188 for (ext = tft.ext; *ext; ext++) {
209 return format->comment_line;
214 if (text ==
nullptr) {
219 if (text_ext ==
nullptr) {
233 for (ext = tft.ext; *ext; ext++) {
247 auto cmp_fn = [](
const char *text,
const char *string_literal) {
248 return strcmp(text, string_literal) < 0;
250 const char *
const *string_literal_p = std::upper_bound(
251 std::begin(string_literals), std::end(string_literals), text, cmp_fn);
253 if (string_literal_p != std::begin(string_literals)) {
254 const char *
string = *(string_literal_p - 1);
255 const size_t string_len = strlen(
string);
256 if (strncmp(
string, text, string_len) == 0) {
267 return std::is_sorted(string_literals.
begin(),
268 string_literals.
end(),
269 [](
const char *a,
const char *
b) { return strcmp(a, b) < 0; });
Read Blender memory allocation and freeing.
constexpr const T * end() const
constexpr const T * begin() const
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
bool BLI_string_is_decimal(const char *string) ATTR_NONNULL(1)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int char char int BLI_strcasecmp(const char *s1, const char *s2) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
int flatten_string(const SpaceText *st, FlattenString *fs, const char *in)
int text_check_format_len(TextLine *line, uint len)
void * MEM_new_array_uninitialized(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1
const char * BLI_path_extension(const char *filepath) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
static ListBaseT< TextFormatType > tft_lb
bool text_format_string_literals_check_sorted_array(const Span< const char * > string_literals)
TextFormatType * ED_text_format_get(Text *text)
int text_format_string_literal_find(const Span< const char * > string_literals, const char *text)
void flatten_string_free(FlattenString *fs)
int flatten_string_strlen(FlattenString *fs, const char *str)
int BLI_str_utf8_size_safe(const char *p) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
const char * ED_text_format_comment_line_prefix(Text *text)
void BLI_addtail(ListBase *listbase, void *vlink) ATTR_NONNULL(1)
void ED_text_format_register(TextFormatType *tft)
static void flatten_string_append(FlattenString *fs, const char *c, int accum, int len)
bool ED_text_is_syntax_highlight_supported(Text *text)
void text_format_fill_ascii(const char **str_p, char **fmt_p, const char type, const int len)
void text_format_fill(const char **str_p, char **fmt_p, const char type, const int len)
void * MEM_new_array_zeroed(size_t len, size_t size, const char *str) ATTR_WARN_UNUSED_RESULT ATTR_ALLOC_SIZE(1