From 7f2838002f565bcaac8f9267a64520d44c254f41 Mon Sep 17 00:00:00 2001 From: David Gobbi Date: Mon, 10 Jun 2019 18:01:40 -0600 Subject: [PATCH 1/2] Improve handling of unqualified identifiers When an identifier (e.g. an enum constant) is used in the wrappers, it must be fully qualified. This code adds the qualifiers so that the identifier can be found. --- Wrapping/Tools/vtkWrap.c | 77 +++++++++++++++++++++++++++++++++++++++- Wrapping/Tools/vtkWrap.h | 7 ++++ 2 files changed, 83 insertions(+), 1 deletion(-) diff --git a/Wrapping/Tools/vtkWrap.c b/Wrapping/Tools/vtkWrap.c index 96886a35716..deb082e28f4 100644 --- a/Wrapping/Tools/vtkWrap.c +++ b/Wrapping/Tools/vtkWrap.c @@ -1109,7 +1109,8 @@ void vtkWrap_DeclareVariable( /* add a default value */ else if (val->Value) { - fprintf(fp, " = %s", val->Value); + fprintf(fp, " = "); + vtkWrap_QualifyExpression(fp, data, val->Value); } else if (aType == VTK_PARSE_CHAR_PTR || aType == VTK_PARSE_VOID_PTR || @@ -1179,6 +1180,80 @@ void vtkWrap_DeclareVariableSize( } } +void vtkWrap_QualifyExpression( + FILE *fp, ClassInfo *data, const char *text) +{ + StringTokenizer t; + int qualified = 0; + int matched; + int j; + + /* tokenize the text according to C/C++ rules */ + vtkParse_InitTokenizer(&t, text, WS_DEFAULT); + do + { + /* check whether we have found an unqualified identifier */ + matched = 0; + if (t.tok == TOK_ID && !qualified) + { + /* check for class members */ + for (j = 0; j < data->NumberOfItems; j++) + { + ItemInfo *item = &data->Items[j]; + const char *name = NULL; + + if (item->Type == VTK_CONSTANT_INFO) + { + /* enum values and other constants */ + name = data->Constants[item->Index]->Name; + } + else if (item->Type == VTK_CLASS_INFO || + item->Type == VTK_STRUCT_INFO || + item->Type == VTK_UNION_INFO) + { + /* embedded classes */ + name = data->Classes[item->Index]->Name; + } + else if (item->Type == VTK_ENUM_INFO) + { + /* enum type */ + name = data->Enums[item->Index]->Name; + } + else if (item->Type == VTK_TYPEDEF_INFO) + { + /* typedef'd type */ + name = data->Typedefs[item->Index]->Name; + } + + if (name && strlen(name) == t.len && + strncmp(name, t.text, t.len) == 0) + { + fprintf(fp, "%s::%s", data->Name, name); + matched = 1; + break; + } + } + } + + if (!matched) + { + fprintf(fp, "%*.*s", (int)t.len, (int)t.len, t.text); + } + + /* if next character is whitespace, add a space */ + if (vtkParse_CharType(t.text[t.len], CPRE_WHITE)) + { + fprintf(fp, " "); + } + + /* check whether the next identifier is qualified */ + qualified = (t.tok == TOK_SCOPE || + t.tok == TOK_ARROW || + t.tok == '.'); + } + while (vtkParse_NextToken(&t)); +} + char *vtkWrap_SafeSuperclassName(const char *name) { int template_class = 0; diff --git a/Wrapping/Tools/vtkWrap.h b/Wrapping/Tools/vtkWrap.h index 95d2908837a..9682c6be53e 100644 --- a/Wrapping/Tools/vtkWrap.h +++ b/Wrapping/Tools/vtkWrap.h @@ -271,6 +271,13 @@ void vtkWrap_DeclareVariable( void vtkWrap_DeclareVariableSize( FILE *fp, ValueInfo *v, const char *name, int idx); +/** + * Qualify all the unqualified identifiers in the given expression + * and print the result to the file. + */ +void vtkWrap_QualifyExpression( + FILE *fp, ClassInfo *data, const char *text); + /** * Makes a superclass name into a valid identifier. Returns NULL if the given * name is valid as-is. -- GitLab From ee089180270aba26bac2f6746a52ea37afe1d22d Mon Sep 17 00:00:00 2001 From: David Gobbi Date: Mon, 10 Jun 2019 18:03:32 -0600 Subject: [PATCH 2/2] Remove old code for adding qualifiers The wrapper front-end used to take care of qualifying enum constants by adding scope to them. This is better taken care of at the back end. --- Wrapping/Tools/vtkParse.tab.c | 254 +++++++++------------------------- Wrapping/Tools/vtkParse.y | 119 +--------------- 2 files changed, 70 insertions(+), 303 deletions(-) diff --git a/Wrapping/Tools/vtkParse.tab.c b/Wrapping/Tools/vtkParse.tab.c index f88e21d6ea4..6dec5077306 100644 --- a/Wrapping/Tools/vtkParse.tab.c +++ b/Wrapping/Tools/vtkParse.tab.c @@ -242,8 +242,6 @@ void output_function(void); void reject_function(void); void set_return(FunctionInfo *func, unsigned int type, const char *typeclass, int count); -void add_parameter(FunctionInfo *func, unsigned int type, - const char *classname, int count); void add_template_parameter(unsigned int datatype, unsigned int extra, const char *funcSig); void add_using(const char *name, int is_namespace); @@ -254,7 +252,6 @@ void end_enum(void); unsigned int guess_constant_type(const char *value); void add_constant(const char *name, const char *value, unsigned int type, const char *typeclass, int global); -const char *add_const_scope(const char *name); void prepend_scope(char *cp, const char *arg); unsigned int guess_id_type(const char *cp); unsigned int add_indirection(unsigned int tval, unsigned int ptr); @@ -2126,74 +2123,74 @@ static const unsigned char yytranslate[] = /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ static const unsigned short int yyrline[] = { - 0, 1904, 1904, 1906, 1908, 1907, 1918, 1919, 1920, 1921, - 1922, 1923, 1924, 1925, 1926, 1927, 1928, 1929, 1930, 1931, - 1932, 1933, 1934, 1937, 1938, 1939, 1940, 1941, 1942, 1945, - 1946, 1953, 1960, 1961, 1961, 1965, 1972, 1973, 1976, 1977, - 1978, 1981, 1982, 1985, 1985, 2000, 1999, 2005, 2011, 2010, - 2015, 2021, 2022, 2023, 2026, 2028, 2030, 2033, 2034, 2037, - 2038, 2040, 2042, 2041, 2050, 2054, 2055, 2056, 2059, 2060, - 2061, 2062, 2063, 2064, 2065, 2066, 2067, 2068, 2069, 2070, - 2071, 2072, 2075, 2076, 2077, 2078, 2079, 2080, 2083, 2084, - 2085, 2086, 2089, 2090, 2093, 2095, 2098, 2103, 2104, 2107, - 2108, 2111, 2112, 2113, 2124, 2125, 2126, 2130, 2131, 2135, - 2135, 2148, 2154, 2162, 2163, 2164, 2167, 2168, 2168, 2172, - 2173, 2175, 2176, 2177, 2177, 2185, 2189, 2190, 2193, 2195, - 2197, 2198, 2201, 2202, 2210, 2211, 2214, 2215, 2217, 2219, - 2221, 2225, 2227, 2228, 2231, 2234, 2235, 2238, 2239, 2238, - 2243, 2284, 2287, 2288, 2289, 2291, 2293, 2295, 2299, 2302, - 2302, 2334, 2337, 2336, 2354, 2356, 2355, 2360, 2362, 2360, - 2364, 2366, 2364, 2368, 2371, 2368, 2382, 2383, 2386, 2387, - 2389, 2390, 2393, 2393, 2403, 2404, 2412, 2413, 2414, 2415, - 2418, 2421, 2422, 2423, 2426, 2427, 2428, 2431, 2432, 2433, - 2437, 2438, 2439, 2440, 2443, 2444, 2445, 2449, 2454, 2448, - 2466, 2470, 2481, 2480, 2489, 2493, 2496, 2506, 2510, 2511, - 2514, 2515, 2517, 2518, 2519, 2522, 2523, 2525, 2526, 2527, - 2529, 2530, 2533, 2546, 2547, 2548, 2549, 2556, 2557, 2560, - 2560, 2568, 2569, 2570, 2573, 2575, 2576, 2580, 2579, 2596, - 2614, 2592, 2625, 2625, 2628, 2629, 2632, 2633, 2636, 2637, - 2643, 2644, 2644, 2647, 2648, 2648, 2650, 2652, 2656, 2658, - 2656, 2682, 2683, 2686, 2686, 2688, 2688, 2690, 2690, 2695, - 2696, 2696, 2704, 2707, 2777, 2778, 2780, 2781, 2781, 2784, - 2787, 2788, 2792, 2804, 2803, 2822, 2824, 2824, 2842, 2842, - 2844, 2848, 2849, 2850, 2849, 2855, 2857, 2858, 2859, 2860, - 2861, 2862, 2865, 2866, 2870, 2871, 2875, 2876, 2879, 2880, - 2884, 2885, 2886, 2887, 2890, 2891, 2894, 2894, 2897, 2898, - 2901, 2901, 2905, 2906, 2906, 2913, 2914, 2917, 2918, 2919, - 2920, 2921, 2924, 2926, 2928, 2932, 2934, 2936, 2938, 2940, - 2942, 2944, 2944, 2949, 2952, 2955, 2958, 2958, 2966, 2966, - 2975, 2976, 2977, 2978, 2979, 2980, 2981, 2982, 2983, 2984, - 2991, 2992, 2993, 2994, 2995, 2996, 2997, 3003, 3004, 3007, - 3008, 3010, 3011, 3014, 3015, 3018, 3019, 3020, 3021, 3024, - 3025, 3026, 3027, 3028, 3032, 3033, 3034, 3037, 3038, 3041, - 3042, 3050, 3053, 3053, 3055, 3055, 3059, 3060, 3062, 3066, - 3067, 3069, 3069, 3072, 3074, 3078, 3081, 3081, 3083, 3083, - 3087, 3090, 3090, 3092, 3092, 3096, 3097, 3099, 3101, 3103, - 3105, 3107, 3111, 3112, 3115, 3116, 3117, 3118, 3119, 3120, - 3121, 3122, 3123, 3124, 3127, 3128, 3129, 3130, 3131, 3132, - 3133, 3134, 3135, 3136, 3137, 3138, 3139, 3140, 3141, 3161, - 3162, 3163, 3164, 3167, 3171, 3175, 3175, 3179, 3180, 3195, - 3196, 3221, 3221, 3225, 3225, 3229, 3229, 3233, 3233, 3237, - 3237, 3241, 3241, 3244, 3245, 3248, 3252, 3253, 3256, 3259, - 3260, 3261, 3262, 3265, 3265, 3269, 3270, 3273, 3274, 3277, - 3278, 3285, 3286, 3287, 3288, 3289, 3290, 3291, 3292, 3293, - 3294, 3295, 3296, 3299, 3300, 3301, 3302, 3303, 3304, 3305, - 3306, 3307, 3308, 3309, 3310, 3311, 3312, 3313, 3314, 3315, - 3316, 3317, 3318, 3319, 3320, 3321, 3322, 3323, 3324, 3325, - 3326, 3327, 3328, 3329, 3330, 3331, 3332, 3335, 3336, 3337, - 3338, 3339, 3340, 3341, 3342, 3343, 3344, 3345, 3346, 3347, - 3348, 3349, 3350, 3351, 3352, 3353, 3354, 3355, 3356, 3357, - 3358, 3359, 3360, 3361, 3362, 3363, 3364, 3367, 3368, 3369, - 3370, 3371, 3372, 3373, 3374, 3375, 3382, 3383, 3386, 3387, - 3388, 3389, 3389, 3390, 3393, 3394, 3397, 3398, 3399, 3400, - 3435, 3435, 3436, 3437, 3438, 3439, 3462, 3463, 3466, 3467, - 3468, 3469, 3472, 3473, 3474, 3477, 3478, 3480, 3481, 3483, - 3484, 3487, 3488, 3491, 3492, 3493, 3497, 3496, 3510, 3511, - 3514, 3514, 3516, 3516, 3520, 3520, 3522, 3522, 3524, 3524, - 3528, 3528, 3533, 3534, 3536, 3537, 3540, 3541, 3544, 3545, - 3548, 3549, 3550, 3551, 3552, 3553, 3554, 3555, 3555, 3555, - 3555, 3555, 3556, 3557, 3558, 3559, 3560, 3563, 3566, 3567, - 3570, 3573, 3573, 3573 + 0, 1901, 1901, 1903, 1905, 1904, 1915, 1916, 1917, 1918, + 1919, 1920, 1921, 1922, 1923, 1924, 1925, 1926, 1927, 1928, + 1929, 1930, 1931, 1934, 1935, 1936, 1937, 1938, 1939, 1942, + 1943, 1950, 1957, 1958, 1958, 1962, 1969, 1970, 1973, 1974, + 1975, 1978, 1979, 1982, 1982, 1997, 1996, 2002, 2008, 2007, + 2012, 2018, 2019, 2020, 2023, 2025, 2027, 2030, 2031, 2034, + 2035, 2037, 2039, 2038, 2047, 2051, 2052, 2053, 2056, 2057, + 2058, 2059, 2060, 2061, 2062, 2063, 2064, 2065, 2066, 2067, + 2068, 2069, 2072, 2073, 2074, 2075, 2076, 2077, 2080, 2081, + 2082, 2083, 2086, 2087, 2090, 2092, 2095, 2100, 2101, 2104, + 2105, 2108, 2109, 2110, 2121, 2122, 2123, 2127, 2128, 2132, + 2132, 2145, 2151, 2159, 2160, 2161, 2164, 2165, 2165, 2169, + 2170, 2172, 2173, 2174, 2174, 2182, 2186, 2187, 2190, 2192, + 2194, 2195, 2198, 2199, 2207, 2208, 2211, 2212, 2214, 2216, + 2218, 2222, 2224, 2225, 2228, 2231, 2232, 2235, 2236, 2235, + 2240, 2281, 2284, 2285, 2286, 2288, 2290, 2292, 2296, 2299, + 2299, 2331, 2334, 2333, 2351, 2353, 2352, 2357, 2359, 2357, + 2361, 2363, 2361, 2365, 2368, 2365, 2379, 2380, 2383, 2384, + 2386, 2387, 2390, 2390, 2400, 2401, 2409, 2410, 2411, 2412, + 2415, 2418, 2419, 2420, 2423, 2424, 2425, 2428, 2429, 2430, + 2434, 2435, 2436, 2437, 2440, 2441, 2442, 2446, 2451, 2445, + 2463, 2467, 2478, 2477, 2486, 2490, 2493, 2503, 2507, 2508, + 2511, 2512, 2514, 2515, 2516, 2519, 2520, 2522, 2523, 2524, + 2526, 2527, 2530, 2543, 2544, 2545, 2546, 2553, 2554, 2557, + 2557, 2565, 2566, 2567, 2570, 2572, 2573, 2577, 2576, 2593, + 2611, 2589, 2622, 2622, 2625, 2626, 2629, 2630, 2633, 2634, + 2640, 2641, 2641, 2644, 2645, 2645, 2647, 2649, 2653, 2655, + 2653, 2679, 2680, 2683, 2683, 2685, 2685, 2687, 2687, 2692, + 2693, 2693, 2701, 2704, 2774, 2775, 2777, 2778, 2778, 2781, + 2784, 2785, 2789, 2801, 2800, 2819, 2821, 2821, 2839, 2839, + 2841, 2845, 2846, 2847, 2846, 2852, 2854, 2855, 2856, 2857, + 2858, 2859, 2862, 2863, 2867, 2868, 2872, 2873, 2876, 2877, + 2881, 2882, 2883, 2884, 2887, 2888, 2891, 2891, 2894, 2895, + 2898, 2898, 2902, 2903, 2903, 2910, 2911, 2914, 2915, 2916, + 2917, 2918, 2921, 2923, 2925, 2929, 2931, 2933, 2935, 2937, + 2939, 2941, 2941, 2946, 2949, 2952, 2955, 2955, 2963, 2963, + 2972, 2973, 2974, 2975, 2976, 2977, 2978, 2979, 2980, 2981, + 2988, 2989, 2990, 2991, 2992, 2993, 2994, 3000, 3001, 3004, + 3005, 3007, 3008, 3011, 3012, 3015, 3016, 3017, 3018, 3021, + 3022, 3023, 3024, 3025, 3029, 3030, 3031, 3034, 3035, 3038, + 3039, 3047, 3050, 3050, 3052, 3052, 3056, 3057, 3059, 3063, + 3064, 3066, 3066, 3069, 3071, 3075, 3078, 3078, 3080, 3080, + 3084, 3087, 3087, 3089, 3089, 3093, 3094, 3096, 3098, 3100, + 3102, 3104, 3108, 3109, 3112, 3113, 3114, 3115, 3116, 3117, + 3118, 3119, 3120, 3121, 3124, 3125, 3126, 3127, 3128, 3129, + 3130, 3131, 3132, 3133, 3134, 3135, 3136, 3137, 3138, 3158, + 3159, 3160, 3161, 3164, 3168, 3172, 3172, 3176, 3177, 3192, + 3193, 3218, 3218, 3222, 3222, 3226, 3226, 3230, 3230, 3234, + 3234, 3238, 3238, 3241, 3242, 3245, 3249, 3250, 3253, 3256, + 3257, 3258, 3259, 3262, 3262, 3266, 3267, 3270, 3271, 3274, + 3275, 3282, 3283, 3284, 3285, 3286, 3287, 3288, 3289, 3290, + 3291, 3292, 3293, 3296, 3297, 3298, 3299, 3300, 3301, 3302, + 3303, 3304, 3305, 3306, 3307, 3308, 3309, 3310, 3311, 3312, + 3313, 3314, 3315, 3316, 3317, 3318, 3319, 3320, 3321, 3322, + 3323, 3324, 3325, 3326, 3327, 3328, 3329, 3332, 3333, 3334, + 3335, 3336, 3337, 3338, 3339, 3340, 3341, 3342, 3343, 3344, + 3345, 3346, 3347, 3348, 3349, 3350, 3351, 3352, 3353, 3354, + 3355, 3356, 3357, 3358, 3359, 3360, 3361, 3364, 3365, 3366, + 3367, 3368, 3369, 3370, 3371, 3372, 3379, 3380, 3383, 3384, + 3385, 3386, 3386, 3387, 3390, 3391, 3394, 3395, 3396, 3397, + 3432, 3432, 3433, 3434, 3435, 3436, 3438, 3439, 3442, 3443, + 3444, 3445, 3448, 3449, 3450, 3453, 3454, 3456, 3457, 3459, + 3460, 3463, 3464, 3467, 3468, 3469, 3473, 3472, 3486, 3487, + 3490, 3490, 3492, 3492, 3496, 3496, 3498, 3498, 3500, 3500, + 3504, 3504, 3509, 3510, 3512, 3513, 3516, 3517, 3520, 3521, + 3524, 3525, 3526, 3527, 3528, 3529, 3530, 3531, 3531, 3531, + 3531, 3531, 3532, 3533, 3534, 3535, 3536, 3539, 3542, 3543, + 3546, 3549, 3549, 3549 }; #endif @@ -8027,27 +8024,7 @@ yyuserAction (yyRuleNum yyn, size_t yyrhslen, yyGLRStackItem* yyvsp, case 605: - { - int c1 = 0; - size_t l; - const char *cp; - chopSig(); - cp = getSig(); - l = getSigLength(); - if (l != 0) { c1 = cp[l-1]; } - while (vtkParse_CharType(c1, CPRE_XID) && l != 0) - { - --l; - c1 = cp[l-1]; - } - if (l < 2 || cp[l-1] != ':' || cp[l-2] != ':') - { - cp = add_const_scope(&cp[l]); - resetSig(l); - postSig(cp); - } - postSig(" "); - } + { chopSig(); postSig(" "); } break; @@ -10429,75 +10406,6 @@ void add_constant(const char *name, const char *value, } } -/* if the name is a const in this namespace, then scope it */ -const char *add_const_scope(const char *name) -{ - static char text[256]; - NamespaceInfo *scope = currentNamespace; - TemplateInfo *tparams; - const char *classname; - int i, j; - int addscope = 0; - - strcpy(text, name); - - if (currentClass) - { - for (j = 0; j < currentClass->NumberOfConstants; j++) - { - if (strcmp(currentClass->Constants[j]->Name, text) == 0) - { - classname = currentClass->Name; - tparams = currentClass->Template; - if (tparams) - { - classname = vtkstrcat(classname, "<"); - for (i = 0; i < tparams->NumberOfParameters; i++) - { - if (i != 0) - { - classname = vtkstrcat(classname, ","); - } - classname = vtkstrcat(classname, tparams->Parameters[i]->Name); - } - classname = vtkstrcat(classname, ">"); - } - prepend_scope(text, classname); - addscope = 1; - break; - } - } - } - i = namespaceDepth; - while (scope && scope->Name) - { - if (addscope) - { - prepend_scope(text, scope->Name); - } - else - { - for (j = 0; j < scope->NumberOfConstants; j++) - { - if (strcmp(scope->Constants[j]->Name, text) == 0) - { - prepend_scope(text, scope->Name); - addscope = 1; - break; - } - } - } - - scope = 0; - if (i > 0) - { - scope = namespaceStack[--i]; - } - } - - return text; -} - /* guess the type from the ID */ unsigned int guess_id_type(const char *cp) { @@ -10550,30 +10458,6 @@ void add_template_parameter( vtkParse_AddParameterToTemplate(currentTemplate, param); } -/* add a parameter to a function */ -void add_parameter(FunctionInfo *func, unsigned int type, - const char *typeclass, int count) -{ - char text[64]; - ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - - param->Type = type; - param->Class = type_class(type, typeclass); - - if (count) - { - param->Count = count; - sprintf(text, "%i", count); - vtkParse_AddStringToArray(¶m->Dimensions, ¶m->NumberOfDimensions, - vtkstrdup(text)); - } - - add_legacy_parameter(func, param); - - vtkParse_AddParameterToFunction(func, param); -} - /* set the return type for the current function */ void set_return(FunctionInfo *func, unsigned int type, const char *typeclass, int count) diff --git a/Wrapping/Tools/vtkParse.y b/Wrapping/Tools/vtkParse.y index 1681dd1f7cf..29feb5066dd 100644 --- a/Wrapping/Tools/vtkParse.y +++ b/Wrapping/Tools/vtkParse.y @@ -203,8 +203,6 @@ void output_function(void); void reject_function(void); void set_return(FunctionInfo *func, unsigned int type, const char *typeclass, int count); -void add_parameter(FunctionInfo *func, unsigned int type, - const char *classname, int count); void add_template_parameter(unsigned int datatype, unsigned int extra, const char *funcSig); void add_using(const char *name, int is_namespace); @@ -215,7 +213,6 @@ void end_enum(void); unsigned int guess_constant_type(const char *value); void add_constant(const char *name, const char *value, unsigned int type, const char *typeclass, int global); -const char *add_const_scope(const char *name); void prepend_scope(char *cp, const char *arg); unsigned int guess_id_type(const char *cp); unsigned int add_indirection(unsigned int tval, unsigned int ptr); @@ -3436,28 +3433,7 @@ common_bracket_item_no_scope_operator: | keyword { postSig($1); postSig(" "); } | literal { postSig($1); postSig(" "); } | primitive_type - | type_name - { - int c1 = 0; - size_t l; - const char *cp; - chopSig(); - cp = getSig(); - l = getSigLength(); - if (l != 0) { c1 = cp[l-1]; } - while (vtkParse_CharType(c1, CPRE_XID) && l != 0) - { - --l; - c1 = cp[l-1]; - } - if (l < 2 || cp[l-1] != ':' || cp[l-2] != ':') - { - cp = add_const_scope(&cp[l]); - resetSig(l); - postSig(cp); - } - postSig(" "); - } + | type_name { chopSig(); postSig(" "); } any_bracket_contents: | any_bracket_contents any_bracket_item @@ -4126,75 +4102,6 @@ void add_constant(const char *name, const char *value, } } -/* if the name is a const in this namespace, then scope it */ -const char *add_const_scope(const char *name) -{ - static char text[256]; - NamespaceInfo *scope = currentNamespace; - TemplateInfo *tparams; - const char *classname; - int i, j; - int addscope = 0; - - strcpy(text, name); - - if (currentClass) - { - for (j = 0; j < currentClass->NumberOfConstants; j++) - { - if (strcmp(currentClass->Constants[j]->Name, text) == 0) - { - classname = currentClass->Name; - tparams = currentClass->Template; - if (tparams) - { - classname = vtkstrcat(classname, "<"); - for (i = 0; i < tparams->NumberOfParameters; i++) - { - if (i != 0) - { - classname = vtkstrcat(classname, ","); - } - classname = vtkstrcat(classname, tparams->Parameters[i]->Name); - } - classname = vtkstrcat(classname, ">"); - } - prepend_scope(text, classname); - addscope = 1; - break; - } - } - } - i = namespaceDepth; - while (scope && scope->Name) - { - if (addscope) - { - prepend_scope(text, scope->Name); - } - else - { - for (j = 0; j < scope->NumberOfConstants; j++) - { - if (strcmp(scope->Constants[j]->Name, text) == 0) - { - prepend_scope(text, scope->Name); - addscope = 1; - break; - } - } - } - - scope = 0; - if (i > 0) - { - scope = namespaceStack[--i]; - } - } - - return text; -} - /* guess the type from the ID */ unsigned int guess_id_type(const char *cp) { @@ -4247,30 +4154,6 @@ void add_template_parameter( vtkParse_AddParameterToTemplate(currentTemplate, param); } -/* add a parameter to a function */ -void add_parameter(FunctionInfo *func, unsigned int type, - const char *typeclass, int count) -{ - char text[64]; - ValueInfo *param = (ValueInfo *)malloc(sizeof(ValueInfo)); - vtkParse_InitValue(param); - - param->Type = type; - param->Class = type_class(type, typeclass); - - if (count) - { - param->Count = count; - sprintf(text, "%i", count); - vtkParse_AddStringToArray(¶m->Dimensions, ¶m->NumberOfDimensions, - vtkstrdup(text)); - } - - add_legacy_parameter(func, param); - - vtkParse_AddParameterToFunction(func, param); -} - /* set the return type for the current function */ void set_return(FunctionInfo *func, unsigned int type, const char *typeclass, int count) -- GitLab