Merge with -r 22620:23107.
[blender.git] / source / blender / makesrna / intern / rna_test.c
index bfaf318..48f2fef 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * $Id: rna_test.c  $
+ * $Id$
  *
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
 
 #define ARRAY_SIZE 3
 #define DYNAMIC_ARRAY_SIZE 64
-#define MARRAY_DIM [3][4][5]
-#define MARRAY_TOTDIM 3
-#define MARRAY_DIMSIZE 4, 5
-#define MARRAY_SIZE(type) (sizeof(type MARRAY_DIM) / sizeof(type))
-#define DYNAMIC_MARRAY_DIM [3][4][5]
-#define DYNAMIC_MARRAY_SIZE(type) (sizeof(type DYNAMIC_MARRAY_DIM) / sizeof(type))
+#define MULTI_ARRAY_DIM [3][4][5]
+#define MULTI_ARRAY_TOTDIM 3
+#define MULTI_ARRAY_LENGTH 3, 4, 5
+#define MULTI_ARRAY_SIZE(type) (sizeof(type MULTI_ARRAY_DIM) / sizeof(type))
+#define DYNAMIC_MULTI_ARRAY_DIM [3][4][5]
+#define DYNAMIC_MULTI_ARRAY_SIZE(type) (sizeof(type DYNAMIC_MULTI_ARRAY_DIM) / sizeof(type))
 
 #ifdef RNA_RUNTIME
 
 #ifdef UNIT_TEST
 
-#define DEF_VARS(type, prefix)                                                         \
-       static type prefix ## arr[ARRAY_SIZE];                                  \
-       static type prefix ## darr[DYNAMIC_ARRAY_SIZE];                 \
-       static int prefix ## darr_len= ARRAY_SIZE;                              \
-       static type prefix ## marr MARRAY_DIM;                                  \
-       static type prefix ## dmarr DYNAMIC_MARRAY_DIM;                 \
+#define DEF_VARS(type, prefix)                                                                 \
+       static type prefix ## arr[ARRAY_SIZE];                                          \
+       static type prefix ## darr[DYNAMIC_ARRAY_SIZE];                         \
+       static int prefix ## darr_len= ARRAY_SIZE;                                      \
+       static type prefix ## marr MULTI_ARRAY_DIM;                                     \
+       static type prefix ## dmarr DYNAMIC_MULTI_ARRAY_DIM;            \
        static int prefix ## dmarr_len= sizeof(prefix ## dmarr);
 
 #define DEF_GET_SET(type, arr)                                                                                 \
@@ -68,7 +68,7 @@
        static int rna_Test_ ## arr ## _get_length(PointerRNA *ptr)                     \
        {                                                                                                                                       \
                return arr ## _len;                                                                                             \
-       }                                                                                                                                       \
+       }/*                                                                                                                                     \
                                                                                                                                                \
        static int rna_Test_ ## arr ## _set_length(PointerRNA *ptr, int length) \
        {                                                                                                                                       \
@@ -79,6 +79,7 @@
                                                                                                                                                \
                return 1;                                                                                                               \
        }                                                                                                                                       \
+        */
 
 DEF_VARS(float, f)
 DEF_VARS(int, i)
@@ -100,11 +101,11 @@ DEF_GET_SET(int, bdarr)
 DEF_GET_SET_LEN(bdarr, DYNAMIC_ARRAY_SIZE)
 
 DEF_GET_SET(float, fdmarr)
-DEF_GET_SET_LEN(fdmarr, DYNAMIC_MARRAY_SIZE(float))
+DEF_GET_SET_LEN(fdmarr, DYNAMIC_MULTI_ARRAY_SIZE(float))
 DEF_GET_SET(int, idmarr)
-DEF_GET_SET_LEN(idmarr, DYNAMIC_MARRAY_SIZE(int))
+DEF_GET_SET_LEN(idmarr, DYNAMIC_MULTI_ARRAY_SIZE(int))
 DEF_GET_SET(int, bdmarr)
-DEF_GET_SET_LEN(bdmarr, DYNAMIC_MARRAY_SIZE(int))
+DEF_GET_SET_LEN(bdmarr, DYNAMIC_MULTI_ARRAY_SIZE(int))
 
 #endif
 
@@ -115,7 +116,7 @@ void RNA_def_test(BlenderRNA *brna)
 #ifdef UNIT_TEST
        StructRNA *srna;
        PropertyRNA *prop;
-       unsigned short dimsize[]= {MARRAY_DIMSIZE};
+       int dimsize[]= {MULTI_ARRAY_LENGTH};
 
        srna= RNA_def_struct(brna, "Test", NULL);
        RNA_def_struct_sdna(srna, "Test");
