Commit 79307d76 authored by David Gobbi's avatar David Gobbi Committed by Marcus D. Hanwell
Browse files

ENH: Add a --special option to vtkParse, change calling convention

The old calling convention for vtkParse still works, but the new
convention is as follows:

vtkWrapPython [options] input_file output_file\n"
options:
  --concrete      concrete class (default)
  --abstract      abstract class
  --vtkobject     vtkObjectBase-derived class (default)
  --special       non-vtkObjectBase class
  --hints <file>  hints file
parent 7da8adeb
......@@ -60,11 +60,18 @@ MACRO(VTK_WRAP_PYTHON3 TARGET SRC_LIST_NAME SOURCES)
# is it abstract?
GET_SOURCE_FILE_PROPERTY(TMP_ABSTRACT ${FILE} ABSTRACT)
IF (TMP_ABSTRACT)
SET(TMP_CONCRETE 0)
SET(TMP_CONCRETE "--abstract")
ELSE (TMP_ABSTRACT)
SET(TMP_CONCRETE 1)
SET(TMP_CONCRETE "--concrete")
ENDIF (TMP_ABSTRACT)
# is it special?
IF (TMP_WRAP_SPECIAL)
SET(TMP_SPECIAL "--special")
ELSE (TMP_WRAP_SPECIAL)
SET(TMP_SPECIAL "--vtkobject")
ENDIF (TMP_WRAP_SPECIAL)
# add the info to the init file
SET(VTK_WRAPPER_INIT_DATA
"${VTK_WRAPPER_INIT_DATA}\n${TMP_FILENAME}")
......@@ -79,9 +86,10 @@ MACRO(VTK_WRAP_PYTHON3 TARGET SRC_LIST_NAME SOURCES)
DEPENDS ${VTK_WRAP_PYTHON_EXE} ${VTK_WRAP_HINTS} ${TMP_INPUT}
COMMAND ${VTK_WRAP_PYTHON_EXE}
ARGS
"${quote}${TMP_INPUT}${quote}"
"${quote}${VTK_WRAP_HINTS}${quote}"
${TMP_CONCRETE}
${TMP_SPECIAL}
"--hints" "${quote}${VTK_WRAP_HINTS}${quote}"
"${quote}${TMP_INPUT}${quote}"
"${quote}${CMAKE_CURRENT_BINARY_DIR}/${TMP_FILENAME}Python.cxx${quote}"
COMMENT "Python Wrapping - generating ${TMP_FILENAME}Python.cxx"
${verbatim}
......
......@@ -43,6 +43,7 @@
int HasDelete;
int IsAbstract;
int IsConcrete;
int IsVTKObject;
char *ClassName;
char *FileName;
char *OutputFileName;
......
......@@ -174,6 +174,7 @@ FileInfo data;
FunctionInfo throwAwayFunction;
FunctionInfo *currentFunction;
char *hintFileName;
FILE *fhint;
char temps[2048];
int in_public;
......@@ -460,7 +461,7 @@ const char *getTypeId()
/* Line 189 of yacc.c */
#line 464 "vtkParse.tab.c"
#line 465 "vtkParse.tab.c"
/* Enabling traces. */
#ifndef YYDEBUG
......@@ -610,7 +611,7 @@ typedef union YYSTYPE
{
/* Line 214 of yacc.c */
#line 405 "vtkParse.y"
#line 406 "vtkParse.y"
char *str;
int integer;
......@@ -618,7 +619,7 @@ typedef union YYSTYPE
/* Line 214 of yacc.c */
#line 735 "vtkParse.tab.c"
#line 736 "vtkParse.tab.c"
} YYSTYPE;
# define YYSTYPE_IS_TRIVIAL 1
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
......@@ -630,7 +631,7 @@ typedef union YYSTYPE
/* Line 264 of yacc.c */
#line 747 "vtkParse.tab.c"
#line 748 "vtkParse.tab.c"
#ifdef short
# undef short
......@@ -1097,51 +1098,51 @@ static const yytype_int16 yyrhs[] =
/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
static const yytype_uint16 yyrline[] =
{
0, 533, 533, 535, 535, 537, 537, 538, 538, 540,
540, 542, 542, 545, 545, 545, 547, 548, 549, 550,
551, 552, 553, 554, 555, 556, 557, 558, 559, 560,
561, 562, 563, 564, 565, 566, 567, 568, 569, 570,
571, 572, 573, 581, 583, 585, 585, 585, 587, 587,
591, 591, 591, 591, 593, 593, 593, 595, 596, 601,
607, 613, 613, 614, 616, 616, 617, 617, 618, 618,
619, 619, 621, 623, 625, 627, 629, 631, 632, 633,
635, 636, 637, 638, 639, 640, 641, 642, 643, 644,
646, 648, 650, 651, 651, 654, 655, 655, 657, 657,
659, 660, 661, 663, 665, 666, 667, 668, 672, 681,
685, 689, 699, 703, 698, 718, 718, 729, 746, 747,
746, 754, 754, 765, 782, 783, 785, 785, 788, 787,
792, 793, 792, 802, 802, 814, 814, 816, 816, 818,
818, 820, 822, 836, 836, 838, 840, 841, 843, 843,
845, 846, 847, 849, 849, 851, 851, 853, 853, 853,
855, 856, 859, 858, 862, 872, 871, 880, 888, 888,
896, 897, 896, 906, 906, 908, 908, 910, 912, 913,
914, 915, 916, 917, 918, 919, 920, 921, 922, 923,
924, 925, 927, 928, 930, 931, 932, 933, 936, 938,
946, 946, 949, 949, 955, 960, 961, 963, 964, 966,
967, 968, 970, 971, 973, 975, 975, 979, 979, 981,
981, 984, 984, 984, 986, 987, 988, 989, 991, 997,
1003, 1021, 1022, 1023, 1024, 1025, 1026, 1028, 1030, 1032,
1032, 1034, 1034, 1036, 1036, 1039, 1040, 1041, 1043, 1045,
1046, 1047, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057,
1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1065, 1067,
1070, 1071, 1072, 1073, 1074, 1075, 1076, 1078, 1078, 1080,
1089, 1088, 1097, 1098, 1099, 1100, 1102, 1103, 1104, 1106,
1107, 1109, 1110, 1111, 1112, 1113, 1114, 1117, 1117, 1132,
1133, 1133, 1132, 1146, 1146, 1161, 1161, 1175, 1175, 1175,
1222, 1221, 1237, 1238, 1238, 1237, 1251, 1277, 1277, 1282,
1282, 1287, 1287, 1292, 1292, 1297, 1297, 1302, 1302, 1307,
1307, 1312, 1312, 1317, 1317, 1338, 1338, 1359, 1425, 1495,
1562, 1636, 1637, 1638, 1639, 1640, 1642, 1643, 1643, 1644,
1644, 1645, 1645, 1646, 1646, 1647, 1647, 1648, 1648, 1649,
1650, 1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659,
1660, 1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669,
1670, 1671, 1672, 1673, 1674, 1675, 1681, 1686, 1686, 1687,
1687, 1688, 1688, 1690, 1690, 1690, 1692, 1692, 1692, 1694,
1694, 1694, 1694, 1695, 1695, 1695, 1695, 1695, 1696, 1696,
1696, 1696, 1697, 1697, 1697, 1697, 1697, 1698, 1698, 1698,
1698, 1698, 1698, 1698, 1699, 1699, 1699, 1699, 1699, 1699,
1700, 1700, 1700, 1702, 1703, 1704, 1705, 1706, 1707, 1709,
1709, 1710
0, 534, 534, 536, 536, 538, 538, 539, 539, 541,
541, 543, 543, 546, 546, 546, 548, 549, 550, 551,
552, 553, 554, 555, 556, 557, 558, 559, 560, 561,
562, 563, 564, 565, 566, 567, 568, 569, 570, 571,
572, 573, 574, 582, 584, 586, 586, 586, 588, 588,
592, 592, 592, 592, 594, 594, 594, 596, 597, 602,
608, 614, 614, 615, 617, 617, 618, 618, 619, 619,
620, 620, 622, 624, 626, 628, 630, 632, 633, 634,
636, 637, 638, 639, 640, 641, 642, 643, 644, 645,
647, 649, 651, 652, 652, 655, 656, 656, 658, 658,
660, 661, 662, 664, 666, 667, 668, 669, 673, 682,
686, 690, 700, 704, 699, 719, 719, 730, 747, 748,
747, 755, 755, 766, 783, 784, 786, 786, 789, 788,
793, 794, 793, 803, 803, 815, 815, 817, 817, 819,
819, 821, 823, 837, 837, 839, 841, 842, 844, 844,
846, 847, 848, 850, 850, 852, 852, 854, 854, 854,
856, 857, 860, 859, 863, 873, 872, 881, 889, 889,
897, 898, 897, 907, 907, 909, 909, 911, 913, 914,
915, 916, 917, 918, 919, 920, 921, 922, 923, 924,
925, 926, 928, 929, 931, 932, 933, 934, 937, 939,
947, 947, 950, 950, 956, 961, 962, 964, 965, 967,
968, 969, 971, 972, 974, 976, 976, 980, 980, 982,
982, 985, 985, 985, 987, 988, 989, 990, 992, 998,
1004, 1022, 1023, 1024, 1025, 1026, 1027, 1029, 1031, 1033,
1033, 1035, 1035, 1037, 1037, 1040, 1041, 1042, 1044, 1046,
1047, 1048, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058,
1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1066, 1068,
1071, 1072, 1073, 1074, 1075, 1076, 1077, 1079, 1079, 1081,
1090, 1089, 1098, 1099, 1100, 1101, 1103, 1104, 1105, 1107,
1108, 1110, 1111, 1112, 1113, 1114, 1115, 1118, 1118, 1133,
1134, 1134, 1133, 1147, 1147, 1162, 1162, 1176, 1176, 1176,
1223, 1222, 1238, 1239, 1239, 1238, 1252, 1278, 1278, 1283,
1283, 1288, 1288, 1293, 1293, 1298, 1298, 1303, 1303, 1308,
1308, 1313, 1313, 1318, 1318, 1339, 1339, 1360, 1426, 1496,
1563, 1637, 1638, 1639, 1640, 1641, 1643, 1644, 1644, 1645,
1645, 1646, 1646, 1647, 1647, 1648, 1648, 1649, 1649, 1650,
1651, 1652, 1653, 1654, 1655, 1656, 1657, 1658, 1659, 1660,
1661, 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, 1670,
1671, 1672, 1673, 1674, 1675, 1676, 1682, 1687, 1687, 1688,
1688, 1689, 1689, 1691, 1691, 1691, 1693, 1693, 1693, 1695,
1695, 1695, 1695, 1696, 1696, 1696, 1696, 1696, 1697, 1697,
1697, 1697, 1698, 1698, 1698, 1698, 1698, 1699, 1699, 1699,
1699, 1699, 1699, 1699, 1700, 1700, 1700, 1700, 1700, 1700,
1701, 1701, 1701, 1703, 1704, 1705, 1706, 1707, 1708, 1710,
1710, 1711
};
#endif
......@@ -2912,112 +2913,112 @@ yyreduce:
case 9:
/* Line 1455 of yacc.c */
#line 540 "vtkParse.y"
#line 541 "vtkParse.y"
{ start_class((yyvsp[(2) - (2)].str)); }
break;
case 11:
/* Line 1455 of yacc.c */
#line 542 "vtkParse.y"
#line 543 "vtkParse.y"
{ start_class((yyvsp[(2) - (5)].str)); }
break;
case 14:
/* Line 1455 of yacc.c */
#line 545 "vtkParse.y"
#line 546 "vtkParse.y"
{ delSig(); clearTypeId(); }
break;
case 29:
/* Line 1455 of yacc.c */
#line 560 "vtkParse.y"
#line 561 "vtkParse.y"
{ output_function(); }
break;
case 30:
/* Line 1455 of yacc.c */
#line 561 "vtkParse.y"
#line 562 "vtkParse.y"
{ reject_function(); }
break;
case 31:
/* Line 1455 of yacc.c */
#line 562 "vtkParse.y"
#line 563 "vtkParse.y"
{ output_function(); }
break;
case 32:
/* Line 1455 of yacc.c */
#line 563 "vtkParse.y"
#line 564 "vtkParse.y"
{ output_function(); }
break;
case 33:
/* Line 1455 of yacc.c */
#line 564 "vtkParse.y"
#line 565 "vtkParse.y"
{ output_function(); }
break;
case 34:
/* Line 1455 of yacc.c */
#line 565 "vtkParse.y"
#line 566 "vtkParse.y"
{ output_function(); }
break;
case 35:
/* Line 1455 of yacc.c */
#line 566 "vtkParse.y"
#line 567 "vtkParse.y"
{ reject_function(); }
break;
case 36:
/* Line 1455 of yacc.c */
#line 567 "vtkParse.y"
#line 568 "vtkParse.y"
{ output_function(); }
break;
case 37:
/* Line 1455 of yacc.c */
#line 568 "vtkParse.y"
#line 569 "vtkParse.y"
{ output_function(); }
break;
case 38:
/* Line 1455 of yacc.c */
#line 569 "vtkParse.y"
#line 570 "vtkParse.y"
{ output_function(); }
break;
case 39:
/* Line 1455 of yacc.c */
#line 570 "vtkParse.y"
#line 571 "vtkParse.y"
{ legacySig(); output_function(); }
break;
case 57:
/* Line 1455 of yacc.c */
#line 595 "vtkParse.y"
#line 596 "vtkParse.y"
{ (yyval.str) = (yyvsp[(1) - (1)].str); }
break;
case 58:
/* Line 1455 of yacc.c */
#line 597 "vtkParse.y"
#line 598 "vtkParse.y"
{
(yyval.str) = (char *)malloc(strlen((yyvsp[(1) - (2)].str)) + strlen((yyvsp[(2) - (2)].str)) + 1);
sprintf((yyval.str), "%s%s", (yyvsp[(1) - (2)].str), (yyvsp[(2) - (2)].str));
......@@ -3027,7 +3028,7 @@ yyreduce:
case 59:
/* Line 1455 of yacc.c */
#line 602 "vtkParse.y"
#line 603 "vtkParse.y"
{
(yyval.str) = (char *)malloc(strlen((yyvsp[(1) - (3)].str)) + strlen((yyvsp[(2) - (3)].str)) +
strlen((yyvsp[(3) - (3)].str)) + 3);
......@@ -3038,7 +3039,7 @@ yyreduce:
case 60:
/* Line 1455 of yacc.c */
#line 608 "vtkParse.y"
#line 609 "vtkParse.y"
{
(yyval.str) = (char *)malloc(strlen((yyvsp[(2) - (3)].str)) + 3);
sprintf((yyval.str), "(%s)", (yyvsp[(2) - (3)].str));
......@@ -3048,147 +3049,147 @@ yyreduce:
case 61:
/* Line 1455 of yacc.c */
#line 613 "vtkParse.y"
#line 614 "vtkParse.y"
{ (yyval.str) = "-"; }
break;
case 62:
/* Line 1455 of yacc.c */
#line 613 "vtkParse.y"
#line 614 "vtkParse.y"
{ (yyval.str) = "+"; }
break;
case 63:
/* Line 1455 of yacc.c */
#line 614 "vtkParse.y"
#line 615 "vtkParse.y"
{ (yyval.str) = "~"; }
break;
case 64:
/* Line 1455 of yacc.c */
#line 616 "vtkParse.y"
#line 617 "vtkParse.y"
{ (yyval.str) = "-"; }
break;
case 65:
/* Line 1455 of yacc.c */
#line 616 "vtkParse.y"
#line 617 "vtkParse.y"
{ (yyval.str) = "+"; }
break;
case 66:
/* Line 1455 of yacc.c */
#line 617 "vtkParse.y"
#line 618 "vtkParse.y"
{ (yyval.str) = "*"; }
break;
case 67:
/* Line 1455 of yacc.c */
#line 617 "vtkParse.y"
#line 618 "vtkParse.y"
{ (yyval.str) = "/"; }
break;
case 68:
/* Line 1455 of yacc.c */
#line 618 "vtkParse.y"
#line 619 "vtkParse.y"
{ (yyval.str) = "%"; }
break;
case 69:
/* Line 1455 of yacc.c */
#line 618 "vtkParse.y"
#line 619 "vtkParse.y"
{ (yyval.str) = "&"; }
break;
case 70:
/* Line 1455 of yacc.c */
#line 619 "vtkParse.y"
#line 620 "vtkParse.y"
{ (yyval.str) = "|"; }
break;
case 71:
/* Line 1455 of yacc.c */
#line 619 "vtkParse.y"
#line 620 "vtkParse.y"
{ (yyval.str) = "^"; }
break;
case 92:
/* Line 1455 of yacc.c */
#line 650 "vtkParse.y"
#line 651 "vtkParse.y"
{ postSig("template<> "); clearTypeId(); }
break;
case 93:
/* Line 1455 of yacc.c */
#line 651 "vtkParse.y"
#line 652 "vtkParse.y"
{ postSig("template<"); }
break;
case 94:
/* Line 1455 of yacc.c */
#line 652 "vtkParse.y"
#line 653 "vtkParse.y"
{ postSig("> "); clearTypeId(); }
break;
case 96:
/* Line 1455 of yacc.c */
#line 655 "vtkParse.y"
#line 656 "vtkParse.y"
{ postSig(", "); }
break;
case 100:
/* Line 1455 of yacc.c */
#line 659 "vtkParse.y"
#line 660 "vtkParse.y"
{ postSig("typename "); }
break;
case 101:
/* Line 1455 of yacc.c */
#line 660 "vtkParse.y"
#line 661 "vtkParse.y"
{ postSig("class "); }
break;
case 102:
/* Line 1455 of yacc.c */
#line 661 "vtkParse.y"
#line 662 "vtkParse.y"
{ postSig("int "); }
break;
case 104:
/* Line 1455 of yacc.c */
#line 665 "vtkParse.y"
#line 666 "vtkParse.y"
{openSig(); preSig("~"); closeSig();}
break;
case 105:
/* Line 1455 of yacc.c */
#line 666 "vtkParse.y"
#line 667 "vtkParse.y"
{openSig(); preSig("virtual ~"); closeSig();}
break;
case 107:
/* Line 1455 of yacc.c */
#line 669 "vtkParse.y"
#line 670 "vtkParse.y"
{
currentFunction->ReturnType = (yyvsp[(1) - (2)].integer);
}
......@@ -3197,7 +3198,7 @@ yyreduce:
case 108:
/* Line 1455 of yacc.c */
#line 673 "vtkParse.y"
#line 674 "vtkParse.y"
{
openSig();
preSig("virtual ");
......@@ -3209,7 +3210,7 @@ yyreduce:
case 109:
/* Line 1455 of yacc.c */
#line 682 "vtkParse.y"
#line 683 "vtkParse.y"
{
currentFunction->ReturnType = (yyvsp[(1) - (1)].integer);
}
......@@ -3218,7 +3219,7 @@ yyreduce:
case 110:
/* Line 1455 of yacc.c */
#line 686 "vtkParse.y"
#line 687 "vtkParse.y"
{
currentFunction->ReturnType = (yyvsp[(1) - (2)].integer);
}
......@@ -3227,7 +3228,7 @@ yyreduce:
case 111:
/* Line 1455 of yacc.c */
#line 690 "vtkParse.y"
#line 691 "vtkParse.y"
{
openSig();
preSig("virtual ");
......@@ -3239,7 +3240,7 @@ yyreduce:
case 112:
/* Line 1455 of yacc.c */
#line 699 "vtkParse.y"
#line 700 "vtkParse.y"
{
postSig("(");
currentFunction->ReturnClass = vtkstrdup(getTypeId());
......@@ -3249,14 +3250,14 @@ yyreduce:
case 113:
/* Line 1455 of yacc.c */
#line 703 "vtkParse.y"
#line 704 "vtkParse.y"
{ postSig(")"); }
break;
case 114:
/* Line 1455 of yacc.c */
#line 704 "vtkParse.y"
#line 705 "vtkParse.y"
{
(yyval.integer) = (yyvsp[(2) - (8)].integer);
postSig(";");
......@@ -3275,14 +3276,14 @@ yyreduce:
case 115:
/* Line 1455 of yacc.c */
#line 718 "vtkParse.y"
#line 719 "vtkParse.y"
{ postSig(")"); }
break;
case 116:
/* Line 1455 of yacc.c */
#line 719 "vtkParse.y"
#line 720 "vtkParse.y"
{
postSig(";");
closeSig();
......@@ -3298,7 +3299,7 @@ yyreduce:
case 117:
/* Line 1455 of yacc.c */
#line 730 "vtkParse.y"
#line 731 "vtkParse.y"
{
postSig(";");
closeSig();
......@@ -3319,14 +3320,14 @@ yyreduce:
case 118:
/* Line 1455 of yacc.c */
#line 746 "vtkParse.y"
#line 747 "vtkParse.y"
{postSig((yyvsp[(2) - (2)].str));}
break;
case 119:
/* Line 1455 of yacc.c */
#line 747 "vtkParse.y"
#line 748 "vtkParse.y"
{
postSig("(");
currentFunction->IsOperator = 1;
......@@ -3337,21 +3338,21 @@ yyreduce:
case 120:
/* Line 1455 of yacc.c */
#line 752 "vtkParse.y"
#line 753 "vtkParse.y"
{ (yyval.str) = (yyvsp[(2) - (7)].str); }
break;