From f1a227cf432d6b95bc7cef67a68aaf1c62caafc7 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 21 Sep 2011 17:52:51 +0000 Subject: check that descriptions dont end with a '.', for non release builds. this is annoying for translators so rather then correct along the way which gives merge conflicts for branches - print a complaint message. --- source/blender/makesrna/intern/rna_define.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'source/blender/makesrna/intern/rna_define.c') diff --git a/source/blender/makesrna/intern/rna_define.c b/source/blender/makesrna/intern/rna_define.c index 8af65b97ffc..63b3aed4a3b 100644 --- a/source/blender/makesrna/intern/rna_define.c +++ b/source/blender/makesrna/intern/rna_define.c @@ -58,6 +58,21 @@ BlenderDefRNA DefRNA = {NULL, {NULL, NULL}, {NULL, NULL}, NULL, 0, 0, 0, 1}; #define MAX2(x,y) ((x)>(y)? (x): (y)) #endif +/* pedantic check for '.', do this since its a hassle for translators */ +#ifndef NDEBUG +# define DESCR_CHECK(description, id1, id2) \ + if(description && (description)[0]) { \ + int i = strlen(description); \ + if((description)[i - 1] == '.') { \ + fprintf(stderr, "%s: '%s' '%s' description ends with a '.' !\n", \ + __func__, id1 ? id1 : "", id2 ? id2 : ""); \ + } \ + } \ + +#else +# define DESCR_CHECK(description, id1, id2) +#endif + void rna_addtail(ListBase *listbase, void *vlink) { Link *link= vlink; @@ -847,6 +862,8 @@ void RNA_def_struct_identifier(StructRNA *srna, const char *identifier) void RNA_def_struct_ui_text(StructRNA *srna, const char *name, const char *description) { + DESCR_CHECK(description, srna->identifier, NULL); + srna->name= name; srna->description= description; } @@ -1109,6 +1126,8 @@ void RNA_def_property_multi_array(PropertyRNA *prop, int dimension, const int le void RNA_def_property_ui_text(PropertyRNA *prop, const char *name, const char *description) { + DESCR_CHECK(description, prop->identifier, NULL); + prop->name= name; prop->description= description; } -- cgit v1.2.3