@@ -133,51 +134,51 @@ void RNA_def_test(BlenderRNA *brna)
 
        prop= RNA_def_float_array(srna, "fdarr", DYNAMIC_ARRAY_SIZE, NULL, 0.0f, 0.0f, "fdarr", "dynamic float array", 0.0f, 0.0f);
        RNA_def_property_flag(prop, PROP_DYNAMIC);
-       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdarr_get_length", "rna_Test_fdarr_set_length");
+       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdarr_get_length");
        RNA_def_property_float_funcs(prop, "rna_Test_fdarr_get", "rna_Test_fdarr_set", NULL);
 
        prop= RNA_def_int_array(srna, "idarr", DYNAMIC_ARRAY_SIZE, NULL, 0, 0, "idarr", "int array", 0, 0);
        RNA_def_property_flag(prop, PROP_DYNAMIC);
-       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idarr_get_length", "rna_Test_idarr_set_length");
+       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idarr_get_length");
        RNA_def_property_int_funcs(prop, "rna_Test_idarr_get", "rna_Test_idarr_set", NULL);
        
        prop= RNA_def_boolean_array(srna, "bdarr", DYNAMIC_ARRAY_SIZE, NULL, "bdarr", "boolean array");
        RNA_def_property_flag(prop, PROP_DYNAMIC);
-       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdarr_get_length", "rna_Test_bdarr_set_length");
+       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdarr_get_length");
        RNA_def_property_boolean_funcs(prop, "rna_Test_bdarr_get", "rna_Test_bdarr_set");
 
        /* multidimensional arrays */
 
        prop= RNA_def_property(srna, "fmarr", PROP_FLOAT, PROP_NONE);
-       RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
+       RNA_def_property_multi_array(prop, MULTI_ARRAY_TOTDIM, dimsize);
        RNA_def_property_float_funcs(prop, "rna_Test_fmarr_get", "rna_Test_fmarr_set", NULL);
 
        prop= RNA_def_property(srna, "imarr", PROP_INT, PROP_NONE);
-       RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
+       RNA_def_property_multi_array(prop, MULTI_ARRAY_TOTDIM, dimsize);
        RNA_def_property_int_funcs(prop, "rna_Test_imarr_get", "rna_Test_imarr_set", NULL);
 
        prop= RNA_def_property(srna, "bmarr", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_multidimensional_array(prop, MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
+       RNA_def_property_multi_array(prop, MULTI_ARRAY_TOTDIM, dimsize);
        RNA_def_property_boolean_funcs(prop, "rna_Test_bmarr_get", "rna_Test_bmarr_set");
 
        /* dynamic multidimensional arrays */
 
        prop= RNA_def_property(srna, "fdmarr", PROP_FLOAT, PROP_NONE);
-       RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(float), MARRAY_TOTDIM, dimsize);
+       RNA_def_property_multi_array(prop, MULTI_ARRAY_TOTDIM, dimsize);
        RNA_def_property_flag(prop, PROP_DYNAMIC);
-       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdmarr_get_length", "rna_Test_fdmarr_set_length");
+       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_fdmarr_get_length");
        RNA_def_property_float_funcs(prop, "rna_Test_fdmarr_get", "rna_Test_fdmarr_set", NULL);
 
        prop= RNA_def_property(srna, "idmarr", PROP_INT, PROP_NONE);
-       RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
+       RNA_def_property_multi_array(prop, MULTI_ARRAY_TOTDIM, dimsize);
        RNA_def_property_flag(prop, PROP_DYNAMIC);
-       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idmarr_get_length", "rna_Test_idmarr_set_length");
+       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_idmarr_get_length");
        RNA_def_property_int_funcs(prop, "rna_Test_idmarr_get", "rna_Test_idmarr_set", NULL);
 
        prop= RNA_def_property(srna, "bdmarr", PROP_BOOLEAN, PROP_NONE);
-       RNA_def_property_multidimensional_array(prop, DYNAMIC_MARRAY_SIZE(int), MARRAY_TOTDIM, dimsize);
+       RNA_def_property_multi_array(prop, MULTI_ARRAY_TOTDIM, dimsize);
        RNA_def_property_flag(prop, PROP_DYNAMIC);
-       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdmarr_get_length", "rna_Test_bdmarr_set_length");
+       RNA_def_property_dynamic_array_funcs(prop, "rna_Test_bdmarr_get_length");
        RNA_def_property_boolean_funcs(prop, "rna_Test_bdmarr_get", "rna_Test_bdmarr_set");
 
 #endif