Revision: 26335
          
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=26335
Author:   blendix
Date:     2010-01-27 14:25:06 +0100 (Wed, 27 Jan 2010)

Log Message:
-----------
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...

Modified Paths:
--------------
    trunk/blender/source/blender/makesdna/intern/makesdna.c

Modified: trunk/blender/source/blender/makesdna/intern/makesdna.c
===================================================================
--- trunk/blender/source/blender/makesdna/intern/makesdna.c     2010-01-27 
12:53:25 UTC (rev 26334)
+++ trunk/blender/source/blender/makesdna/intern/makesdna.c     2010-01-27 
13:25:06 UTC (rev 26335)
@@ -277,7 +277,13 @@
        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 @@
                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;


_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to