diff options
author | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-27 16:25:06 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@pandora.be> | 2010-01-27 16:25:06 +0300 |
commit | 0e31581778aa8685d43c19e17c4a66c9dfa1c41c (patch) | |
tree | 2c00a2bc004653d0d56880df758a7ae489936ec0 /source/blender/makesdna/intern | |
parent | f8200f14ae2991b97e0c0edb4b8ecfb1c60d0e22 (diff) |
SDNA: fix for parsing struct members like:
float (*disps)[3];
It still isn't advised to use this syntax, best to just use regular pointers,
however at least it is working better now. Previously this would lead to the
rest of the header file to be included right in the SDNA. If you look into an
existing .B25.blend file with a text editor, you can see the second half of
DNA_meshdata_types.h...
Diffstat (limited to 'source/blender/makesdna/intern')
-rw-r--r-- | source/blender/makesdna/intern/makesdna.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/source/blender/makesdna/intern/makesdna.c b/source/blender/makesdna/intern/makesdna.c index 905dae7b0a5..d7e01e9559f 100644 --- a/source/blender/makesdna/intern/makesdna.c +++ b/source/blender/makesdna/intern/makesdna.c @@ -277,7 +277,13 @@ int add_name(char *str) if((str[0]==0) /* || (str[1]==0) */) return -1; if (str[0] == '(' && str[1] == '*') { - if (debugSDNA > 3) printf("\t\t\t\t*** Function pointer found\n"); + /* we handle function pointer and special array cases here, e.g. + void (*function)(...) and float (*array)[..]. the array case + name is still converted to (array*)() though because it is that + way in old dna too, and works correct with elementsize() */ + int isfuncptr = (strchr(str+1, '(')) != NULL; + + if (debugSDNA > 3) printf("\t\t\t\t*** Function pointer or multidim array pointer found\n"); /* functionpointer: transform the type (sometimes) */ i = 0; j = 0; @@ -302,7 +308,15 @@ int add_name(char *str) if (debugSDNA > 3) printf("seen %c ( %d) \n", str[j], str[j]); if (debugSDNA > 3) printf("special after offset %d\n", j); - if (str[j] == 0 ) { + if (!isfuncptr) { + /* multidimensional array pointer case */ + if(str[j] == 0) { + if (debugSDNA > 3) printf("offsetting for multidim array pointer\n"); + } + else + printf("Error during tokening multidim array pointer\n"); + } + else if (str[j] == 0 ) { if (debugSDNA > 3) printf("offsetting for space\n"); /* get additional offset */ k = 0; |