[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [53157] trunk/blender/source/blender/ editors/space_text: code cleanup: remove unneeded include' s and rename some static functions in text_format_py.c

Campbell Barton ideasman42 at gmail.com
Wed Dec 19 05:23:12 CET 2012


Revision: 53157
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=53157
Author:   campbellbarton
Date:     2012-12-19 04:23:02 +0000 (Wed, 19 Dec 2012)
Log Message:
-----------
code cleanup: remove unneeded include's and rename some static functions in text_format_py.c

Modified Paths:
--------------
    trunk/blender/source/blender/editors/space_text/space_text.c
    trunk/blender/source/blender/editors/space_text/text_draw.c
    trunk/blender/source/blender/editors/space_text/text_format.c
    trunk/blender/source/blender/editors/space_text/text_format_py.c
    trunk/blender/source/blender/editors/space_text/text_header.c
    trunk/blender/source/blender/editors/space_text/text_ops.c
    trunk/blender/source/blender/editors/space_text/text_python.c

Modified: trunk/blender/source/blender/editors/space_text/space_text.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/space_text.c	2012-12-19 04:02:19 UTC (rev 53156)
+++ trunk/blender/source/blender/editors/space_text/space_text.c	2012-12-19 04:23:02 UTC (rev 53157)
@@ -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"

Modified: trunk/blender/source/blender/editors/space_text/text_draw.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_draw.c	2012-12-19 04:02:19 UTC (rev 53156)
+++ trunk/blender/source/blender/editors/space_text/text_draw.c	2012-12-19 04:23:02 UTC (rev 53157)
@@ -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"
 

Modified: trunk/blender/source/blender/editors/space_text/text_format.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_format.c	2012-12-19 04:02:19 UTC (rev 53156)
+++ trunk/blender/source/blender/editors/space_text/text_format.c	2012-12-19 04:23:02 UTC (rev 53157)
@@ -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 @@
 
 /* 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) {

Modified: trunk/blender/source/blender/editors/space_text/text_format_py.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_format_py.c	2012-12-19 04:02:19 UTC (rev 53156)
+++ trunk/blender/source/blender/editors/space_text/text_format_py.c	2012-12-19 04:23:02 UTC (rev 53157)
@@ -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 @@
  * 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 @@
 	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 @@
 	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 @@
 	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 @@
 		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 @@
 			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 @@
 			/* 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 @@
 
 	/* 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 @@
 	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);

Modified: trunk/blender/source/blender/editors/space_text/text_header.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_header.c	2012-12-19 04:02:19 UTC (rev 53156)
+++ trunk/blender/source/blender/editors/space_text/text_header.c	2012-12-19 04:23:02 UTC (rev 53157)
@@ -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"

Modified: trunk/blender/source/blender/editors/space_text/text_ops.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_ops.c	2012-12-19 04:02:19 UTC (rev 53156)
+++ trunk/blender/source/blender/editors/space_text/text_ops.c	2012-12-19 04:23:02 UTC (rev 53157)
@@ -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"
 

Modified: trunk/blender/source/blender/editors/space_text/text_python.c
===================================================================
--- trunk/blender/source/blender/editors/space_text/text_python.c	2012-12-19 04:02:19 UTC (rev 53156)
+++ trunk/blender/source/blender/editors/space_text/text_python.c	2012-12-19 04:23:02 UTC (rev 53157)
@@ -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"
 




More information about the Bf-blender-cvs mailing list