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>2009-09-22 20:23:46 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-09-22 20:23:46 +0400
commitd86864027d449114868ec531b9ccf6dd19dbe67f (patch)
treecccdba556255c55703f1324d8c11fcd6b657ff02 /source/blender/blenkernel/intern/text.c
parent87f5f194bcf8a4bb8a22b8402d8bb088084d6489 (diff)
PyConsole improvements
- Commands from the history wont get modified in-place when you cycle back and re-use them. - Ctrl Left/Right skip words. - Autocompletion on a variable that has no alternatives adds a '.' 'bpy' -> 'bpy.', generally more useful since autocomp again will give the members of bpy also moved text_check_* functions into BKE_text.h for the console to access.
Diffstat (limited to 'source/blender/blenkernel/intern/text.c')
-rw-r--r--source/blender/blenkernel/intern/text.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/source/blender/blenkernel/intern/text.c b/source/blender/blenkernel/intern/text.c
index 270cd873ff5..8bf0f6b8bdf 100644
--- a/source/blender/blenkernel/intern/text.c
+++ b/source/blender/blenkernel/intern/text.c
@@ -2832,3 +2832,60 @@ TextMarker *txt_next_marker(Text *text, TextMarker *marker) {
}
return NULL; /* Only if marker==NULL */
}
+
+
+/*******************************/
+/* Character utility functions */
+/*******************************/
+
+int text_check_bracket(char ch)
+{
+ int a;
+ char opens[] = "([{";
+ char close[] = ")]}";
+
+ for(a=0; a<(sizeof(opens)-1); a++) {
+ if(ch==opens[a])
+ return a+1;
+ else if(ch==close[a])
+ return -(a+1);
+ }
+ return 0;
+}
+
+int text_check_delim(char ch)
+{
+ int a;
+ char delims[] = "():\"\' ~!%^&*-+=[]{};/<>|.#\t,";
+
+ for(a=0; a<(sizeof(delims)-1); a++) {
+ if(ch==delims[a])
+ return 1;
+ }
+ return 0;
+}
+
+int text_check_digit(char ch)
+{
+ if(ch < '0') return 0;
+ if(ch <= '9') return 1;
+ return 0;
+}
+
+int text_check_identifier(char ch)
+{
+ if(ch < '0') return 0;
+ if(ch <= '9') return 1;
+ if(ch < 'A') return 0;
+ if(ch <= 'Z' || ch == '_') return 1;
+ if(ch < 'a') return 0;
+ if(ch <= 'z') return 1;
+ return 0;
+}
+
+int text_check_whitespace(char ch)
+{
+ if(ch == ' ' || ch == '\t' || ch == '\r' || ch == '\n')
+ return 1;
+ return 0;
+}