diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/blenkernel/BKE_text.h | 14 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/DerivedMesh.c | 2 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/text.c | 19 | ||||
-rw-r--r-- | source/blender/editors/space_text/text_draw.c | 19 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_define.c | 14 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_particle.c | 3 | ||||
-rw-r--r-- | source/blender/makesrna/intern/rna_userdef.c | 5 |
7 files changed, 42 insertions, 34 deletions
diff --git a/source/blender/blenkernel/BKE_text.h b/source/blender/blenkernel/BKE_text.h index efd38cac232..0a94d89a121 100644 --- a/source/blender/blenkernel/BKE_text.h +++ b/source/blender/blenkernel/BKE_text.h @@ -60,8 +60,8 @@ void txt_order_cursors (struct Text *text); int txt_find_string (struct Text *text, const char *findstr, int wrap, int match_case); int txt_has_sel (struct Text *text); int txt_get_span (struct TextLine *from, struct TextLine *to); -int txt_utf8_offset_to_index(char *str, int offset); -int txt_utf8_index_to_offset(char *str, int index); +int txt_utf8_offset_to_index(const char *str, int offset); +int txt_utf8_index_to_offset(const char *str, int index); void txt_move_up (struct Text *text, short sel); void txt_move_down (struct Text *text, short sel); void txt_move_left (struct Text *text, short sel); @@ -107,11 +107,11 @@ struct TextMarker *txt_prev_marker (struct Text *text, struct TextMarker *marke struct TextMarker *txt_next_marker (struct Text *text, struct TextMarker *marker); /* utility functions, could be moved somewhere more generic but are python/text related */ -int text_check_bracket(char ch); -int text_check_delim(char ch); -int text_check_digit(char ch); -int text_check_identifier(char ch); -int text_check_whitespace(char ch); +int text_check_bracket(const char ch); +int text_check_delim(const char ch); +int text_check_digit(const char ch); +int text_check_identifier(const char ch); +int text_check_whitespace(const char ch); /* Undo opcodes */ diff --git a/source/blender/blenkernel/intern/DerivedMesh.c b/source/blender/blenkernel/intern/DerivedMesh.c index 65ef4e5b431..05f5bca03e4 100644 --- a/source/blender/blenkernel/intern/DerivedMesh.c +++ b/source/blender/blenkernel/intern/DerivedMesh.c @@ -31,7 +31,7 @@ #include <string.h> -#include "limits.h" +#include <limits.h> #include "MEM_guardedalloc.h" diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c index 9715058c51f..4ce159b8aaf 100644 --- a/source/blender/blenkernel/intern/text.c +++ b/source/blender/blenkernel/intern/text.c @@ -622,7 +622,7 @@ void write_text(Text *text, const char *str) /* called directly from rna */ /* Editing utility functions */ /*****************************/ -static void make_new_line (TextLine *line, char *newline) +static void make_new_line(TextLine *line, char *newline) { if (line->line) MEM_freeN(line->line); if (line->format) MEM_freeN(line->format); @@ -770,7 +770,7 @@ static void txt_curs_first (Text *text, TextLine **linep, int *charp) /* Cursor movement functions */ /*****************************/ -int txt_utf8_offset_to_index(char *str, int offset) +int txt_utf8_offset_to_index(const char *str, int offset) { int index= 0, pos= 0; while (pos != offset) { @@ -780,7 +780,7 @@ int txt_utf8_offset_to_index(char *str, int offset) return index; } -int txt_utf8_index_to_offset(char *str, int index) +int txt_utf8_index_to_offset(const char *str, int index) { int offset= 0, pos= 0; while (pos != index) { @@ -3244,7 +3244,7 @@ TextMarker *txt_next_marker(Text *text, TextMarker *marker) /* Character utility functions */ /*******************************/ -int text_check_bracket(char ch) +int text_check_bracket(const char ch) { int a; char opens[] = "([{"; @@ -3259,10 +3259,11 @@ int text_check_bracket(char ch) return 0; } -int text_check_delim(char ch) +/* TODO, have a function for operators - http://docs.python.org/py3k/reference/lexical_analysis.html#operators */ +int text_check_delim(const char ch) { int a; - char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,"; + char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,@"; for (a=0; a<(sizeof(delims)-1); a++) { if (ch==delims[a]) @@ -3271,14 +3272,14 @@ int text_check_delim(char ch) return 0; } -int text_check_digit(char ch) +int text_check_digit(const char ch) { if (ch < '0') return 0; if (ch <= '9') return 1; return 0; } -int text_check_identifier(char ch) +int text_check_identifier(const char ch) { if (ch < '0') return 0; if (ch <= '9') return 1; @@ -3289,7 +3290,7 @@ int text_check_identifier(char ch) return 0; } -int text_check_whitespace(char ch) +int text_check_whitespace(const char ch) { if (ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n') return 1; diff --git a/source/blender/editors/space_text/text_draw.c b/source/blender/editors/space_text/text_draw.c index 98560be477d..84f960ecf2a 100644 --- a/source/blender/editors/space_text/text_draw.c +++ b/source/blender/editors/space_text/text_draw.c @@ -184,16 +184,23 @@ void flatten_string_free(FlattenString *fs) * a non-identifier (see text_check_identifier(char)) or null character. * * If a built-in function is found, the length of the matching name is returned. - * Otherwise, -1 is returned. */ + * Otherwise, -1 is returned. + * + * See: + * http://docs.python.org/py3k/reference/lexical_analysis.html#keywords + */ static int find_builtinfunc(char *string) { int a, i; - char builtinfuncs[][9] = {"and", "as", "assert", "break", "class", "continue", "def", - "del", "elif", "else", "except", "exec", "finally", - "for", "from", "global", "if", "import", "in", - "is", "lambda", "not", "or", "pass", "print", - "raise", "return", "try", "while", "yield", "with"}; + const char *builtinfuncs[] = { + /* "False", "None", "True", */ /* see find_bool() */ + "and", "as", "assert", "break", + "class", "continue", "def", "del", "elif", "else", "except", + "finally", "for", "from", "global", "if", "import", "in", + "is", "lambda", "nonlocal", "not", "or", "pass", "raise", + "return", "try", "while", "with", "yield", + }; for (a = 0; a < sizeof(builtinfuncs) / sizeof(builtinfuncs[0]); a++) { i = 0; diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 651b6fd9c16..e106f8236c9 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -376,16 +376,14 @@ static int rna_validate_identifier(const char *identifier, char *error, int prop { int a = 0; - /* list from http://docs.python.org/reference/lexical_analysis.html#id5 */ + /* list from http://docs.python.org/py3k/reference/lexical_analysis.html#keywords */ static const char *kwlist[] = { + /* "False", "None", "True", */ "and", "as", "assert", "break", - "class", "continue", "def", "del", - "elif", "else", "except", "exec", - "finally", "for", "from", "global", - "if", "import", "in", "is", - "lambda", "not", "or", "pass", - "print", "raise", "return", "try", - "while", "with", "yield", NULL + "class", "continue", "def", "del", "elif", "else", "except", + "finally", "for", "from", "global", "if", "import", "in", + "is", "lambda", "nonlocal", "not", "or", "pass", "raise", + "return", "try", "while", "with", "yield", NULL }; diff --git a/source/blender/makesrna/intern/rna_particle.c b/source/blender/makesrna/intern/rna_particle.c index 18bbf2bca12..d1ccccd7387 100644 --- a/source/blender/makesrna/intern/rna_particle.c +++ b/source/blender/makesrna/intern/rna_particle.c @@ -30,8 +30,7 @@ #include <stdio.h> #include <stdlib.h> - -#include "limits.h" +#include <limits.h> #include "RNA_define.h" #include "RNA_enum_types.h" diff --git a/source/blender/makesrna/intern/rna_userdef.c b/source/blender/makesrna/intern/rna_userdef.c index ed63b03b86a..254425e6bd4 100644 --- a/source/blender/makesrna/intern/rna_userdef.c +++ b/source/blender/makesrna/intern/rna_userdef.c @@ -1452,11 +1452,14 @@ static void rna_def_userdef_theme_space_text(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Line Numbers Background", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); + /* no longer used */ +#if 0 prop = RNA_def_property(srna, "scroll_bar", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "shade1"); RNA_def_property_array(prop, 3); RNA_def_property_ui_text(prop, "Scroll Bar", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); +#endif prop = RNA_def_property(srna, "selected_text", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "shade2"); @@ -1479,7 +1482,7 @@ static void rna_def_userdef_theme_space_text(BlenderRNA *brna) prop = RNA_def_property(srna, "syntax_special", PROP_FLOAT, PROP_COLOR_GAMMA); RNA_def_property_float_sdna(prop, NULL, "syntaxv"); RNA_def_property_array(prop, 3); - RNA_def_property_ui_text(prop, "Syntax Special", ""); + RNA_def_property_ui_text(prop, "Decorator", ""); RNA_def_property_update(prop, 0, "rna_userdef_update"); prop = RNA_def_property(srna, "syntax_comment", PROP_FLOAT, PROP_COLOR_GAMMA); |