From 3134407c48f2623ad5f55db5d868fb82346dfa7b Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 19 Dec 2012 04:23:02 +0000 Subject: code cleanup: remove unneeded include's and rename some static functions in text_format_py.c --- source/blender/editors/space_text/space_text.c | 5 --- source/blender/editors/space_text/text_draw.c | 7 --- source/blender/editors/space_text/text_format.c | 25 +---------- source/blender/editors/space_text/text_format_py.c | 50 ++++++++-------------- source/blender/editors/space_text/text_header.c | 10 ----- source/blender/editors/space_text/text_ops.c | 5 --- source/blender/editors/space_text/text_python.c | 5 --- 7 files changed, 18 insertions(+), 89 deletions(-) (limited to 'source/blender/editors') diff --git a/source/blender/editors/space_text/space_text.c b/source/blender/editors/space_text/space_text.c index b5a3e7bc4cc..9ac66ca1698 100644 --- a/source/blender/editors/space_text/space_text.c +++ b/source/blender/editors/space_text/space_text.c @@ -30,17 +30,12 @@ #include -#include #include "DNA_text_types.h" -#include "DNA_object_types.h" #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_math.h" -#include "BLI_rand.h" -#include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_screen.h" diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 2066df39b73..ce758ddefbd 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -29,10 +29,6 @@ */ -#include -#include -#include -#include #include "MEM_guardedalloc.h" @@ -40,12 +36,10 @@ #include "BLI_blenlib.h" #include "BLI_math.h" -#include "BLI_utildefines.h" #include "DNA_text_types.h" #include "DNA_space_types.h" #include "DNA_screen_types.h" -#include "DNA_userdef_types.h" #include "BKE_context.h" #include "BKE_suggestions.h" @@ -53,7 +47,6 @@ #include "BIF_gl.h" -#include "ED_datafiles.h" #include "UI_interface.h" #include "UI_resources.h" diff --git a/source/blender/editors/space_text/text_format.c b/source/blender/editors/space_text/text_format.c index 512b512dbc4..0b3856f4414 100644 --- a/source/blender/editors/space_text/text_format.c +++ b/source/blender/editors/space_text/text_format.c @@ -24,40 +24,19 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/editors/space_text/text_draw.c +/** \file blender/editors/space_text/text_format.c * \ingroup sptext */ - -#include -#include #include -#include #include "MEM_guardedalloc.h" -#include "BLF_api.h" - #include "BLI_blenlib.h" -#include "BLI_math.h" -#include "BLI_utildefines.h" #include "DNA_text_types.h" #include "DNA_space_types.h" -#include "DNA_screen_types.h" -#include "DNA_userdef_types.h" - -#include "BKE_context.h" -#include "BKE_suggestions.h" -#include "BKE_text.h" -#include "BIF_gl.h" - -#include "ED_datafiles.h" -#include "UI_interface.h" -#include "UI_resources.h" - -#include "text_intern.h" #include "text_format.h" @@ -136,8 +115,6 @@ void flatten_string_free(FlattenString *fs) /* Ensures the format string for the given line is long enough, reallocating * as needed. Allocation is done here, alone, to ensure consistency. */ - -/*TODO: rename! flatten_string_len_ensure() */ int text_check_format_len(TextLine *line, unsigned int len) { if (line->format) { diff --git a/source/blender/editors/space_text/text_format_py.c b/source/blender/editors/space_text/text_format_py.c index dfee0e3b2a7..2a0f483d80c 100644 --- a/source/blender/editors/space_text/text_format_py.c +++ b/source/blender/editors/space_text/text_format_py.c @@ -28,35 +28,15 @@ * \ingroup sptext */ -#include -#include #include -#include - -#include "MEM_guardedalloc.h" - -#include "BLF_api.h" #include "BLI_blenlib.h" -#include "BLI_math.h" -#include "BLI_utildefines.h" #include "DNA_text_types.h" #include "DNA_space_types.h" -#include "DNA_screen_types.h" -#include "DNA_userdef_types.h" -#include "BKE_context.h" -#include "BKE_suggestions.h" #include "BKE_text.h" -#include "BIF_gl.h" - -#include "ED_datafiles.h" -#include "UI_interface.h" -#include "UI_resources.h" - -#include "text_intern.h" #include "text_format.h" /* *** Local Functions (for format_line) *** */ @@ -73,7 +53,7 @@ * http://docs.python.org/py3k/reference/lexical_analysis.html#keywords */ -static int find_builtinfunc(char *string) +static int txtfmt_py_find_builtinfunc(char *string) { int a, i; const char *builtinfuncs[] = { @@ -115,7 +95,7 @@ static int find_builtinfunc(char *string) * If a special name is found, the length of the matching name is returned. * Otherwise, -1 is returned. */ -static int find_specialvar(char *string) +static int txtfmt_py_find_specialvar(char *string) { int i = 0; /* Check for "def" */ @@ -130,7 +110,7 @@ static int find_specialvar(char *string) return i; } -static int find_decorator(char *string) +static int txtfmt_py_find_decorator(char *string) { if (string[0] == '@') { int i = 1; @@ -142,7 +122,7 @@ static int find_decorator(char *string) return -1; } -static int find_bool(char *string) +static int txtfmt_py_find_bool(char *string) { int i = 0; /* Check for "False" */ @@ -160,7 +140,7 @@ static int find_bool(char *string) return i; } -static void txt_format_line(SpaceText *st, TextLine *line, int do_next) +static void txtfmt_py_format_line(SpaceText *st, TextLine *line, int do_next) { FlattenString fs; char *str, *fmt, orig, cont, find, prev = ' '; @@ -171,14 +151,18 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) fmt = line->prev->format; cont = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */ } - else cont = 0; + else { + cont = 0; + } /* Get original continuation from this line */ if (line->format != NULL) { fmt = line->format; orig = fmt[strlen(fmt) + 1]; /* Just after the null-terminator */ } - else orig = 0xFF; + else { + orig = 0xFF; + } len = flatten_string(st, &fs, line->line); str = fs.buf; @@ -241,7 +225,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) else if ((prev != 'q' && text_check_digit(*str)) || (*str == '.' && text_check_digit(*(str + 1)))) *fmt = 'n'; /* Booleans */ - else if (prev != 'q' && (i = find_bool(str)) != -1) + else if (prev != 'q' && (i = txtfmt_py_find_bool(str)) != -1) if (i > 0) { while (i > 1) { *fmt = 'n'; fmt++; str++; @@ -264,11 +248,11 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) /* Not ws, a digit, punct, or continuing text. Must be new, check for special words */ else { /* Special vars(v) or built-in keywords(b) */ - if ((i = find_specialvar(str)) != -1) + if ((i = txtfmt_py_find_specialvar(str)) != -1) prev = 'v'; - else if ((i = find_builtinfunc(str)) != -1) + else if ((i = txtfmt_py_find_builtinfunc(str)) != -1) prev = 'b'; - else if ((i = find_decorator(str)) != -1) + else if ((i = txtfmt_py_find_decorator(str)) != -1) prev = 'v'; /* could have a new color for this */ if (i > 0) { while (i > 1) { @@ -294,7 +278,7 @@ static void txt_format_line(SpaceText *st, TextLine *line, int do_next) /* If continuation has changed and we're allowed, process the next line */ if (cont != orig && do_next && line->next) { - txt_format_line(st, line->next, do_next); + txtfmt_py_format_line(st, line->next, do_next); } flatten_string_free(&fs); @@ -305,7 +289,7 @@ void ED_text_format_register_py(void) static TextFormatType tft = {0}; static const char *ext[] = {"py", NULL}; - tft.format_line = txt_format_line; + tft.format_line = txtfmt_py_format_line; tft.ext = ext; ED_text_format_register(&tft); diff --git a/source/blender/editors/space_text/text_header.c b/source/blender/editors/space_text/text_header.c index 7dc3ec1ac60..52253b2d5d2 100644 --- a/source/blender/editors/space_text/text_header.c +++ b/source/blender/editors/space_text/text_header.c @@ -29,20 +29,11 @@ */ -#include -#include -#include /* file time checking */ -#include -#include -#include #ifndef _WIN32 -# include #else -# include -# include "BLI_winstuff.h" #endif #include "DNA_windowmanager_types.h" @@ -50,7 +41,6 @@ #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" -#include "BLI_utildefines.h" #include "BKE_context.h" #include "BKE_screen.h" diff --git a/source/blender/editors/space_text/text_ops.c b/source/blender/editors/space_text/text_ops.c index 745e994657f..01041c0e385 100644 --- a/source/blender/editors/space_text/text_ops.c +++ b/source/blender/editors/space_text/text_ops.c @@ -30,19 +30,14 @@ */ -#include #include -#include /* ispunct */ -#include #include #include "MEM_guardedalloc.h" #include "DNA_text_types.h" -#include "DNA_userdef_types.h" #include "BLI_blenlib.h" -#include "BLI_utildefines.h" #include "BLF_translation.h" diff --git a/source/blender/editors/space_text/text_python.c b/source/blender/editors/space_text/text_python.c index a06144b8260..1201302dad0 100644 --- a/source/blender/editors/space_text/text_python.c +++ b/source/blender/editors/space_text/text_python.c @@ -28,22 +28,17 @@ * \ingroup sptext */ - #include -#include -#include #include "DNA_screen_types.h" #include "DNA_space_types.h" #include "DNA_text_types.h" #include "DNA_userdef_types.h" -#include "BKE_blender.h" #include "BKE_suggestions.h" #include "BKE_text.h" #include "BLI_blenlib.h" -#include "BLI_utildefines.h" #include "WM_types.h" -- cgit v1.2.3