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:
authorCampbell Barton <ideasman42@gmail.com>2012-12-19 08:23:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2012-12-19 08:23:02 +0400
commit3134407c48f2623ad5f55db5d868fb82346dfa7b (patch)
tree8d44e5d1d1baa055fa0a9715d225cf5c025fe00f /source/blender/editors
parentf43923d86d0a4d6dbbdc8d7fc05d383a23b3e5e2 (diff)
code cleanup: remove unneeded include's and rename some static functions in text_format_py.c
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/space_text/space_text.c5
-rw-r--r--source/blender/editors/space_text/text_draw.c7
-rw-r--r--source/blender/editors/space_text/text_format.c25
-rw-r--r--source/blender/editors/space_text/text_format_py.c50
-rw-r--r--source/blender/editors/space_text/text_header.c10
-rw-r--r--source/blender/editors/space_text/text_ops.c5
-rw-r--r--source/blender/editors/space_text/text_python.c5
7 files changed, 18 insertions, 89 deletions
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 <string.h>
-#include <stdio.h>
#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 <math.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/stat.h>
#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 <math.h>
-#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
#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 <math.h>
-#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
-
-#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 <stdlib.h>
-#include <string.h>
-#include <stdio.h>
/* file time checking */
-#include <ctype.h>
-#include <sys/types.h>
-#include <sys/stat.h>
#ifndef _WIN32
-# include <unistd.h>
#else
-# include <io.h>
-# 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 <stdlib.h>
#include <string.h>
-#include <ctype.h> /* ispunct */
-#include <sys/stat.h>
#include <errno.h>
#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 <ctype.h>
-#include <stdio.h>
-#include <stdlib.h>
#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"