Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'source/blender/editors/space_text')
-rw-r--r--source/blender/editors/space_text/space_text.c12
-rw-r--r--source/blender/editors/space_text/text_autocomplete.c66
-rw-r--r--source/blender/editors/space_text/text_draw.c186
-rw-r--r--source/blender/editors/space_text/text_format.c15
-rw-r--r--source/blender/editors/space_text/text_format_lua.c137
-rw-r--r--source/blender/editors/space_text/text_format_osl.c172
-rw-r--r--source/blender/editors/space_text/text_format_pov.c1245
-rw-r--r--source/blender/editors/space_text/text_format_pov_ini.c523
-rw-r--r--source/blender/editors/space_text/text_format_py.c110
-rw-r--r--source/blender/editors/space_text/text_header.c9
-rw-r--r--source/blender/editors/space_text/text_ops.c307
11 files changed, 1516 insertions, 1266 deletions
diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c
index 506babafb6e..49d5ae06413 100644
--- a/source/blender/editors/space_text/space_text.c
+++ b/source/blender/editors/space_text/space_text.c
@@ -132,16 +132,18 @@ static void text_listener(wmWindow *UNUSED(win),
/* check if active text was changed, no need to redraw if text isn't active
* (reference == NULL) means text was unlinked, should update anyway for this
* case -- no way to know was text active before unlinking or not */
- if (wmn->reference && wmn->reference != st->text)
+ if (wmn->reference && wmn->reference != st->text) {
break;
+ }
switch (wmn->data) {
case ND_DISPLAY:
ED_area_tag_redraw(sa);
break;
case ND_CURSOR:
- if (st->text && st->text == wmn->reference)
+ if (st->text && st->text == wmn->reference) {
text_scroll_to_cursor__area(st, sa, true);
+ }
ED_area_tag_redraw(sa);
break;
@@ -161,16 +163,18 @@ static void text_listener(wmWindow *UNUSED(win),
ED_area_tag_redraw(sa);
break;
case NA_SELECTED:
- if (st->text && st->text == wmn->reference)
+ if (st->text && st->text == wmn->reference) {
text_scroll_to_cursor__area(st, sa, true);
+ }
break;
}
break;
case NC_SPACE:
- if (wmn->data == ND_SPACE_TEXT)
+ if (wmn->data == ND_SPACE_TEXT) {
ED_area_tag_redraw(sa);
+ }
break;
}
}
diff --git a/source/blender/editors/space_text/text_autocomplete.c b/source/blender/editors/space_text/text_autocomplete.c
index e60ac3d16a3..243642b2e8c 100644
--- a/source/blender/editors/space_text/text_autocomplete.c
+++ b/source/blender/editors/space_text/text_autocomplete.c
@@ -56,24 +56,29 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar)
int tgti, *top;
int mval[2] = {0, 0};
- if (!st || !st->text)
+ if (!st || !st->text) {
return 0;
- if (!texttool_text_is_active(st->text))
+ }
+ if (!texttool_text_is_active(st->text)) {
return 0;
+ }
first = texttool_suggest_first();
last = texttool_suggest_last();
/* sel = texttool_suggest_selected(); */ /* UNUSED */
top = texttool_suggest_top();
- if (!last || !first)
+ if (!last || !first) {
return 0;
+ }
/* Count the visible lines to the cursor */
- for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++)
+ for (tmp = st->text->curl, l = -st->top; tmp; tmp = tmp->prev, l++) {
;
- if (l < 0)
+ }
+ if (l < 0) {
return 0;
+ }
text_update_character_width(st);
@@ -90,22 +95,27 @@ int text_do_suggest_select(SpaceText *st, ARegion *ar)
// XXX getmouseco_areawin(mval);
- if (mval[0] < x || x + w < mval[0] || mval[1] < y - h || y < mval[1])
+ if (mval[0] < x || x + w < mval[0] || mval[1] < y - h || y < mval[1]) {
return 0;
+ }
/* Work out which of the items is at the top of the visible list */
- for (i = 0, item = first; i < *top && item->next; i++, item = item->next)
+ for (i = 0, item = first; i < *top && item->next; i++, item = item->next) {
;
+ }
/* Work out the target item index in the visible list */
tgti = (y - mval[1] - 4) / st->lheight_dpi;
- if (tgti < 0 || tgti > SUGG_LIST_SIZE)
+ if (tgti < 0 || tgti > SUGG_LIST_SIZE) {
return 1;
+ }
- for (i = tgti; i > 0 && item->next; i--, item = item->next)
+ for (i = tgti; i > 0 && item->next; i--, item = item->next) {
;
- if (item)
+ }
+ if (item) {
texttool_suggest_select(item);
+ }
return 1;
}
@@ -123,10 +133,12 @@ void text_pop_suggest_list(void)
item = item->next;
i++;
}
- if (i > *top + SUGG_LIST_SIZE - 1)
+ if (i > *top + SUGG_LIST_SIZE - 1) {
*top = i - SUGG_LIST_SIZE + 1;
- else if (i < *top)
+ }
+ else if (i < *top) {
*top = i;
+ }
}
/* -------------------------------------------------------------------- */
@@ -235,10 +247,12 @@ static void get_suggest_prefix(Text *text, int offset)
int i, len;
const char *line;
- if (!text)
+ if (!text) {
return;
- if (!texttool_text_is_active(text))
+ }
+ if (!texttool_text_is_active(text)) {
return;
+ }
line = text->curl->line;
i = text_find_identifier_start(line, text->curc + offset);
@@ -252,14 +266,17 @@ static void confirm_suggestion(Text *text, TextUndoBuf *utxt)
int i, over = 0;
const char *line;
- if (!text)
+ if (!text) {
return;
- if (!texttool_text_is_active(text))
+ }
+ if (!texttool_text_is_active(text)) {
return;
+ }
sel = texttool_suggest_selected();
- if (!sel)
+ if (!sel) {
return;
+ }
line = text->curl->line;
i = text_find_identifier_start(line, text->curc /* - skipleft */);
@@ -324,17 +341,20 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
(void)text;
if (st->doplugins && texttool_text_is_active(st->text)) {
- if (texttool_suggest_first())
+ if (texttool_suggest_first()) {
tools |= TOOL_SUGG_LIST;
- if (texttool_docs_get())
+ }
+ if (texttool_docs_get()) {
tools |= TOOL_DOCUMENT;
+ }
}
switch (event->type) {
case LEFTMOUSE:
if (event->val == KM_PRESS) {
- if (text_do_suggest_select(st, ar))
+ if (text_do_suggest_select(st, ar)) {
swallow = 1;
+ }
else {
if (tools & TOOL_SUGG_LIST) {
texttool_suggest_clear();
@@ -380,8 +400,9 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
texttool_docs_clear();
doc_scroll = 0;
}
- else
+ else {
draw = swallow = 0;
+ }
retval = OPERATOR_CANCELLED;
}
break;
@@ -510,8 +531,9 @@ static int text_autocomplete_modal(bContext *C, wmOperator *op, const wmEvent *e
case UPARROWKEY:
if (event->val == KM_PRESS) {
if (tools & TOOL_DOCUMENT) {
- if (doc_scroll > 0)
+ if (doc_scroll > 0) {
doc_scroll--;
+ }
swallow = 1;
draw = 1;
}
diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c
index b2c5f42adb4..cdd691fe879 100644
--- a/source/blender/editors/space_text/text_draw.c
+++ b/source/blender/editors/space_text/text_draw.c
@@ -204,10 +204,12 @@ void wrap_offset(
*offl = *offc = 0;
- if (!st->text)
+ if (!st->text) {
return;
- if (!st->wordwrap)
+ }
+ if (!st->wordwrap) {
return;
+ }
text = st->text;
@@ -219,9 +221,10 @@ void wrap_offset(
/* Line before top */
if (linep == linein) {
- if (lines <= i)
+ if (lines <= i) {
/* no visible part of line */
return;
+ }
}
if (i - lines < 0) {
@@ -250,8 +253,9 @@ void wrap_offset(
ch = linep->line[j];
if (ch == '\t') {
chars = st->tabnumber - i % st->tabnumber;
- if (linep == linein && i < cursin)
+ if (linep == linein && i < cursin) {
cursin += chars - 1;
+ }
ch = ' ';
}
else {
@@ -281,14 +285,16 @@ void wrap_offset(
else if (ch == ' ' || ch == '-') {
end = i + 1;
chop = 0;
- if (linep == linein && i >= cursin)
+ if (linep == linein && i >= cursin) {
return;
+ }
}
i += columns;
}
}
- if (linep == linein)
+ if (linep == linein) {
break;
+ }
linep = linep->next;
}
}
@@ -302,10 +308,12 @@ void wrap_offset_in_line(
*offl = *offc = 0;
- if (!st->text)
+ if (!st->text) {
return;
- if (!st->wordwrap)
+ }
+ if (!st->wordwrap) {
return;
+ }
max = wrap_width(st, ar);
@@ -322,12 +330,14 @@ void wrap_offset_in_line(
ch = linein->line[j];
if (ch == '\t') {
chars = st->tabnumber - i % st->tabnumber;
- if (i < cursin)
+ if (i < cursin) {
cursin += chars - 1;
+ }
ch = ' ';
}
- else
+ else {
chars = 1;
+ }
while (chars--) {
if (i + columns - start > max) {
@@ -352,8 +362,9 @@ void wrap_offset_in_line(
else if (ch == ' ' || ch == '-') {
end = i + 1;
chop = 0;
- if (i >= cursin)
+ if (i >= cursin) {
return;
+ }
}
i += columns;
}
@@ -365,10 +376,12 @@ int text_get_char_pos(const SpaceText *st, const char *line, int cur)
int a = 0, i;
for (i = 0; i < cur && line[i]; i += BLI_str_utf8_size_safe(line + i)) {
- if (line[i] == '\t')
+ if (line[i] == '\t') {
a += st->tabnumber - a % st->tabnumber;
- else
+ }
+ else {
a += BLI_str_utf8_char_width_safe(line + i);
+ }
}
return a;
}
@@ -379,15 +392,18 @@ static const char *txt_utf8_forward_columns(const char *str, int columns, int *p
const char *p = str;
while (*p) {
col = BLI_str_utf8_char_width(p);
- if (columns - col < 0)
+ if (columns - col < 0) {
break;
+ }
columns -= col;
p += BLI_str_utf8_size_safe(p);
- if (columns == 0)
+ if (columns == 0) {
break;
+ }
}
- if (padding)
+ if (padding) {
*padding = *p ? columns : 0;
+ }
return p;
}
@@ -414,8 +430,9 @@ static int text_draw_wrapped(const SpaceText *st,
flatten_string(st, &fs, str);
str = fs.buf;
max = w / st->cwidth;
- if (max < 8)
+ if (max < 8) {
max = 8;
+ }
basex = x;
lines = 1;
@@ -444,8 +461,9 @@ static int text_draw_wrapped(const SpaceText *st,
/* Draw the visible portion of text on the overshot line */
for (a = fstart, ma = mstart; ma < mend; a++, ma += BLI_str_utf8_size_safe(str + ma)) {
if (use_syntax) {
- if (fmt_prev != format[a])
+ if (fmt_prev != format[a]) {
format_draw_color(tdc, fmt_prev = format[a]);
+ }
}
x += text_font_draw_character_utf8(tdc, x, y, str + ma);
fpos++;
@@ -458,8 +476,9 @@ static int text_draw_wrapped(const SpaceText *st,
mend = txt_utf8_forward_columns(str + mend, max, &padding) - str;
end = (wrap += max - padding);
- if (y <= clip_min_y)
+ if (y <= clip_min_y) {
break;
+ }
}
else if (str[mi] == ' ' || str[mi] == '-') {
wrap = i + 1;
@@ -471,8 +490,9 @@ static int text_draw_wrapped(const SpaceText *st,
for (a = fstart, ma = mstart; str[ma] && y > clip_min_y;
a++, ma += BLI_str_utf8_size_safe(str + ma)) {
if (use_syntax) {
- if (fmt_prev != format[a])
+ if (fmt_prev != format[a]) {
format_draw_color(tdc, fmt_prev = format[a]);
+ }
}
x += text_font_draw_character_utf8(tdc, x, y, str + ma);
@@ -506,12 +526,14 @@ static void text_draw(const SpaceText *st,
padding = w - cshift;
in = str;
}
- else if (format)
+ else if (format) {
format++;
+ }
}
if (in) {
- if (maxwidth && w + columns > cshift + maxwidth)
+ if (maxwidth && w + columns > cshift + maxwidth) {
break;
+ }
amount++;
}
@@ -530,8 +552,9 @@ static void text_draw(const SpaceText *st,
char fmt_prev = 0xff;
for (a = 0; a < amount; a++) {
- if (format[a] != fmt_prev)
+ if (format[a] != fmt_prev) {
format_draw_color(tdc, fmt_prev = format[a]);
+ }
x += text_font_draw_character_utf8(tdc, x, y, in + str_shift);
str_shift += BLI_str_utf8_size_safe(in + str_shift);
}
@@ -577,8 +600,9 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
int full_update = 0, nlines = 0;
Text *txt = st->text;
- if (!st->drawcache)
+ if (!st->drawcache) {
text_drawcache_init(st);
+ }
text_update_character_width(st);
@@ -618,10 +642,12 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
nlines = BLI_listbase_count(&txt->lines);
size = sizeof(int) * nlines;
- if (fp)
+ if (fp) {
fp = MEM_reallocN(fp, size);
- else
+ }
+ else {
fp = MEM_callocN(size, "text drawcache line_height");
+ }
drawcache->valid_tail = drawcache->valid_head = 0;
old_tail = fp + drawcache->nlines - drawcache->valid_tail;
@@ -630,8 +656,9 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
drawcache->total_lines = 0;
- if (st->showlinenrs)
+ if (st->showlinenrs) {
st->linenrs_tot = integer_digits_i(nlines);
+ }
while (line) {
if (drawcache->valid_head) { /* we're inside valid head lines */
@@ -664,8 +691,9 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
if (full_update || drawcache->update_flag) {
nlines = BLI_listbase_count(&txt->lines);
- if (st->showlinenrs)
+ if (st->showlinenrs) {
st->linenrs_tot = integer_digits_i(nlines);
+ }
}
drawcache->total_lines = nlines;
@@ -692,8 +720,9 @@ static void text_update_drawcache(SpaceText *st, ARegion *ar)
void text_drawcache_tag_update(SpaceText *st, int full)
{
/* this happens if text editor ops are caled from python */
- if (st == NULL)
+ if (st == NULL) {
return;
+ }
if (st->drawcache) {
DrawCache *drawcache = (DrawCache *)st->drawcache;
@@ -721,10 +750,12 @@ void text_drawcache_tag_update(SpaceText *st, int full)
/* quick cache recalculation is also used in delete operator,
* which could merge lines which are adjacent to current selection lines
* expand recalculate area to this lines */
- if (drawcache->valid_head > 0)
+ if (drawcache->valid_head > 0) {
drawcache->valid_head--;
- if (drawcache->valid_tail > 0)
+ }
+ if (drawcache->valid_tail > 0) {
drawcache->valid_tail--;
+ }
}
else {
drawcache->valid_head = 0;
@@ -740,8 +771,9 @@ void text_free_caches(SpaceText *st)
DrawCache *drawcache = (DrawCache *)st->drawcache;
if (drawcache) {
- if (drawcache->line_height)
+ if (drawcache->line_height) {
MEM_freeN(drawcache->line_height);
+ }
MEM_freeN(drawcache);
}
@@ -804,8 +836,9 @@ int text_get_span_wrap(const SpaceText *st, ARegion *ar, TextLine *from, TextLin
/* Look forwards */
while (tmp) {
- if (tmp == to)
+ if (tmp == to) {
return ret;
+ }
ret += text_get_visible_lines(st, ar, tmp->line);
tmp = tmp->next;
}
@@ -876,8 +909,9 @@ static void calc_text_rcts(SpaceText *st, ARegion *ar, rcti *scroll, rcti *back)
CLAMP(st->txtbar.ymax, pix_bottom_margin, ar->winy - pix_top_margin);
st->pix_per_line = (pix_available > 0) ? (float)ltexth / pix_available : 0;
- if (st->pix_per_line < 0.1f)
+ if (st->pix_per_line < 0.1f) {
st->pix_per_line = 0.1f;
+ }
curl_off = text_get_span_wrap(st, ar, st->text->lines.first, st->text->curl);
sell_off = text_get_span_wrap(st, ar, st->text->lines.first, st->text->sell);
@@ -1098,16 +1132,19 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
const int lheight = st->lheight_dpi + TXT_LINE_SPACING;
const int margin_x = 2;
- if (!st->text)
+ if (!st->text) {
return;
- if (!texttool_text_is_active(st->text))
+ }
+ if (!texttool_text_is_active(st->text)) {
return;
+ }
first = texttool_suggest_first();
last = texttool_suggest_last();
- if (!first || !last)
+ if (!first || !last) {
return;
+ }
text_pop_suggest_list();
sel = texttool_suggest_selected();
@@ -1129,8 +1166,9 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
boxw = SUGG_LIST_WIDTH * st->cwidth + 20;
boxh = SUGG_LIST_SIZE * lheight + 8;
- if (x + boxw > ar->winx)
+ if (x + boxw > ar->winx) {
x = MAX2(0, ar->winx - boxw);
+ }
/* not needed but stands out nicer */
UI_draw_box_shadow(220, x, y - boxh, x + boxw, y);
@@ -1147,8 +1185,9 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
immUnbindProgram();
/* Set the top 'item' of the visible list */
- for (i = 0, item = first; i < *top && item->next; i++, item = item->next)
+ for (i = 0, item = first; i < *top && item->next; i++, item = item->next) {
;
+ }
for (i = 0; i < SUGG_LIST_SIZE && item; i++, item = item->next) {
int len = txt_utf8_forward_columns(item->name, SUGG_LIST_WIDTH, NULL) - item->name;
@@ -1173,8 +1212,9 @@ static void draw_suggestion_list(const SpaceText *st, const TextDrawContext *tdc
format_draw_color(tdc, item->type);
text_draw(st, tdc, str, 0, 0, x + margin_x, y - 1, NULL);
- if (item == last)
+ if (item == last) {
break;
+ }
}
}
@@ -1307,8 +1347,9 @@ static void draw_text_decoration(SpaceText *st, ARegion *ar)
y += TXT_LINE_SPACING;
w = st->cwidth;
- if (ch == '\t')
+ if (ch == '\t') {
w *= st->tabnumber - (vselc + st->left) % st->tabnumber;
+ }
immRecti(pos, x, y - lheight - 1, x + w, y - lheight + 1);
}
@@ -1332,16 +1373,19 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
char ch;
// showsyntax must be on or else the format string will be null
- if (!text->curl || !st->showsyntax)
+ if (!text->curl || !st->showsyntax) {
return;
+ }
startl = text->curl;
startc = text->curc;
b = text_check_bracket(startl->line[startc]);
- if (b == 0 && startc > 0)
+ if (b == 0 && startc > 0) {
b = text_check_bracket(startl->line[--startc]);
- if (b == 0)
+ }
+ if (b == 0) {
return;
+ }
linep = startl;
c = startc;
@@ -1353,8 +1397,9 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
/* Don't highlight backets if syntax HL is off or bracket in string or comment. */
if (!linep->format || linep->format[fc] == FMT_TYPE_STRING ||
- linep->format[fc] == FMT_TYPE_COMMENT)
+ linep->format[fc] == FMT_TYPE_COMMENT) {
return;
+ }
if (b > 0) {
/* opening bracket, search forward for close */
@@ -1380,8 +1425,9 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
fc++;
c += BLI_str_utf8_size_safe(linep->line + c);
}
- if (endl)
+ if (endl) {
break;
+ }
linep = linep->next;
c = 0;
fc = 0;
@@ -1390,8 +1436,9 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
else {
/* closing bracket, search backward for open */
fc--;
- if (c > 0)
+ if (c > 0) {
c -= linep->line + c - BLI_str_prev_char_utf8(linep->line + c);
+ }
while (linep) {
while (fc >= 0) {
if (linep->format && linep->format[fc] != FMT_TYPE_STRING &&
@@ -1410,27 +1457,34 @@ static void draw_brackets(const SpaceText *st, const TextDrawContext *tdc, ARegi
}
}
fc--;
- if (c > 0)
+ if (c > 0) {
c -= linep->line + c - BLI_str_prev_char_utf8(linep->line + c);
+ }
}
- if (endl)
+ if (endl) {
break;
+ }
linep = linep->prev;
if (linep) {
- if (linep->format)
+ if (linep->format) {
fc = strlen(linep->format) - 1;
- else
+ }
+ else {
fc = -1;
- if (linep->len)
+ }
+ if (linep->len) {
c = BLI_str_prev_char_utf8(linep->line + linep->len) - linep->line;
- else
+ }
+ else {
fc = -1;
+ }
}
}
}
- if (!endl || endc == -1)
+ if (!endl || endc == -1) {
return;
+ }
UI_FontThemeColor(tdc->font_id, TH_HILITE);
x = st->showlinenrs ? TXT_OFFSET + TEXTXLOC : TXT_OFFSET;
@@ -1480,8 +1534,9 @@ void draw_text_main(SpaceText *st, ARegion *ar)
int margin_column_x;
/* if no text, nothing to do */
- if (!text)
+ if (!text) {
return;
+ }
/* dpi controlled line height and font size */
st->lheight_dpi = (U.widget_unit * st->lheight) / 20;
@@ -1498,8 +1553,9 @@ void draw_text_main(SpaceText *st, ARegion *ar)
text_update_drawcache(st, ar);
/* make sure all the positional pointers exist */
- if (!text->curl || !text->sell || !text->lines.first || !text->lines.last)
+ if (!text->curl || !text->sell || !text->lines.first || !text->lines.last) {
txt_clean_text(text);
+ }
/* update rects for scroll */
calc_text_rcts(st, ar, &scroll, &back); /* scroll will hold the entire bar size */
@@ -1509,8 +1565,9 @@ void draw_text_main(SpaceText *st, ARegion *ar)
tmp = text->lines.first;
lineno = 0;
for (i = 0; i < st->top && tmp; i++) {
- if (st->showsyntax && !tmp->format)
+ if (st->showsyntax && !tmp->format) {
tft->format_line(st, tmp, false);
+ }
if (st->wordwrap) {
int lines = text_get_visible_lines_no(st, lineno);
@@ -1563,8 +1620,9 @@ void draw_text_main(SpaceText *st, ARegion *ar)
UI_FontThemeColor(tdc.font_id, TH_TEXT);
for (i = 0; y > clip_min_y && i < st->viewlines && tmp; i++, tmp = tmp->next) {
- if (st->showsyntax && !tmp->format)
+ if (st->showsyntax && !tmp->format) {
tft->format_line(st, tmp, false);
+ }
if (st->showlinenrs && !wrap_skip) {
/* draw line number */
@@ -1654,8 +1712,9 @@ void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
Text *text;
int i, x, winx = ar->winx;
- if (ELEM(NULL, st, st->text, st->text->curl))
+ if (ELEM(NULL, st, st->text, st->text->curl)) {
return;
+ }
text = st->text;
@@ -1704,10 +1763,12 @@ void text_scroll_to_cursor(SpaceText *st, ARegion *ar, const bool center)
}
}
- if (st->top < 0)
+ if (st->top < 0) {
st->top = 0;
- if (st->left < 0)
+ }
+ if (st->left < 0) {
st->left = 0;
+ }
st->scroll_accum[0] = 0.0f;
st->scroll_accum[1] = 0.0f;
@@ -1718,8 +1779,9 @@ void text_scroll_to_cursor__area(SpaceText *st, ScrArea *sa, const bool center)
{
ARegion *ar;
- if (ELEM(NULL, st, st->text, st->text->curl))
+ if (ELEM(NULL, st, st->text, st->text->curl)) {
return;
+ }
ar = BKE_area_find_region_type(sa, RGN_TYPE_WINDOW);
diff --git a/source/blender/editors/space_text/text_format.c b/source/blender/editors/space_text/text_format.c
index 0a885fc5875..8c102dc009e 100644
--- a/source/blender/editors/space_text/text_format.c
+++ b/source/blender/editors/space_text/text_format.c
@@ -79,8 +79,9 @@ int flatten_string(const SpaceText *st, FlattenString *fs, const char *in)
i = st->tabnumber - (total % st->tabnumber);
total += i;
- while (i--)
+ while (i--) {
flatten_string_append(fs, " ", r, 1);
+ }
in++;
}
@@ -99,10 +100,12 @@ int flatten_string(const SpaceText *st, FlattenString *fs, const char *in)
void flatten_string_free(FlattenString *fs)
{
- if (fs->buf != fs->fixedbuf)
+ if (fs->buf != fs->fixedbuf) {
MEM_freeN(fs->buf);
- if (fs->accum != fs->fixedaccum)
+ }
+ if (fs->accum != fs->fixedaccum) {
MEM_freeN(fs->accum);
+ }
}
/* takes a string within fs->buf and returns its length */
@@ -121,14 +124,16 @@ int text_check_format_len(TextLine *line, unsigned int len)
if (strlen(line->format) < len) {
MEM_freeN(line->format);
line->format = MEM_mallocN(len + 2, "SyntaxFormat");
- if (!line->format)
+ if (!line->format) {
return 0;
+ }
}
}
else {
line->format = MEM_mallocN(len + 2, "SyntaxFormat");
- if (!line->format)
+ if (!line->format) {
return 0;
+ }
}
return 1;
diff --git a/source/blender/editors/space_text/text_format_lua.c b/source/blender/editors/space_text/text_format_lua.c
index b82e8aec122..347d46a4234 100644
--- a/source/blender/editors/space_text/text_format_lua.c
+++ b/source/blender/editors/space_text/text_format_lua.c
@@ -48,31 +48,33 @@ static int txtfmt_lua_find_keyword(const char *string)
/* Keep aligned args for readability. */
/* clang-format off */
- if (STR_LITERAL_STARTSWITH(string, "and", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "break", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "do", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "end", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "function", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "in", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "local", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "not", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "or", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "repeat", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "then", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "until", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "and", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "do", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "end", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "function", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "in", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "local", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "not", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "or", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "repeat", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "then", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "until", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -94,41 +96,43 @@ static int txtfmt_lua_find_specialvar(const char *string)
/* Keep aligned args for readability. */
/* clang-format off */
- if (STR_LITERAL_STARTSWITH(string, "assert", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "collectgarbage", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "dofile", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "error", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "_G", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "getfenv", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "getmetatable", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "__index", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ipairs", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "load", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "loadfile", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "loadstring", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "next", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pairs", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pcall", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "print", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rawequal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rawget", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rawset", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "select", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "setfenv", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "setmetatable", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tonumber", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tostring", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "type", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "unpack", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "_VERSION", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "xpcall", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "assert", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "collectgarbage", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "dofile", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "error", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "_G", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "getfenv", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "getmetatable", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "__index", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ipairs", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "load", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "loadfile", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "loadstring", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "next", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pairs", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pcall", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "print", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rawequal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rawget", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rawset", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "select", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "setfenv", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "setmetatable", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tonumber", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tostring", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "type", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "unpack", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "_VERSION", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "xpcall", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -136,20 +140,25 @@ static int txtfmt_lua_find_bool(const char *string)
{
int i, len;
- if (STR_LITERAL_STARTSWITH(string, "nil", len))
+ if (STR_LITERAL_STARTSWITH(string, "nil", len)) {
i = len;
- else if (STR_LITERAL_STARTSWITH(string, "true", len))
+ }
+ else if (STR_LITERAL_STARTSWITH(string, "true", len)) {
i = len;
- else if (STR_LITERAL_STARTSWITH(string, "false", len))
+ }
+ else if (STR_LITERAL_STARTSWITH(string, "false", len)) {
i = len;
- else
+ }
+ else {
i = 0;
+ }
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -160,9 +169,10 @@ static char txtfmt_lua_format_identifier(const char *str)
/* Keep aligned args for readability. */
/* clang-format off */
- if ((txtfmt_lua_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL;
- else if ((txtfmt_lua_find_keyword(str)) != -1) fmt = FMT_TYPE_KEYWORD;
- else fmt = FMT_TYPE_DEFAULT;
+ if ((txtfmt_lua_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
+ } else if ((txtfmt_lua_find_keyword(str)) != -1) { fmt = FMT_TYPE_KEYWORD;
+ } else { fmt = FMT_TYPE_DEFAULT;
+}
/* clang-format on */
@@ -211,8 +221,9 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_
*fmt = prev;
fmt++;
str++;
- if (*str == '\0')
+ if (*str == '\0') {
break;
+ }
*fmt = prev;
fmt++;
str += BLI_str_utf8_size_safe(str);
@@ -236,8 +247,9 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_
}
else {
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
- if (*str == find)
+ if (*str == find) {
cont = 0;
+ }
*fmt = FMT_TYPE_STRING;
}
@@ -304,8 +316,9 @@ static void txtfmt_lua_format_line(SpaceText *st, TextLine *line, const bool do_
/* Special vars(v) or built-in keywords(b) */
/* keep in sync with 'txtfmt_osl_format_identifier()' */
- if ((i = txtfmt_lua_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL;
- else if ((i = txtfmt_lua_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD;
+ if ((i = txtfmt_lua_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
+ } else if ((i = txtfmt_lua_find_keyword(str)) != -1) { prev = FMT_TYPE_KEYWORD;
+}
/* clang-format on */
diff --git a/source/blender/editors/space_text/text_format_osl.c b/source/blender/editors/space_text/text_format_osl.c
index 8473b3f80ce..fb9ddcb09cb 100644
--- a/source/blender/editors/space_text/text_format_osl.c
+++ b/source/blender/editors/space_text/text_format_osl.c
@@ -40,37 +40,39 @@ static int txtfmt_osl_find_builtinfunc(const char *string)
/* list is from
* https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf
*/
- if (STR_LITERAL_STARTSWITH(string, "break", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "closure", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "color", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "continue", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "do", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "emit", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "float", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "illuminance", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "illuminate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "int", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "matrix", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "normal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "output", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "point", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "public", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "string", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "struct", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vector", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "void", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "closure", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "color", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "continue", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "do", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "emit", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "float", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "illuminance", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "illuminate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "int", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "matrix", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "normal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "output", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "point", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "public", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "string", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "struct", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vector", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "void", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -84,49 +86,51 @@ static int txtfmt_osl_find_reserved(const char *string)
/* list is from...
* https://github.com/imageworks/OpenShadingLanguage/raw/master/src/doc/osl-languagespec.pdf
*/
- if (STR_LITERAL_STARTSWITH(string, "bool", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "case", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "catch", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "char", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "const", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "delete", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "default", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "double", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "enum", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "extern", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "friend", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "goto", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "inline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "long", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "new", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "operator", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "private", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "protected", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "short", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "signed", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sizeof", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "static", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "switch", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "template", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "this", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "throw", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "true", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "try", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "typedef", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uniform", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "union", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "unsigned", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "varying", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "virtual", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "volatile", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "bool", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "case", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "catch", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "char", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "const", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "delete", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "default", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "double", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "enum", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "extern", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "false", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "friend", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "goto", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "inline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "long", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "new", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "operator", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "private", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "protected", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "short", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "signed", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sizeof", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "static", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "switch", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "template", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "this", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "throw", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "true", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "try", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "typedef", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uniform", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "union", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "unsigned", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "varying", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "virtual", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "volatile", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -145,17 +149,19 @@ static int txtfmt_osl_find_specialvar(const char *string)
/* clang-format off */
/* OSL shader types */
- if (STR_LITERAL_STARTSWITH(string, "shader", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "surface", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "volume", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "shader", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "surface", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "volume", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "displacement", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -183,11 +189,12 @@ static char txtfmt_osl_format_identifier(const char *str)
/* Keep aligned args for readability. */
/* clang-format off */
- if ((txtfmt_osl_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL;
- else if ((txtfmt_osl_find_builtinfunc(str)) != -1) fmt = FMT_TYPE_KEYWORD;
- else if ((txtfmt_osl_find_reserved(str)) != -1) fmt = FMT_TYPE_RESERVED;
- else if ((txtfmt_osl_find_preprocessor(str)) != -1) fmt = FMT_TYPE_DIRECTIVE;
- else fmt = FMT_TYPE_DEFAULT;
+ if ((txtfmt_osl_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
+ } else if ((txtfmt_osl_find_builtinfunc(str)) != -1) { fmt = FMT_TYPE_KEYWORD;
+ } else if ((txtfmt_osl_find_reserved(str)) != -1) { fmt = FMT_TYPE_RESERVED;
+ } else if ((txtfmt_osl_find_preprocessor(str)) != -1) { fmt = FMT_TYPE_DIRECTIVE;
+ } else { fmt = FMT_TYPE_DEFAULT;
+}
/* clang-format on */
@@ -236,8 +243,9 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const bool do_
*fmt = prev;
fmt++;
str++;
- if (*str == '\0')
+ if (*str == '\0') {
break;
+ }
*fmt = prev;
fmt++;
str += BLI_str_utf8_size_safe(str);
@@ -261,8 +269,9 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const bool do_
}
else {
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
- if (*str == find)
+ if (*str == find) {
cont = 0;
+ }
*fmt = FMT_TYPE_STRING;
}
@@ -314,10 +323,11 @@ static void txtfmt_osl_format_line(SpaceText *st, TextLine *line, const bool do_
/* Special vars(v) or built-in keywords(b) */
/* keep in sync with 'txtfmt_osl_format_identifier()' */
- if ((i = txtfmt_osl_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL;
- else if ((i = txtfmt_osl_find_builtinfunc(str)) != -1) prev = FMT_TYPE_KEYWORD;
- else if ((i = txtfmt_osl_find_reserved(str)) != -1) prev = FMT_TYPE_RESERVED;
- else if ((i = txtfmt_osl_find_preprocessor(str)) != -1) prev = FMT_TYPE_DIRECTIVE;
+ if ((i = txtfmt_osl_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
+ } else if ((i = txtfmt_osl_find_builtinfunc(str)) != -1) { prev = FMT_TYPE_KEYWORD;
+ } else if ((i = txtfmt_osl_find_reserved(str)) != -1) { prev = FMT_TYPE_RESERVED;
+ } else if ((i = txtfmt_osl_find_preprocessor(str)) != -1) { prev = FMT_TYPE_DIRECTIVE;
+}
/* clang-format on */
diff --git a/source/blender/editors/space_text/text_format_pov.c b/source/blender/editors/space_text/text_format_pov.c
index 8064f4e69e2..a5e1a3845cf 100644
--- a/source/blender/editors/space_text/text_format_pov.c
+++ b/source/blender/editors/space_text/text_format_pov.c
@@ -48,39 +48,40 @@ static int txtfmt_pov_find_keyword(const char *string)
int i, len;
/* Language Directives */
- if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "persistent", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "statistics", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "version", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "warning", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "declare", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "default", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "include", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "append", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "debug", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "break", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "error", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fclose", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fopen", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ifndef", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "patch", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "local", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "macro", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "range", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "read", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "render", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "switch", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "undef", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "write", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "case", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "end", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "persistent", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "statistics", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "version", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "warning", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "declare", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "default", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "include", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "append", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "debug", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "error", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fclose", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fopen", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ifndef", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "patch", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "local", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "macro", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "range", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "read", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "render", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "switch", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "undef", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "write", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "case", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "end", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
@@ -100,145 +101,146 @@ static int txtfmt_pov_find_reserved_keywords(const char *string)
/* clang-format off */
/* Float Functions */
- if (STR_LITERAL_STARTSWITH(string, "conserve_energy", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_intersections", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "dimension_size", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bitwise_and", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bitwise_or", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bitwise_xor", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "file_exists", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "precompute", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "dimensions", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "clipped_by", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "shadowless", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "turb_depth", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "reciprocal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "quaternion", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "phong_size", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tesselate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "save_file", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "load_file", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_trace", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "transform", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "translate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "direction", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "roughness", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "metallic", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gts_load", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gts_save", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "location", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "altitude", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "function", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "evaluate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "inverse", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "collect", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "target", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "albedo", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rotate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "matrix", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "look_at", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "jitter", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "angle", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "right", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "scale", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "child", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "crand", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "blink", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "defined", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "degrees", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "inside", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "radians", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vlength", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "select", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "floor", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "strcmp", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "strlen", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tessel", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sturm", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "abs", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "acosh", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "prod", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "with", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "acos", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "asc", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "asinh", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "asin", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "atan2", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "atand", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "atanh", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "atan", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ceil", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "warp", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cosh", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "log", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "min", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mod", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pow", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rand", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "seed", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "form", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sinh", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sqrt", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tanh", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vdot", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sin", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sqr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sum", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pwr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tan", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "val", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cos", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "div", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "exp", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "int", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sky", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "up", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ln", len)) i = len;
+ if (STR_LITERAL_STARTSWITH(string, "conserve_energy", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_intersections", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "dimension_size", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bitwise_and", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bitwise_or", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bitwise_xor", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "file_exists", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "precompute", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "dimensions", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "clipped_by", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "shadowless", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "turb_depth", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "reciprocal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "quaternion", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "phong_size", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tesselate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "save_file", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "load_file", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_trace", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "transform", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "translate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "direction", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "roughness", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "metallic", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gts_load", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gts_save", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "location", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "altitude", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "function", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "evaluate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "inverse", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "collect", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "target", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "albedo", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rotate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "matrix", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "look_at", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "jitter", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "angle", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "right", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "scale", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "child", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "crand", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "blink", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "defined", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "degrees", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "inside", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "radians", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vlength", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "select", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "floor", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "strcmp", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "strlen", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tessel", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sturm", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "abs", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "acosh", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "prod", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "with", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "acos", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "asc", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "asinh", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "asin", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "atan2", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "atand", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "atanh", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "atan", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ceil", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "warp", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cosh", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "log", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "min", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mod", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pow", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rand", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "seed", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "form", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sinh", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sqrt", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tanh", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vdot", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sin", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sqr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sum", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pwr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tan", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "val", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cos", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "div", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "exp", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "int", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sky", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "up", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ln", len)) { i = len;
/* Color Identifiers */
- else if (STR_LITERAL_STARTSWITH(string, "transmit", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "filter", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "srgbft", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "srgbf", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "srgbt", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rgbft", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gamma", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "green", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "blue", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gray", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "srgb", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sRGB", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "SRGB", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rgbf", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rgbt", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rgb", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "red", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "transmit", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "filter", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "srgbft", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "srgbf", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "srgbt", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rgbft", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gamma", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "green", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "blue", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gray", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "srgb", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sRGB", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "SRGB", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rgbf", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rgbt", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rgb", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "red", len)) { i = len;
/* Color Spaces */
- else if (STR_LITERAL_STARTSWITH(string, "pov", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hsl", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hsv", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "xyl", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "xyv", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pov", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hsl", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hsv", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "xyl", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "xyv", len)) { i = len;
/* Vector Functions */
- else if (STR_LITERAL_STARTSWITH(string, "vaxis_rotate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vturbulence", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "min_extent", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vnormalize", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_extent", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vrotate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vcross", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "trace", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vaxis_rotate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vturbulence", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "min_extent", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vnormalize", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_extent", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vrotate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vcross", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "trace", len)) { i = len;
/* String Functions */
- else if (STR_LITERAL_STARTSWITH(string, "file_time", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "datetime", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "concat", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "strlwr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "strupr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "substr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vstr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "chr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "str", len)) i = len;
- else i = 0;
+ } else if (STR_LITERAL_STARTSWITH(string, "file_time", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "datetime", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "concat", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "strlwr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "strupr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "substr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vstr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "chr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "str", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
@@ -259,221 +261,222 @@ static int txtfmt_pov_find_reserved_builtins(const char *string)
/* clang-format off */
/* Language Keywords */
- if (STR_LITERAL_STARTSWITH(string, "reflection_exponent", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "area_illumination", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "all_intersections", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cutaway_textures", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "smooth_triangle", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "lommel_seeliger", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "falloff_angle", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "aa_threshold", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hypercomplex", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "major_radius", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_distance", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_iteration", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "colour_space", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "color_space", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "iridescence", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "subsurface", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "scattering", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "absorption", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "water_level", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "reflection", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_extent", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "oren_nayar", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "refraction", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hierarchy", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "radiosity", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tolerance", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "interior", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "toroidal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "emission", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "material", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "internal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "photons", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "arc_angle", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "minnaert", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "texture", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "array", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "black_hole", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "component", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "composite", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "coords", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cube", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "dist_exp", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "exterior", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "file_gamma", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "flatness", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "planet", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "screw", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "keep", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "flip", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "move", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "roll", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "look_at", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "metric", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "offset", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "orientation", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pattern", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "precision", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "repeat", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bend", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "size", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "alpha", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "slice", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "smooth", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "solid", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "all", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "now", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pot", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "type", len)) i = len;
+ if (STR_LITERAL_STARTSWITH(string, "reflection_exponent", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "area_illumination", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "all_intersections", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cutaway_textures", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "smooth_triangle", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "lommel_seeliger", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "falloff_angle", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "aa_threshold", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hypercomplex", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "major_radius", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_distance", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_iteration", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "colour_space", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "color_space", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "iridescence", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "subsurface", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "scattering", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "absorption", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "water_level", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "reflection", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_extent", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "oren_nayar", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "refraction", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hierarchy", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "radiosity", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tolerance", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "interior", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "toroidal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "emission", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "material", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "internal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "photons", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "arc_angle", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "minnaert", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "texture", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "array", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "black_hole", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "component", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "composite", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "coords", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cube", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "dist_exp", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "exterior", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "file_gamma", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "flatness", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "planet", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "screw", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "keep", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "flip", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "move", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "roll", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "look_at", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "metric", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "offset", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "orientation", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pattern", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "precision", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "repeat", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bend", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "size", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "alpha", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "slice", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "smooth", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "solid", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "all", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "now", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pot", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "type", len)) { i = len;
/* Animation Options */
- else if (STR_LITERAL_STARTSWITH(string, "global_settings", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "input_file_name", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "initial_clock", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "initial_frame", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "image_height", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "image_width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "clock", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "global_settings", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "input_file_name", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "initial_clock", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "initial_frame", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "image_height", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "image_width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "clock", len)) { i = len;
/* Spline Identifiers */
- else if (STR_LITERAL_STARTSWITH(string, "extended_x_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "general_x_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "quadratic_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "basic_x_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "natural_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "linear_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bezier_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "akima_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cubic_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sor_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tcb_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "linear_sweep", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "conic_sweep", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "b_spline", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "extended_x_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "general_x_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "quadratic_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "basic_x_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "natural_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "linear_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bezier_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "akima_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cubic_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sor_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tcb_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "linear_sweep", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "conic_sweep", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "b_spline", len)) { i = len;
/* Patterns */
- else if (STR_LITERAL_STARTSWITH(string, "pigment_pattern", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "image_pattern", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "density_file", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cylindrical", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "proportion", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "triangular", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "image_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "proximity", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "spherical", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bump_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "wrinkles", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "average", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "voronoi", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "masonry", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "binary", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "boxed", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bozo", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "brick", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bumps", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cells", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "checker", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "crackle", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "dents", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "facets", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gradient", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "granite", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hexagon", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "julia", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "leopard", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "magnet", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mandel", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "marble", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "onion", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pavement", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "planar", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "quilted", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "radial", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ripples", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "slope", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "spiral1", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "spiral2", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "spotted", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "square", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tile2", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tiling", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tiles", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "waves", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "wood", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "agate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "aoi", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pigment_pattern", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "image_pattern", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "density_file", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cylindrical", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "proportion", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "triangular", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "image_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "proximity", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "spherical", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bump_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "wrinkles", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "average", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "voronoi", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "masonry", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "binary", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "boxed", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bozo", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "brick", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bumps", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cells", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "checker", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "crackle", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "dents", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "facets", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gradient", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "granite", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hexagon", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "julia", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "leopard", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "magnet", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mandel", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "marble", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "onion", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pavement", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "planar", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "quilted", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "radial", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ripples", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "slope", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "spiral1", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "spiral2", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "spotted", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "square", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tile2", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tiling", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tiles", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "waves", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "wood", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "agate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "aoi", len)) { i = len;
/* Objects */
- else if (STR_LITERAL_STARTSWITH(string, "superellipsoid", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bicubic_patch", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "julia_fractal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "height_field", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cubic_spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sphere_sweep", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "light_group", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "light_source", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "intersection", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "isosurface", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "background", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sky_sphere", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cylinder", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "difference", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "brilliance", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "parametric", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "interunion", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "intermerge", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "polynomial", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "displace", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "specular", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ambient", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "diffuse", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "polygon", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "quadric", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "quartic", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "rainbow", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sphere", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "spline", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "prism", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "camera", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "galley", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "phong", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cone", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "blob", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "box", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "disc", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fog", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "lathe", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "merge", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mesh2", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mesh", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "object", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ovus", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "lemon", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "plane", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "poly", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "irid", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sor", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "text", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "torus", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "triangle", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "union", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "colour", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "color", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "media", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "superellipsoid", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bicubic_patch", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "julia_fractal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "height_field", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cubic_spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sphere_sweep", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "light_group", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "light_source", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "intersection", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "isosurface", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "background", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sky_sphere", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cylinder", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "difference", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "brilliance", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "parametric", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "interunion", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "intermerge", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "polynomial", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "displace", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "specular", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ambient", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "diffuse", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "polygon", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "quadric", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "quartic", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "rainbow", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sphere", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "spline", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "prism", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "camera", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "galley", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "phong", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cone", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "blob", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "box", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "disc", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fog", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "lathe", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "merge", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mesh2", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mesh", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "object", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ovus", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "lemon", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "plane", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "poly", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "irid", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sor", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "text", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "torus", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "triangle", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "union", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "colour", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "color", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "media", len)) { i = len;
/* Built-in Vectors */
- else if (STR_LITERAL_STARTSWITH(string, "t", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "u", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "v", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "x", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "y", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "z", len)) i = len;
- else i = 0;
+ } else if (STR_LITERAL_STARTSWITH(string, "t", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "u", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "v", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "x", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "y", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "z", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format off */
@@ -497,202 +500,203 @@ static int txtfmt_pov_find_specialvar(const char *string)
{
int i, len;
/* Modifiers */
- if (STR_LITERAL_STARTSWITH(string, "dispersion_samples", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "projected_through", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "double_illuminate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "expand_thresholds", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "media_interaction", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "media_attenuation", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "low_error_factor", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "recursion_limit", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "interior_texture", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_trace_level", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gray_threshold", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pretrace_start", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "normal_indices", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "normal_vectors", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "vertex_vectors", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "noise_generator", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "irid_wavelength", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "number_of_waves", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ambient_light", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "inside_vector", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "face_indices", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "texture_list", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_gradient", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uv_indices", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uv_vectors", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fade_distance", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "global_lights", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "no_bump_scale", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pretrace_end", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "no_radiosity", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "no_reflection", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "assumed_gamma", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "scallop_wave", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "triangle_wave", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "nearest_count", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "maximum_reuse", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "minimum_reuse", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "always_sample", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "translucency", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "eccentricity", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "contained_by", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "inside_point", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "adc_bailout", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "density_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "split_union", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mm_per_unit", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "agate_turb", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bounded_by", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "brick_size", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hf_gray_16", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "dispersion", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "extinction", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "thickness", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "color_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "colour_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cubic_wave", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fade_colour", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fade_power", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fade_color", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "normal_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pigment_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "quick_color", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "quick_colour", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "material_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pass_through", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "interpolate", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "texture_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "error_bound", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "brightness", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "use_color", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "use_alpha", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "use_colour", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "use_index", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uv_mapping", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "importance", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "max_sample", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "intervals", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sine_wave", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "slope_map", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "poly_wave", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "no_shadow", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ramp_wave", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "precision", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "original", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "accuracy", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "map_type", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "no_image", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "distance", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "autostop", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "caustics", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "octaves", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "aa_level", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "frequency", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fog_offset", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "modulation", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "outbound", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "no_cache", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pigment", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "charset", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "inbound", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "outside", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "inner", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "turbulence", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "threshold", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "accuracy", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "polarity", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bump_size", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "circular", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "control0", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "control1", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "maximal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "minimal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fog_type", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fog_alt", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "samples", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "origin", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "amount", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "adaptive", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "exponent", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "strength", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "density", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fresnel", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "albinos", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "finish", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "method", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "omega", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fixed", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "spacing", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "u_steps", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "v_steps", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "offset", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hollow", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gather", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "lambda", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mortar", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "count", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "once", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "orient", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "normal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "phase", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ratio", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "open", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ior", len)) i = len;
+ if (STR_LITERAL_STARTSWITH(string, "dispersion_samples", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "projected_through", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "double_illuminate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "expand_thresholds", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "media_interaction", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "media_attenuation", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "low_error_factor", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "recursion_limit", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "interior_texture", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_trace_level", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gray_threshold", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pretrace_start", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "normal_indices", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "normal_vectors", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "vertex_vectors", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "noise_generator", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "irid_wavelength", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "number_of_waves", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ambient_light", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "inside_vector", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "face_indices", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "texture_list", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_gradient", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uv_indices", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uv_vectors", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fade_distance", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "global_lights", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "no_bump_scale", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pretrace_end", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "no_radiosity", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "no_reflection", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "assumed_gamma", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "scallop_wave", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "triangle_wave", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "nearest_count", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "maximum_reuse", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "minimum_reuse", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "always_sample", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "translucency", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "eccentricity", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "contained_by", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "inside_point", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "adc_bailout", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "density_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "split_union", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mm_per_unit", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "agate_turb", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bounded_by", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "brick_size", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hf_gray_16", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "dispersion", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "extinction", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "thickness", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "color_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "colour_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cubic_wave", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fade_colour", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fade_power", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fade_color", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "normal_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pigment_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "quick_color", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "quick_colour", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "material_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pass_through", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "interpolate", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "texture_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "error_bound", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "brightness", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "use_color", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "use_alpha", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "use_colour", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "use_index", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uv_mapping", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "importance", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "max_sample", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "intervals", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sine_wave", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "slope_map", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "poly_wave", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "no_shadow", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ramp_wave", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "precision", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "original", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "accuracy", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "map_type", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "no_image", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "distance", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "autostop", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "caustics", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "octaves", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "aa_level", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "frequency", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fog_offset", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "modulation", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "outbound", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "no_cache", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pigment", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "charset", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "inbound", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "outside", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "inner", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "turbulence", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "threshold", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "accuracy", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "polarity", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bump_size", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "circular", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "control0", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "control1", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "maximal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "minimal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fog_type", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fog_alt", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "samples", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "origin", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "amount", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "adaptive", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "exponent", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "strength", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "density", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fresnel", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "albinos", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "finish", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "method", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "omega", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fixed", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "spacing", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "u_steps", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "v_steps", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "offset", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hollow", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gather", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "lambda", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mortar", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "cubic", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "count", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "once", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "orient", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "normal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "phase", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ratio", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "open", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ior", len)) { i = len;
/* Light Types and options*/
- else if (STR_LITERAL_STARTSWITH(string, "area_light", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "looks_like", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fade_power", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tightness", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "spotlight", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "parallel", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "point_at", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "falloff", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "radius", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "area_light", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "looks_like", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fade_power", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tightness", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "spotlight", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "parallel", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "point_at", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "falloff", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "radius", len)) { i = len;
/* Camera Types and options*/
- else if (STR_LITERAL_STARTSWITH(string, "omni_directional_stereo", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "lambert_cylindrical", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "miller_cylindrical", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "lambert_azimuthal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ultra_wide_angle", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "camera_direction", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "camera_location ", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "van_der_grinten", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "aitoff_hammer", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "smyth_craster", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "orthographic", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "camera_right", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "blur_samples", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "plate_carree", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "camera_type", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "perspective", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mesh_camera", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "focal_point", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "balthasart", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "confidence", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "parallaxe", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hobo_dyer", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "camera_up", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "panoramic", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "eckert_vi", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "eckert_iv", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mollweide", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "aperture", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "behrmann", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "variance", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "stereo", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "icosa", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tetra", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "octa", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "mercator", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "omnimax", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fisheye", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "edwards", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "peters", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gall", len)) i = len;
- else i = 0;
+ } else if (STR_LITERAL_STARTSWITH(string, "omni_directional_stereo", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "lambert_cylindrical", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "miller_cylindrical", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "lambert_azimuthal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ultra_wide_angle", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "camera_direction", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "camera_location ", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "van_der_grinten", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "aitoff_hammer", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "smyth_craster", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "orthographic", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "camera_right", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "blur_samples", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "plate_carree", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "camera_type", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "perspective", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mesh_camera", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "focal_point", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "balthasart", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "confidence", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "parallaxe", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hobo_dyer", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "camera_up", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "panoramic", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "eckert_vi", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "eckert_iv", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mollweide", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "aperture", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "behrmann", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "variance", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "stereo", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "icosa", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tetra", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "octa", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "mercator", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "omnimax", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fisheye", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "edwards", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "peters", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gall", len)) { i = len;
+ } else { i = 0;
+}
/* If next source char is an identifier (eg. 'i' in "definite") no match */
return (i == 0 || text_check_identifier(string[i])) ? -1 : i;
@@ -706,43 +710,44 @@ static int txtfmt_pov_find_bool(const char *string)
/* clang-format off */
/* Built-in Constants */
- if (STR_LITERAL_STARTSWITH(string, "unofficial", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "no", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "off", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "true", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "yes", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "on", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pi", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tau", len)) i = len;
+ if (STR_LITERAL_STARTSWITH(string, "unofficial", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "false", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "no", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "off", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "true", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "yes", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "on", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pi", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tau", len)) { i = len;
/* Encodings */
- else if (STR_LITERAL_STARTSWITH(string, "sint16be", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint16le", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint32be", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint32le", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uint16be", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uint16le", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bt2020", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "bt709", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint8", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uint8", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ascii", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "utf8", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint16be", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint16le", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint32be", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint32le", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uint16be", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uint16le", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bt2020", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "bt709", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint8", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uint8", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ascii", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "utf8", len)) { i = len;
/* Filetypes */
- else if (STR_LITERAL_STARTSWITH(string, "tiff", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "df3", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "exr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gif", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hdr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "iff", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "jpeg", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pgm", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "png", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ppm", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sys", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tga", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ttf", len)) i = len;
- else i = 0;
+ } else if (STR_LITERAL_STARTSWITH(string, "tiff", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "df3", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "exr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gif", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hdr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "iff", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "jpeg", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pgm", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "png", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ppm", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sys", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tga", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ttf", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
@@ -757,11 +762,12 @@ static char txtfmt_pov_format_identifier(const char *str)
/* Keep aligned args for readability. */
/* clang-format off */
- if ((txtfmt_pov_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL;
- else if ((txtfmt_pov_find_keyword(str)) != -1) fmt = FMT_TYPE_KEYWORD;
- else if ((txtfmt_pov_find_reserved_keywords(str)) != -1) fmt = FMT_TYPE_RESERVED;
- else if ((txtfmt_pov_find_reserved_builtins(str)) != -1) fmt = FMT_TYPE_DIRECTIVE;
- else fmt = FMT_TYPE_DEFAULT;
+ if ((txtfmt_pov_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
+ } else if ((txtfmt_pov_find_keyword(str)) != -1) { fmt = FMT_TYPE_KEYWORD;
+ } else if ((txtfmt_pov_find_reserved_keywords(str)) != -1) { fmt = FMT_TYPE_RESERVED;
+ } else if ((txtfmt_pov_find_reserved_builtins(str)) != -1) { fmt = FMT_TYPE_DIRECTIVE;
+ } else { fmt = FMT_TYPE_DEFAULT;
+}
/* clang-format on */
@@ -810,8 +816,9 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
*fmt = prev;
fmt++;
str++;
- if (*str == '\0')
+ if (*str == '\0') {
break;
+ }
*fmt = prev;
fmt++;
str += BLI_str_utf8_size_safe(str);
@@ -835,8 +842,9 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
}
else {
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
- if (*str == find)
+ if (*str == find) {
cont = 0;
+ }
*fmt = FMT_TYPE_STRING;
}
@@ -897,10 +905,11 @@ static void txtfmt_pov_format_line(SpaceText *st, TextLine *line, const bool do_
/* Special vars(v) or built-in keywords(b) */
/* keep in sync with 'txtfmt_pov_format_identifier()' */
- if ((i = txtfmt_pov_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL;
- else if ((i = txtfmt_pov_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD;
- else if ((i = txtfmt_pov_find_reserved_keywords(str)) != -1) prev = FMT_TYPE_RESERVED;
- else if ((i = txtfmt_pov_find_reserved_builtins(str)) != -1) prev = FMT_TYPE_DIRECTIVE;
+ if ((i = txtfmt_pov_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
+ } else if ((i = txtfmt_pov_find_keyword(str)) != -1) { prev = FMT_TYPE_KEYWORD;
+ } else if ((i = txtfmt_pov_find_reserved_keywords(str)) != -1) { prev = FMT_TYPE_RESERVED;
+ } else if ((i = txtfmt_pov_find_reserved_builtins(str)) != -1) { prev = FMT_TYPE_DIRECTIVE;
+}
/* clang-format on */
diff --git a/source/blender/editors/space_text/text_format_pov_ini.c b/source/blender/editors/space_text/text_format_pov_ini.c
index 0dbf2b1bdd3..04f4b992cc6 100644
--- a/source/blender/editors/space_text/text_format_pov_ini.c
+++ b/source/blender/editors/space_text/text_format_pov_ini.c
@@ -49,49 +49,50 @@ static int txtfmt_ini_find_keyword(const char *string)
/* clang-format off */
/* Language Directives */
- if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "statistics", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "declare", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "default", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "version", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "warning", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "include", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fclose", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ifndef", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "append", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "debug", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "error", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "fopen", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "local", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "macro", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "range", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "render", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "break", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "switch", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "undef", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "write", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "case", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "read", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "end", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
-
- else if (STR_LITERAL_STARTSWITH(string, "I", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "S", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "A", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Q", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "U", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "F", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "C", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "N", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "P", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "T", len)) i = len;
-
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "deprecated", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "statistics", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "declare", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "default", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "version", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "warning", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "include", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fclose", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ifndef", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "append", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "elseif", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "debug", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "error", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "fopen", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ifdef", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "local", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "macro", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "range", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "render", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "switch", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "undef", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "write", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "case", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "read", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "end", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
+
+ } else if (STR_LITERAL_STARTSWITH(string, "I", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "S", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "A", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Q", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "U", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "F", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "C", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "N", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "P", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "T", len)) { i = len;
+
+ } else { i = 0;
+}
/* clang-format on */
@@ -110,200 +111,201 @@ static int txtfmt_ini_find_reserved(const char *string)
* list is from...
* http://www.povray.org/documentation/view/3.7.0/212/
*/
- if (STR_LITERAL_STARTSWITH(string, "RenderCompleteSoundEnabled", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Create_Continue_Trace_Log", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ParseErrorSoundEnabled", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "RenderErrorSoundEnabled", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "HideWhenMainMinimized", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Antialias_Confidence", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "RenderCompleteSound", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ParseErrorSound", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "RenderErrorSound", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "UseExtensions", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ReadWriteSourceDir", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "NormalPositionLeft", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "NormalPositionTop", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "NormalPositionRight", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "NormalPositionBottom", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Pre_Scene_Command", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Pre_Frame_Command", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Post_Scene_Command", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Post_Frame_Command", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "User_Abort_Command", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Fatal_Error_Command", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "NormalPositionX", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "NormalPositionY", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Pre_Scene_Return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Pre_Frame_Return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Post_Scene_Return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Post_Frame_Return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "User_Abort_Return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Fatal_Error_Return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Antialias_Threshold", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Antialias_Gamma", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Antialias_Depth", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "input_file_name", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Subset_Start_Frame", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Subset_End_Frame", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "UseToolbar", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "UseTooltips", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Frame_Step", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Cyclic_Animation", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Field_Render", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Odd_Field", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "initial_clock", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "initial_frame", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "image_height", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "image_width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Start_Column", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Start_Row", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "End_Column", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "End_Row", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Test_Abort_Count", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Test_Abort", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Continue_Trace", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Bounding_Method", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Create_Ini", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Display_Gamma", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Display", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Version", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Pause_When_Done", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Verbose", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Preview_Start_Size", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Preview_End_Size", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Output_to_File", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Input_File_Name", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Output_File_Name", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Output_File_Type", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Output_Alpha", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Bits_Per_Color", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Compression", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Dither_Method", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Include_Header", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Library_Path", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Debug_Console", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Fatal_Console", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Render_Console", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Statistic_Console", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Warning_Console", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Warning_Level", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "All_Console", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Debug_File", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Fatal_File", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Render_File", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Statistic_File", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Warning_File", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "All_File", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Quality", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Bounding_Threshold", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Bounding", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Light_Buffer", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Vista_Buffer", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Remove_Bounds", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Split_Unions", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Antialias", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Glare_Desaturation", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Sampling_Method", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Stochastic_Seed", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Jitter_Amount", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Jitter", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Antialias_Depth", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "CheckNewVersion", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "RunCount", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "CommandLine", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "TextColour", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "WarningColour", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ErrorColour", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "BackgroundColour", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "DropToEditor", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "LastRenderName", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "LastRenderPath", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "LastQueuePath", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "SecondaryINISection", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "BetaVersionNo64", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "LastBitmapName", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "LastBitmapPath", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "LastINIPath", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "SecondaryINIFile", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "BackgroundFile", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "SaveSettingsOnExit", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "TileBackground", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "HideNewUserHelp", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "SendSystemInfo", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ItsAboutTime", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "LastPath", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Band0Width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Band1Width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Band2Width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Band3Width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Band4Width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ShowCmd", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Transparency", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Use8BitMode", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "MakeActive", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "KeepAboveMain", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "AutoClose", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "PreserveBitmap", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "FontSize", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "FontWeight", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "KeepMessages", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "AlertSound", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Completion", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Priority", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "DutyCycle", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "AlertOnCompletion", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "AutoRender", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "PreventSleep", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "NoShelloutWait", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "SystemNoActive", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "NoShellOuts", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "VideoSource", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "SceneFile", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "OutputFile", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "IniOutputFile", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "CurrentDirectory", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "SourceFile", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Rendering", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "RenderwinClose", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Append_File", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Warning Level", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "clock", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Height", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Width", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Dither", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Flags", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "Font", len)) i = len;
+ if (STR_LITERAL_STARTSWITH(string, "RenderCompleteSoundEnabled", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Create_Continue_Trace_Log", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ParseErrorSoundEnabled", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "RenderErrorSoundEnabled", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "HideWhenMainMinimized", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Antialias_Confidence", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "RenderCompleteSound", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ParseErrorSound", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "RenderErrorSound", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "UseExtensions", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ReadWriteSourceDir", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "NormalPositionLeft", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "NormalPositionTop", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "NormalPositionRight", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "NormalPositionBottom", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Pre_Scene_Command", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Pre_Frame_Command", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Post_Scene_Command", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Post_Frame_Command", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "User_Abort_Command", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Fatal_Error_Command", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "NormalPositionX", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "NormalPositionY", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Pre_Scene_Return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Pre_Frame_Return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Post_Scene_Return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Post_Frame_Return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "User_Abort_Return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Fatal_Error_Return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Antialias_Threshold", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Antialias_Gamma", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Antialias_Depth", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "input_file_name", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Subset_Start_Frame", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Subset_End_Frame", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "UseToolbar", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "UseTooltips", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Frame_Step", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Cyclic_Animation", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Field_Render", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Odd_Field", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "final_clock", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "final_frame", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "frame_number", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "initial_clock", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "initial_frame", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "image_height", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "image_width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Start_Column", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Start_Row", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "End_Column", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "End_Row", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Test_Abort_Count", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Test_Abort", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Continue_Trace", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Bounding_Method", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Create_Ini", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Display_Gamma", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Display", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Version", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Pause_When_Done", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Verbose", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Preview_Start_Size", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Preview_End_Size", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Output_to_File", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Input_File_Name", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Output_File_Name", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Output_File_Type", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Output_Alpha", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Bits_Per_Color", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Compression", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Dither_Method", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Include_Header", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Library_Path", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Debug_Console", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Fatal_Console", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Render_Console", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Statistic_Console", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Warning_Console", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Warning_Level", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "All_Console", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Debug_File", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Fatal_File", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Render_File", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Statistic_File", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Warning_File", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "All_File", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Quality", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Bounding_Threshold", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Bounding", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Light_Buffer", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Vista_Buffer", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Remove_Bounds", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Split_Unions", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Antialias", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Glare_Desaturation", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Sampling_Method", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Stochastic_Seed", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Jitter_Amount", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Jitter", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Antialias_Depth", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "CheckNewVersion", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "RunCount", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "CommandLine", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "TextColour", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "WarningColour", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ErrorColour", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "BackgroundColour", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "DropToEditor", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "LastRenderName", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "LastRenderPath", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "LastQueuePath", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "SecondaryINISection", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "BetaVersionNo64", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "LastBitmapName", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "LastBitmapPath", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "LastINIPath", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "SecondaryINIFile", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "BackgroundFile", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "SaveSettingsOnExit", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "TileBackground", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "HideNewUserHelp", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "SendSystemInfo", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ItsAboutTime", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "LastPath", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Band0Width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Band1Width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Band2Width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Band3Width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Band4Width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ShowCmd", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Transparency", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Use8BitMode", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "MakeActive", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "KeepAboveMain", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "AutoClose", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "PreserveBitmap", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "FontSize", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "FontWeight", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "KeepMessages", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "AlertSound", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Completion", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Priority", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "DutyCycle", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "AlertOnCompletion", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "AutoRender", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "PreventSleep", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "NoShelloutWait", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "SystemNoActive", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "NoShellOuts", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "VideoSource", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "SceneFile", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "OutputFile", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "IniOutputFile", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "CurrentDirectory", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "SourceFile", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Rendering", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "RenderwinClose", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Append_File", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Warning Level", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "clock_delta", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "clock_on", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "clock", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Height", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Width", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Dither", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Flags", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "Font", len)) { i = len;
/* Filetypes */
- else if (STR_LITERAL_STARTSWITH(string, "df3", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "exr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "gif", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "hdr", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "iff", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "jpeg", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pgm", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "png", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "ppm", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sys", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tga", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tiff", len)) i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "df3", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "exr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "gif", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "hdr", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "iff", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "jpeg", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pgm", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "png", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "ppm", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sys", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tga", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tiff", len)) { i = len;
/* Encodings */
- else if (STR_LITERAL_STARTSWITH(string, "ascii", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "utf8", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uint8", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uint16be", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "uint16le", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint8", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint16be", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint16le", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint32be", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "sint32le", len)) i = len;
-
- else i = 0;
+ } else if (STR_LITERAL_STARTSWITH(string, "ascii", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "utf8", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uint8", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uint16be", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "uint16le", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint8", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint16be", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint16le", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint32be", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "sint32le", len)) { i = len;
+
+ } else { i = 0;
+}
/* clang-format on */
@@ -319,21 +321,22 @@ static int txtfmt_ini_find_bool(const char *string)
/* clang-format off */
/* Built-in Constants */
- if (STR_LITERAL_STARTSWITH(string, "false", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "no", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "off", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "true", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "yes", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "on", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pi", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "tau", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "%o", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "%s", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "%n", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "%k", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "%h", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "%w", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "false", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "no", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "off", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "true", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "yes", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "on", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pi", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "tau", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "%o", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "%s", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "%n", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "%k", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "%h", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "%w", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
@@ -344,12 +347,15 @@ static int txtfmt_ini_find_bool(const char *string)
static char txtfmt_pov_ini_format_identifier(const char *str)
{
char fmt;
- if ((txtfmt_ini_find_keyword(str)) != -1)
+ if ((txtfmt_ini_find_keyword(str)) != -1) {
fmt = FMT_TYPE_KEYWORD;
- else if ((txtfmt_ini_find_reserved(str)) != -1)
+ }
+ else if ((txtfmt_ini_find_reserved(str)) != -1) {
fmt = FMT_TYPE_RESERVED;
- else
+ }
+ else {
fmt = FMT_TYPE_DEFAULT;
+ }
return fmt;
}
@@ -395,8 +401,9 @@ static void txtfmt_pov_ini_format_line(SpaceText *st, TextLine *line, const bool
*fmt = prev;
fmt++;
str++;
- if (*str == '\0')
+ if (*str == '\0') {
break;
+ }
*fmt = prev;
fmt++;
str += BLI_str_utf8_size_safe(str);
@@ -420,8 +427,9 @@ static void txtfmt_pov_ini_format_line(SpaceText *st, TextLine *line, const bool
}
else {
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
- if (*str == find)
+ if (*str == find) {
cont = 0;
+ }
*fmt = FMT_TYPE_STRING;
}
@@ -475,8 +483,9 @@ static void txtfmt_pov_ini_format_line(SpaceText *st, TextLine *line, const bool
/* Special vars(v) or built-in keywords(b) */
/* keep in sync with 'txtfmt_ini_format_identifier()' */
- if ((i = txtfmt_ini_find_keyword(str)) != -1) prev = FMT_TYPE_KEYWORD;
- else if ((i = txtfmt_ini_find_reserved(str)) != -1) prev = FMT_TYPE_RESERVED;
+ if ((i = txtfmt_ini_find_keyword(str)) != -1) { prev = FMT_TYPE_KEYWORD;
+ } else if ((i = txtfmt_ini_find_reserved(str)) != -1) { prev = FMT_TYPE_RESERVED;
+}
/* clang-format on */
diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c
index 68e42335546..98eeee61c3a 100644
--- a/source/blender/editors/space_text/text_format_py.c
+++ b/source/blender/editors/space_text/text_format_py.c
@@ -58,43 +58,45 @@ static int txtfmt_py_find_builtinfunc(const char *string)
/* Keep aligned args for readability. */
/* clang-format off */
- if (STR_LITERAL_STARTSWITH(string, "and", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "as", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "assert", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "async", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "await", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "break", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "continue", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "del", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "elif", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "else", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "except", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "finally", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "for", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "from", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "global", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "if", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "import", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "in", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "is", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "lambda", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "nonlocal", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "not", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "or", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "pass", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "raise", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "return", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "try", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "while", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "with", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "yield", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "and", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "as", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "assert", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "async", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "await", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "break", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "continue", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "del", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "elif", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "else", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "except", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "finally", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "for", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "from", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "global", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "if", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "import", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "in", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "is", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "lambda", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "nonlocal", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "not", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "or", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "pass", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "raise", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "return", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "try", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "while", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "with", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "yield", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -112,15 +114,17 @@ static int txtfmt_py_find_specialvar(const char *string)
/* Keep aligned args for readability. */
/* clang-format off */
- if (STR_LITERAL_STARTSWITH(string, "def", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "class", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "def", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "class", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "definite") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -151,16 +155,18 @@ static int txtfmt_py_find_bool(const char *string)
/* Keep aligned args for readability. */
/* clang-format off */
- if (STR_LITERAL_STARTSWITH(string, "None", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "True", len)) i = len;
- else if (STR_LITERAL_STARTSWITH(string, "False", len)) i = len;
- else i = 0;
+ if (STR_LITERAL_STARTSWITH(string, "None", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "True", len)) { i = len;
+ } else if (STR_LITERAL_STARTSWITH(string, "False", len)) { i = len;
+ } else { i = 0;
+}
/* clang-format on */
/* If next source char is an identifier (eg. 'i' in "Nonetheless") no match */
- if (i == 0 || text_check_identifier(string[i]))
+ if (i == 0 || text_check_identifier(string[i])) {
return -1;
+ }
return i;
}
@@ -171,10 +177,11 @@ static char txtfmt_py_format_identifier(const char *str)
/* Keep aligned args for readability. */
/* clang-format off */
- if ((txtfmt_py_find_specialvar(str)) != -1) fmt = FMT_TYPE_SPECIAL;
- else if ((txtfmt_py_find_builtinfunc(str)) != -1) fmt = FMT_TYPE_KEYWORD;
- else if ((txtfmt_py_find_decorator(str)) != -1) fmt = FMT_TYPE_RESERVED;
- else fmt = FMT_TYPE_DEFAULT;
+ if ((txtfmt_py_find_specialvar(str)) != -1) { fmt = FMT_TYPE_SPECIAL;
+ } else if ((txtfmt_py_find_builtinfunc(str)) != -1) { fmt = FMT_TYPE_KEYWORD;
+ } else if ((txtfmt_py_find_decorator(str)) != -1) { fmt = FMT_TYPE_RESERVED;
+ } else { fmt = FMT_TYPE_DEFAULT;
+}
/* clang-format on */
return fmt;
@@ -222,8 +229,9 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_n
*fmt = prev;
fmt++;
str++;
- if (*str == '\0')
+ if (*str == '\0') {
break;
+ }
*fmt = prev;
fmt++;
str += BLI_str_utf8_size_safe(str);
@@ -247,8 +255,9 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_n
}
else {
find = (cont & FMT_CONT_QUOTEDOUBLE) ? '"' : '\'';
- if (*str == find)
+ if (*str == find) {
cont = FMT_CONT_NOP;
+ }
}
*fmt = FMT_TYPE_STRING;
@@ -311,9 +320,10 @@ static void txtfmt_py_format_line(SpaceText *st, TextLine *line, const bool do_n
/* Special vars(v) or built-in keywords(b) */
/* keep in sync with 'txtfmt_py_format_identifier()' */
- if ((i = txtfmt_py_find_specialvar(str)) != -1) prev = FMT_TYPE_SPECIAL;
- else if ((i = txtfmt_py_find_builtinfunc(str)) != -1) prev = FMT_TYPE_KEYWORD;
- else if ((i = txtfmt_py_find_decorator(str)) != -1) prev = FMT_TYPE_DIRECTIVE;
+ if ((i = txtfmt_py_find_specialvar(str)) != -1) { prev = FMT_TYPE_SPECIAL;
+ } else if ((i = txtfmt_py_find_builtinfunc(str)) != -1) { prev = FMT_TYPE_KEYWORD;
+ } else if ((i = txtfmt_py_find_decorator(str)) != -1) { prev = FMT_TYPE_DIRECTIVE;
+}
/* clang-format on */
diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c
index 6f81a3ad659..e2d2bb5ed64 100644
--- a/source/blender/editors/space_text/text_header.c
+++ b/source/blender/editors/space_text/text_header.c
@@ -45,15 +45,17 @@ static ARegion *text_has_properties_region(ScrArea *sa)
ARegion *ar, *arnew;
ar = BKE_area_find_region_type(sa, RGN_TYPE_UI);
- if (ar)
+ if (ar) {
return ar;
+ }
/* add subdiv level; after header */
ar = BKE_area_find_region_type(sa, RGN_TYPE_HEADER);
/* is error! */
- if (ar == NULL)
+ if (ar == NULL) {
return NULL;
+ }
arnew = MEM_callocN(sizeof(ARegion), "properties region");
@@ -78,8 +80,9 @@ static int text_text_search_exec(bContext *C, wmOperator *UNUSED(op))
SpaceText *st = CTX_wm_space_text(C);
if (ar) {
- if (ar->flag & RGN_FLAG_HIDDEN)
+ if (ar->flag & RGN_FLAG_HIDDEN) {
ED_region_toggle_hidden(C, ar);
+ }
/* cannot send a button activate yet for case when region wasn't visible yet */
/* flag gets checked and cleared in main draw callback */
diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c
index f2fdffb15c8..4d904822360 100644
--- a/source/blender/editors/space_text/text_ops.c
+++ b/source/blender/editors/space_text/text_ops.c
@@ -78,8 +78,9 @@ static bool text_edit_poll(bContext *C)
{
Text *text = CTX_data_edit_text(C);
- if (!text)
+ if (!text) {
return 0;
+ }
if (ID_IS_LINKED(text)) {
// BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
@@ -94,8 +95,9 @@ bool text_space_edit_poll(bContext *C)
SpaceText *st = CTX_wm_space_text(C);
Text *text = CTX_data_edit_text(C);
- if (!st || !text)
+ if (!st || !text) {
return 0;
+ }
if (ID_IS_LINKED(text)) {
// BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
@@ -111,11 +113,13 @@ static bool text_region_edit_poll(bContext *C)
Text *text = CTX_data_edit_text(C);
ARegion *ar = CTX_wm_region(C);
- if (!st || !text)
+ if (!st || !text) {
return 0;
+ }
- if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
+ if (!ar || ar->regiontype != RGN_TYPE_WINDOW) {
return 0;
+ }
if (ID_IS_LINKED(text)) {
// BKE_report(op->reports, RPT_ERROR, "Cannot edit external library data");
@@ -129,8 +133,9 @@ static bool text_region_edit_poll(bContext *C)
void text_update_line_edited(TextLine *line)
{
- if (!line)
+ if (!line) {
return;
+ }
/* we just free format here, and let it rebuild during draw */
if (line->format) {
@@ -143,8 +148,9 @@ void text_update_edited(Text *text)
{
TextLine *line;
- for (line = text->lines.first; line; line = line->next)
+ for (line = text->lines.first; line; line = line->next) {
text_update_line_edited(line);
+ }
}
/******************* new operator *********************/
@@ -226,13 +232,15 @@ static int text_open_exec(bContext *C, wmOperator *op)
text = BKE_text_load_ex(bmain, str, BKE_main_blendfile_path(bmain), internal);
if (!text) {
- if (op->customdata)
+ if (op->customdata) {
MEM_freeN(op->customdata);
+ }
return OPERATOR_CANCELLED;
}
- if (!op->customdata)
+ if (!op->customdata) {
text_open_init(C, op);
+ }
/* hook into UI */
pprop = op->customdata;
@@ -266,8 +274,9 @@ static int text_open_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSED(e
Text *text = CTX_data_edit_text(C);
const char *path = (text && text->name) ? text->name : BKE_main_blendfile_path(bmain);
- if (RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
return text_open_exec(C, op);
+ }
text_open_init(C, op);
RNA_string_set(op->ptr, "filepath", path);
@@ -323,8 +332,9 @@ static int text_reload_exec(bContext *C, wmOperator *op)
}
#ifdef WITH_PYTHON
- if (text->compiled)
+ if (text->compiled) {
BPY_text_free_code(text);
+ }
#endif
text_update_edited(text);
@@ -446,8 +456,9 @@ static bool text_save_poll(bContext *C)
{
Text *text = CTX_data_edit_text(C);
- if (!text_edit_poll(C))
+ if (!text_edit_poll(C)) {
return 0;
+ }
return (text->name != NULL && !(text->flags & TXT_ISMEM));
}
@@ -532,13 +543,15 @@ static int text_save_as_exec(bContext *C, wmOperator *op)
Text *text = CTX_data_edit_text(C);
char str[FILE_MAX];
- if (!text)
+ if (!text) {
return OPERATOR_CANCELLED;
+ }
RNA_string_get(op->ptr, "filepath", str);
- if (text->name)
+ if (text->name) {
MEM_freeN(text->name);
+ }
text->name = BLI_strdup(str);
text->flags &= ~TXT_ISMEM;
@@ -556,15 +569,19 @@ static int text_save_as_invoke(bContext *C, wmOperator *op, const wmEvent *UNUSE
Text *text = CTX_data_edit_text(C);
const char *str;
- if (RNA_struct_property_is_set(op->ptr, "filepath"))
+ if (RNA_struct_property_is_set(op->ptr, "filepath")) {
return text_save_as_exec(C, op);
+ }
- if (text->name)
+ if (text->name) {
str = text->name;
- else if (text->flags & TXT_ISMEM)
+ }
+ else if (text->flags & TXT_ISMEM) {
str = text->id.name + 2;
- else
+ }
+ else {
str = BKE_main_blendfile_path(bmain);
+ }
RNA_string_set(op->ptr, "filepath", str);
WM_event_add_fileselect(C, op);
@@ -689,8 +706,9 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
for (con = pchan->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_PYTHON) {
bPythonConstraint *data = con->data;
- if (data->text == text)
+ if (data->text == text) {
BPY_pyconstraint_update(ob, con);
+ }
update = 1;
}
}
@@ -699,8 +717,9 @@ static int text_refresh_pyconstraints_exec(bContext *UNUSED(C), wmOperator *UNUS
for (con = ob->constraints.first; con; con = con->next) {
if (con->type == CONSTRAINT_TYPE_PYTHON) {
bPythonConstraint *data = con->data;
- if (data->text == text)
+ if (data->text == text) {
BPY_pyconstraint_update(ob, con);
+ }
update = 1;
}
}
@@ -738,8 +757,9 @@ static int text_paste_exec(bContext *C, wmOperator *op)
buf = WM_clipboard_text_get(selection, &buf_len);
- if (!buf)
+ if (!buf) {
return OPERATOR_CANCELLED;
+ }
text_drawcache_tag_update(CTX_wm_space_text(C), 0);
@@ -753,8 +773,9 @@ static int text_paste_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
- if (CTX_wm_space_text(C)->live_edit)
+ if (CTX_wm_space_text(C)->live_edit) {
text_run_script(C, NULL);
+ }
return OPERATOR_FINISHED;
}
@@ -822,8 +843,9 @@ static void txt_copy_clipboard(Text *text)
{
char *buf;
- if (!txt_has_sel(text))
+ if (!txt_has_sel(text)) {
return;
+ }
buf = txt_sel_to_buf(text);
@@ -871,8 +893,9 @@ static int text_cut_exec(bContext *C, wmOperator *UNUSED(op))
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
- if (CTX_wm_space_text(C)->live_edit)
+ if (CTX_wm_space_text(C)->live_edit) {
text_run_script(C, NULL);
+ }
return OPERATOR_FINISHED;
}
@@ -995,8 +1018,9 @@ static int text_line_break_exec(bContext *C, wmOperator *UNUSED(op))
}
if (text->curl) {
- if (text->curl->prev)
+ if (text->curl->prev) {
text_update_line_edited(text->curl->prev);
+ }
text_update_line_edited(text->curl);
}
@@ -1128,8 +1152,9 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
flatten_string_free(&fs);
MEM_freeN(tmp->line);
- if (tmp->format)
+ if (tmp->format) {
MEM_freeN(tmp->format);
+ }
/* Put new_line in the tmp->line spot still need to try and set the curc correctly. */
tmp->line = new_line;
@@ -1157,8 +1182,9 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
/* a + 0 we already know to be ' ' char... */
for (j = 1;
(j < tab_len) && (a + j < text_check_line_len) && (text_check_line[a + j] == ' ');
- j++)
+ j++) {
;
+ }
if (j == tab_len) {
/* We found a set of spaces that can be replaced by a tab... */
@@ -1201,8 +1227,9 @@ static int text_convert_whitespace_exec(bContext *C, wmOperator *op)
#endif
MEM_freeN(tmp->line);
- if (tmp->format)
+ if (tmp->format) {
MEM_freeN(tmp->format);
+ }
/* Put new_line in the tmp->line spot
* still need to try and set the curc correctly. */
@@ -1342,8 +1369,9 @@ static int move_lines_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
- if (CTX_wm_space_text(C)->live_edit)
+ if (CTX_wm_space_text(C)->live_edit) {
text_run_script(C, NULL);
+ }
return OPERATOR_FINISHED;
}
@@ -1432,14 +1460,16 @@ static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int
if (found) {
/* exact cursor position was found, check if it's */
/* still on needed line (hasn't been wrapped) */
- if (selc > endj && !chop)
+ if (selc > endj && !chop) {
selc = endj;
+ }
loop = 0;
break;
}
- if (chop)
+ if (chop) {
endj = j;
+ }
start = end;
end += max;
@@ -1453,8 +1483,9 @@ static int text_get_cursor_rel(SpaceText *st, ARegion *ar, TextLine *linein, int
}
}
else if (ch == '\0') {
- if (!found)
+ if (!found) {
selc = linein->len;
+ }
loop = 0;
break;
}
@@ -1552,8 +1583,9 @@ static int cursor_skip_find_line(
*linep = (*linep)->prev;
}
else { /* moving bottom */
- if (*rell - visible_lines < 0)
+ if (*rell - visible_lines < 0) {
break;
+ }
if (!(*linep)->next) {
*rell = visible_lines - 1;
@@ -1617,14 +1649,16 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, const bool sel)
*charp = endj;
if (j >= oldc) {
- if (ch == '\0')
+ if (ch == '\0') {
*charp = txt_utf8_column_to_offset((*linep)->line, start);
+ }
loop = 0;
break;
}
- if (chop)
+ if (chop) {
endj = j;
+ }
start = end;
end += max;
@@ -1645,8 +1679,9 @@ static void txt_wrap_move_bol(SpaceText *st, ARegion *ar, const bool sel)
}
}
- if (!sel)
+ if (!sel) {
txt_pop_sel(text);
+ }
}
static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, const bool sel)
@@ -1695,14 +1730,17 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, const bool sel)
if (i + columns - start > max) {
end = MIN2(end, i);
- if (chop)
+ if (chop) {
endj = BLI_str_prev_char_utf8((*linep)->line + j) - (*linep)->line;
+ }
if (endj >= oldc) {
- if (ch == '\0')
+ if (ch == '\0') {
*charp = (*linep)->len;
- else
+ }
+ else {
*charp = endj;
+ }
loop = 0;
break;
}
@@ -1725,8 +1763,9 @@ static void txt_wrap_move_eol(SpaceText *st, ARegion *ar, const bool sel)
}
}
- if (!sel)
+ if (!sel) {
txt_pop_sel(text);
+ }
}
static void txt_wrap_move_up(SpaceText *st, ARegion *ar, const bool sel)
@@ -1765,8 +1804,9 @@ static void txt_wrap_move_up(SpaceText *st, ARegion *ar, const bool sel)
}
}
- if (!sel)
+ if (!sel) {
txt_pop_sel(text);
+ }
}
static void txt_wrap_move_down(SpaceText *st, ARegion *ar, const bool sel)
@@ -1803,8 +1843,9 @@ static void txt_wrap_move_down(SpaceText *st, ARegion *ar, const bool sel)
}
}
- if (!sel)
+ if (!sel) {
txt_pop_sel(text);
+ }
}
/* Moves the cursor vertically by the specified number of lines.
@@ -1831,8 +1872,9 @@ static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, const
int rell, relc;
/* find line and offsets inside it needed to set cursor position */
- if (cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc))
+ if (cursor_skip_find_line(st, ar, lines, linep, charp, &rell, &relc)) {
*charp = text_get_cursor_rel(st, ar, *linep, rell, relc);
+ }
}
else {
while (lines > 0 && (*linep)->next) {
@@ -1845,11 +1887,13 @@ static void cursor_skip(SpaceText *st, ARegion *ar, Text *text, int lines, const
}
}
- if (*charp > (*linep)->len)
+ if (*charp > (*linep)->len) {
*charp = (*linep)->len;
+ }
- if (!sel)
+ if (!sel) {
txt_pop_sel(text);
+ }
}
static int text_move_cursor(bContext *C, int type, bool select)
@@ -1859,28 +1903,33 @@ static int text_move_cursor(bContext *C, int type, bool select)
ARegion *ar = CTX_wm_region(C);
/* ensure we have the right region, it's optional */
- if (ar && ar->regiontype != RGN_TYPE_WINDOW)
+ if (ar && ar->regiontype != RGN_TYPE_WINDOW) {
ar = NULL;
+ }
switch (type) {
case LINE_BEGIN:
if (!select) {
txt_sel_clear(text);
}
- if (st && st->wordwrap && ar)
+ if (st && st->wordwrap && ar) {
txt_wrap_move_bol(st, ar, select);
- else
+ }
+ else {
txt_move_bol(text, select);
+ }
break;
case LINE_END:
if (!select) {
txt_sel_clear(text);
}
- if (st && st->wordwrap && ar)
+ if (st && st->wordwrap && ar) {
txt_wrap_move_eol(st, ar, select);
- else
+ }
+ else {
txt_move_eol(text, select);
+ }
break;
case FILE_TOP:
@@ -1926,31 +1975,39 @@ static int text_move_cursor(bContext *C, int type, bool select)
break;
case PREV_LINE:
- if (st && st->wordwrap && ar)
+ if (st && st->wordwrap && ar) {
txt_wrap_move_up(st, ar, select);
- else
+ }
+ else {
txt_move_up(text, select);
+ }
break;
case NEXT_LINE:
- if (st && st->wordwrap && ar)
+ if (st && st->wordwrap && ar) {
txt_wrap_move_down(st, ar, select);
- else
+ }
+ else {
txt_move_down(text, select);
+ }
break;
case PREV_PAGE:
- if (st)
+ if (st) {
cursor_skip(st, ar, st->text, -st->viewlines, select);
- else
+ }
+ else {
cursor_skip(NULL, NULL, text, -10, select);
+ }
break;
case NEXT_PAGE:
- if (st)
+ if (st) {
cursor_skip(st, ar, st->text, st->viewlines, select);
- else
+ }
+ else {
cursor_skip(NULL, NULL, text, 10, select);
+ }
break;
}
@@ -2019,12 +2076,15 @@ static int text_jump_exec(bContext *C, wmOperator *op)
int line = RNA_int_get(op->ptr, "line");
short nlines = txt_get_span(text->lines.first, text->lines.last) + 1;
- if (line < 1)
+ if (line < 1) {
txt_move_toline(text, 1, 0);
- else if (line > nlines)
+ }
+ else if (line > nlines) {
txt_move_toline(text, nlines - 1, 0);
- else
+ }
+ else {
txt_move_toline(text, line - 1, 0);
+ }
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
@@ -2077,10 +2137,12 @@ static int text_delete_exec(bContext *C, wmOperator *op)
/* behavior could be changed here,
* but for now just don't jump words when we have a selection */
if (txt_has_sel(text)) {
- if (type == DEL_PREV_WORD)
+ if (type == DEL_PREV_WORD) {
type = DEL_PREV_CHAR;
- else if (type == DEL_NEXT_WORD)
+ }
+ else if (type == DEL_NEXT_WORD) {
type = DEL_NEXT_CHAR;
+ }
}
TextUndoBuf *utxt = ED_text_undo_push_init(C);
@@ -2136,8 +2198,9 @@ static int text_delete_exec(bContext *C, wmOperator *op)
WM_event_add_notifier(C, NC_TEXT | NA_EDITED, text);
/* run the script while editing, evil but useful */
- if (st->live_edit)
+ if (st->live_edit) {
text_run_script(C, NULL);
+ }
return OPERATOR_FINISHED;
}
@@ -2247,8 +2310,9 @@ static int text_scroll_exec(bContext *C, wmOperator *op)
int lines = RNA_int_get(op->ptr, "lines");
- if (lines == 0)
+ if (lines == 0) {
return OPERATOR_CANCELLED;
+ }
txt_screen_skip(st, ar, lines * U.wheellinescroll);
@@ -2305,8 +2369,9 @@ static void text_scroll_apply(bContext *C, wmOperator *op, const wmEvent *event)
}
else {
st->left += scroll_steps[0];
- if (st->left < 0)
+ if (st->left < 0) {
st->left = 0;
+ }
}
ED_area_tag_redraw(CTX_wm_area(C));
@@ -2332,8 +2397,9 @@ static int text_scroll_modal(bContext *C, wmOperator *op, const wmEvent *event)
switch (event->type) {
case MOUSEMOVE:
- if (tsc->zone == SCROLLHANDLE_BAR)
+ if (tsc->zone == SCROLLHANDLE_BAR) {
text_scroll_apply(C, op, event);
+ }
break;
case LEFTMOUSE:
case RIGHTMOUSE:
@@ -2363,8 +2429,9 @@ static int text_scroll_invoke(bContext *C, wmOperator *op, const wmEvent *event)
SpaceText *st = CTX_wm_space_text(C);
TextScroll *tsc;
- if (RNA_struct_property_is_set(op->ptr, "lines"))
+ if (RNA_struct_property_is_set(op->ptr, "lines")) {
return text_scroll_exec(C, op);
+ }
tsc = MEM_callocN(sizeof(TextScroll), "TextScroll");
tsc->first = 1;
@@ -2426,11 +2493,13 @@ static bool text_region_scroll_poll(bContext *C)
Text *text = CTX_data_edit_text(C);
ARegion *ar = CTX_wm_region(C);
- if (!st || !text)
+ if (!st || !text) {
return 0;
+ }
- if (!ar || ar->regiontype != RGN_TYPE_WINDOW)
+ if (!ar || ar->regiontype != RGN_TYPE_WINDOW) {
return 0;
+ }
return 1;
}
@@ -2443,8 +2512,9 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, const wmEvent *ev
const int *mval = event->mval;
int zone = -1;
- if (RNA_struct_property_is_set(op->ptr, "lines"))
+ if (RNA_struct_property_is_set(op->ptr, "lines")) {
return text_scroll_exec(C, op);
+ }
/* verify we are in the right zone */
if (mval[0] > st->txtbar.xmin && mval[0] < st->txtbar.xmax) {
@@ -2453,10 +2523,12 @@ static int text_scroll_bar_invoke(bContext *C, wmOperator *op, const wmEvent *ev
zone = SCROLLHANDLE_BAR;
}
else if (mval[1] > TXT_SCROLL_SPACE && mval[1] < ar->winy - TXT_SCROLL_SPACE) {
- if (mval[1] < st->txtbar.ymin)
+ if (mval[1] < st->txtbar.ymin) {
zone = SCROLLHANDLE_MIN_OUTSIDE;
- else
+ }
+ else {
zone = SCROLLHANDLE_MAX_OUTSIDE;
+ }
}
}
@@ -2540,13 +2612,16 @@ static int flatten_column_to_offset(SpaceText *st, const char *str, int index)
int i = 0, j = 0, col;
while (*(str + j)) {
- if (str[j] == '\t')
+ if (str[j] == '\t') {
col = st->tabnumber - i % st->tabnumber;
- else
+ }
+ else {
col = BLI_str_utf8_char_width_safe(str + j);
+ }
- if (i + col > index)
+ if (i + col > index) {
break;
+ }
i += col;
j += BLI_str_utf8_size_safe(str + j);
@@ -2633,18 +2708,21 @@ static void text_cursor_set_to_pos_wrapped(
if (found) {
/* exact cursor position was found, check if it's still on needed line
* (hasn't been wrapped) */
- if (charp > endj && !chop && ch != '\0')
+ if (charp > endj && !chop && ch != '\0') {
charp = endj;
+ }
break;
}
- if (chop)
+ if (chop) {
endj = j;
+ }
start = end;
end += max;
- if (j < linep->len)
+ if (j < linep->len) {
y--;
+ }
chop = true;
if (y == 0 && i + columns - start > x) {
@@ -2705,13 +2783,16 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, con
text_update_character_width(st);
y = (ar->winy - 2 - y) / (st->lheight_dpi + TXT_LINE_SPACING);
- if (st->showlinenrs)
+ if (st->showlinenrs) {
x -= TXT_OFFSET + TEXTXLOC;
- else
+ }
+ else {
x -= TXT_OFFSET;
+ }
- if (x < 0)
+ if (x < 0) {
x = 0;
+ }
x = text_pixel_x_to_column(st, x) + st->left;
if (st->wordwrap) {
@@ -2735,25 +2816,30 @@ static void text_cursor_set_to_pos(SpaceText *st, ARegion *ar, int x, int y, con
if (y > 0) {
while (y-- != 0) {
- if ((*linep)->next)
+ if ((*linep)->next) {
*linep = (*linep)->next;
+ }
}
}
else if (y < 0) {
while (y++ != 0) {
- if ((*linep)->prev)
+ if ((*linep)->prev) {
*linep = (*linep)->prev;
+ }
}
}
w = flatten_width(st, (*linep)->line);
- if (x < w)
+ if (x < w) {
*charp = flatten_column_to_offset(st, (*linep)->line, x);
- else
+ }
+ else {
*charp = (*linep)->len;
+ }
}
- if (!sel)
+ if (!sel) {
txt_pop_sel(text);
+ }
}
static void text_cursor_timer_ensure(bContext *C, SetSelection *ssel)
@@ -2840,8 +2926,9 @@ static int text_set_selection_invoke(bContext *C, wmOperator *op, const wmEvent
SpaceText *st = CTX_wm_space_text(C);
SetSelection *ssel;
- if (event->mval[0] >= st->txtbar.xmin)
+ if (event->mval[0] >= st->txtbar.xmin) {
return OPERATOR_PASS_THROUGH;
+ }
op->customdata = MEM_callocN(sizeof(SetSelection), "SetCursor");
ssel = op->customdata;
@@ -2920,8 +3007,9 @@ static int text_cursor_set_invoke(bContext *C, wmOperator *op, const wmEvent *ev
{
SpaceText *st = CTX_wm_space_text(C);
- if (event->mval[0] >= st->txtbar.xmin)
+ if (event->mval[0] >= st->txtbar.xmin) {
return OPERATOR_PASS_THROUGH;
+ }
RNA_int_set(op->ptr, "x", event->mval[0]);
RNA_int_set(op->ptr, "y", event->mval[1]);
@@ -2960,18 +3048,23 @@ static int text_line_number_invoke(bContext *C, wmOperator *UNUSED(op), const wm
text_update_character_width(st);
- if (!st->showlinenrs)
+ if (!st->showlinenrs) {
return OPERATOR_PASS_THROUGH;
+ }
- if (!(mval[0] > 2 && mval[0] < (TXT_OFFSET + TEXTXLOC) && mval[1] > 2 && mval[1] < ar->winy - 2))
+ if (!(mval[0] > 2 && mval[0] < (TXT_OFFSET + TEXTXLOC) && mval[1] > 2 &&
+ mval[1] < ar->winy - 2)) {
return OPERATOR_PASS_THROUGH;
+ }
- if (!(event->ascii >= '0' && event->ascii <= '9'))
+ if (!(event->ascii >= '0' && event->ascii <= '9')) {
return OPERATOR_PASS_THROUGH;
+ }
time = PIL_check_seconds_timer();
- if (last_jump < time - 1)
+ if (last_jump < time - 1) {
jump_to = 0;
+ }
jump_to *= 10;
jump_to += (int)(event->ascii - '0');
@@ -3029,8 +3122,9 @@ static int text_insert_exec(bContext *C, wmOperator *op)
MEM_freeN(str);
- if (!done)
+ if (!done) {
return OPERATOR_CANCELLED;
+ }
text_update_line_edited(text->curl);
@@ -3073,8 +3167,9 @@ static int text_insert_invoke(bContext *C, wmOperator *op, const wmEvent *event)
ret = text_insert_exec(C, op);
/* run the script while editing, evil but useful */
- if (ret == OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit)
+ if (ret == OPERATOR_FINISHED && CTX_wm_space_text(C)->live_edit) {
text_run_script(C, NULL);
+ }
return ret;
}
@@ -3117,21 +3212,25 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
int found = 0;
char *tmp;
- if (!st->findstr[0])
+ if (!st->findstr[0]) {
return OPERATOR_CANCELLED;
+ }
flags = st->flags;
- if (flags & ST_FIND_ALL)
+ if (flags & ST_FIND_ALL) {
flags &= ~ST_FIND_WRAP;
+ }
/* Replace current */
if (mode != TEXT_FIND && txt_has_sel(text)) {
tmp = txt_sel_to_buf(text);
- if (flags & ST_MATCH_CASE)
+ if (flags & ST_MATCH_CASE) {
found = STREQ(st->findstr, tmp);
- else
+ }
+ else {
found = BLI_strcasecmp(st->findstr, tmp) == 0;
+ }
if (found) {
if (mode == TEXT_REPLACE) {
@@ -3156,17 +3255,20 @@ static int text_find_and_replace(bContext *C, wmOperator *op, short mode)
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
}
else if (flags & ST_FIND_ALL) {
- if (text->id.next)
+ if (text->id.next) {
text = st->text = text->id.next;
- else
+ }
+ else {
text = st->text = bmain->texts.first;
+ }
txt_move_toline(text, 0, 0);
text_update_cursor_moved(C);
WM_event_add_notifier(C, NC_TEXT | ND_CURSOR, text);
}
else {
- if (!found)
+ if (!found) {
BKE_reportf(op->reports, RPT_ERROR, "Text not found: %s", st->findstr);
+ }
}
return OPERATOR_FINISHED;
@@ -3223,8 +3325,9 @@ static int text_find_set_selected_exec(bContext *C, wmOperator *op)
BLI_strncpy(st->findstr, tmp, ST_MAX_FIND_STR);
MEM_freeN(tmp);
- if (!st->findstr[0])
+ if (!st->findstr[0]) {
return OPERATOR_FINISHED;
+ }
return text_find_and_replace(C, op, TEXT_FIND);
}