Changeset 59
- Timestamp:
- 06/02/06 13:32:07 (2 years ago)
- Files:
-
- trunk/bcd.gen/Makefile (modified) (1 diff)
- trunk/bcd.gen/bcd/bind.cc (copied) (copied from trunk/bindings/bcd/bind.cc)
- trunk/bcd.gen/bcd/bind.h (copied) (copied from trunk/bindings/bcd/bind.h)
- trunk/bcd.gen/bcd/gen/bcdgen.d (modified) (31 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/bcd.gen/Makefile
r50 r59 5 5 bcdgen: bcd/gen/bcdgen.d bcd/gen/libxml2.d 6 6 $(DMD) -g bcd/gen/bcdgen.d bcd/gen/libxml2.d -ofbcdgen -L-lxml2 7 8 fltk2exa: test/fltk2.d bcd/bind.d9 sh test/fltk2.sh ${DMD}10 11 libxml2exa: test/libxml2.d12 sh test/libxml2.sh ${DMD}13 14 vorbisexa: test/vorbis.d15 sh test/vorbis.sh ${DMD}16 17 gtk2exa: test/gtk2.d18 sh test/gtk2.sh ${DMD}trunk/bcd.gen/bcd/gen/bcdgen.d
r57 r59 40 40 41 41 // some global variables (yay) 42 private { 42 43 /** The full path to the current file */ 43 44 char[] curFile; … … 52 53 /** The C++ functions/variables to explicitly ignore */ 53 54 char[][] ignoreSyms; 55 } 54 56 /** The D output */ 55 57 char[] dhead; … … 57 59 /** The C[++] output */ 58 60 char[] cout; 61 private { 62 /** The class currently being processed */ 59 63 char[] curClass; 64 /** Was a constructor made for the current class? */ 65 bool hasConstructor; 66 /** Was an accessable constructor made for the current class? */ 67 bool hasPublicConstructor; 60 68 /** Should we output C instead of C++ */ 61 69 bool outputC; … … 64 72 /** Should we generate consts for enums? */ 65 73 bool outputEnumConst; 74 /** Should we output reflections? */ 75 bool outputReflections; 66 76 /** Other BCD requirements */ 67 77 char[][char[]] reqDependencies; … … 69 79 xmlNode *gccxml = null; 70 80 81 /** Class currently being reflected into D */ 82 char[] curReflection; 83 /** The base of the class currently being reflected (in C++) */ 84 char[] curReflectionCBase; 85 /** The base of the class currently being reflected (in D) */ 86 char[] curReflectionDBase; 87 /** The initializer for the current reflection */ 88 char[] curReflectionInit; 89 /** The C++ code for the class currently being reflected */ 90 char[] reflectionCode; 91 /** The C++ code to go after we close the class */ 92 char[] reflectionPostCode; 93 /** The functions that have already been reflected */ 94 bool[char[]] reflectedFunctions; 95 71 96 char[][char[]] files; 97 } 72 98 73 99 … … 88 114 writefln(" -R<include directory>=<BCD/D namespace>"); 89 115 writefln(" Depend upon other BCD namespaces."); 116 writefln(" -r"); 117 writefln(" Reflect C++ classes such that D classes can derive from"); 118 writefln(" them."); 90 119 writefln(" -E"); 91 120 writefln(" Generate const int's for unnamed enum values"); … … 156 185 outputEnumConst = true; 157 186 187 } else if (args[i] == "-r") { 188 outputReflections = true; 189 158 190 } else { 159 191 writefln("Argument %s not recognized.", args[i]); … … 419 451 * Parse the members of a node 420 452 */ 421 void parseMembers(xmlNode *node, bool inclass, bool types )453 void parseMembers(xmlNode *node, bool inclass, bool types, bool reflection = false) 422 454 { 423 455 char *members = xmlGetProp(node, "members"); … … 429 461 // parse each member in the memberList 430 462 foreach (m; memberList) { 431 parse_GCC_XML_for(m, inclass, types );463 parse_GCC_XML_for(m, inclass, types, reflection); 432 464 } 433 465 } … … 481 513 * Parse a GCC_XML node for a specified ID 482 514 */ 483 void parse_GCC_XML_for(char[] parseFor, bool inclass, bool types )515 void parse_GCC_XML_for(char[] parseFor, bool inclass, bool types, bool reflection = false) 484 516 { 485 517 xmlNode *curNode = null; … … 492 524 char *id = xmlGetProp(curNode, "id"); 493 525 if (parseFor != toStringFree(id)) continue; 526 527 if (nname == "Constructor") { 528 // this may be private or otherwise unparsable, but we do have one 529 hasConstructor = true; 530 } 494 531 495 532 // types that can be nameless: … … 515 552 516 553 if (nname == "Variable" || nname == "Field") { 517 if (!types ) parse_Variable(curNode, inclass);554 if (!types && !reflection) parse_Variable(curNode, inclass); 518 555 } else if (nname == "Method") { 519 if (!types) parse_Method(curNode );556 if (!types) parse_Method(curNode, reflection); 520 557 } else if (nname == "OperatorMethod") { 521 if (!types) parse_OperatorMethod(curNode );558 if (!types) parse_OperatorMethod(curNode, reflection); 522 559 } else if (nname == "Function") { 523 if (!types ) parse_Function(curNode);560 if (!types && !reflection) parse_Function(curNode); 524 561 } else if (nname == "Constructor") { 525 if (!types) parse_Constructor(curNode );562 if (!types) parse_Constructor(curNode, reflection); 526 563 } else if (nname == "Destructor") { 527 564 // this code is automatic :) 528 565 } else if (nname == "Typedef") { 529 if (types ) parse_Typedef(curNode);566 if (types && !reflection) parse_Typedef(curNode); 530 567 } else if (nname == "Enumeration") { 531 if (types ) parse_Enumeration(curNode);568 if (types && !reflection) parse_Enumeration(curNode); 532 569 } else { 533 570 writefln("I don't know how to parse %s!", nname); … … 601 638 char[] mangled = toStringFree(getMangled(node)); 602 639 char[] demangled = toStringFree(getDemangled(node)); 640 char* isabstract = xmlGetProp(node, "abstract"); 641 if (isabstract) free(isabstract); 642 curClass = demangled; 643 hasConstructor = false; 644 hasPublicConstructor = false; 603 645 604 646 parseMembers(node, true, true); … … 626 668 dtail ~= "}\n"; 627 669 670 dtail ~= "this(ifloat ignore, void *x) {\n"; 671 dtail ~= "super(ignore);\n"; 672 dtail ~= "__C_data = x;\n"; 673 dtail ~= "}\n"; 674 628 675 cout ~= "void _BCD_delete_" ~ mangled ~ "(" ~ demangled ~ " *This) {\n"; 629 676 cout ~= "delete This;\n"; … … 637 684 dtail ~= "}\n"; 638 685 639 curClass = demangled;640 641 686 parseMembers(node, true, false); 687 688 // if the constructor is implicit, replicate it here 689 if (!hasConstructor && !isabstract) { 690 dhead ~= "extern (C) void *_BCD_new_" ~ mangled ~ "();\n"; 691 dtail ~= "this() {\n"; 692 dtail ~= "super(cast(ifloat) 0);\n"; 693 dtail ~= "__C_data = _BCD_new_" ~ mangled ~ "();\n"; 694 dtail ~= "}\n"; 695 cout ~= demangled ~ " *_BCD_new_" ~ mangled ~ "() {\n"; 696 cout ~= "return new " ~ demangled ~ "();\n"; 697 cout ~= "}\n"; 698 } 699 642 700 dtail ~= "}\n"; 701 702 // now make the reflected class 703 if (!outputReflections) return; 704 if (isabstract) return; // not for abstract classes yet 705 curReflectionCBase = demangled; 706 curReflectionDBase = safeName(name); 707 curReflection = curReflectionDBase ~ "_R"; 708 curReflectionInit = "_BCD_RI_" ~ mangled; 709 710 dhead ~= "extern (C) void " ~ curReflectionInit ~ "(void *cd, void *dd);\n"; 711 712 dtail ~= "class " ~ curReflection ~ " : " ~ curReflectionDBase ~ " {\n"; 713 714 dhead ~= "extern (C) void _BCD_delete_" ~ mangled ~ "__" ~ curReflection ~ "(void *This);\n"; 715 716 dtail ~= "~this() {\n"; 717 dtail ~= "if (__C_data) _BCD_delete_" ~ mangled ~ "__" ~ curReflection ~ "(__C_data);\n"; 718 dtail ~= "__C_data = null;\n"; 719 dtail ~= "}\n"; 720 721 reflectionPostCode = ""; 722 723 reflectionCode = "}\n"; // close the extern "C" 724 reflectionCode ~= "class " ~ curReflection ~ " : " ~ curReflectionCBase ~ " {\n"; 725 reflectionCode ~= "public:\n"; 726 reflectionCode ~= "void *__D_data;\n"; 727 728 hasConstructor = false; 729 hasPublicConstructor = false; 730 parseBaseReflections(node); 731 732 reflectionCode ~= "};\n"; 733 reflectionCode ~= "extern \"C\" {\n"; 734 735 cout ~= reflectionCode ~ reflectionPostCode; 736 737 reflectionCode = ""; 738 reflectedFunctions = null; 739 740 cout ~= "void _BCD_delete_" ~ mangled ~ "__" ~ curReflection ~ "(" ~ curReflection ~ " *This) {\n"; 741 cout ~= "delete This;\n"; 742 cout ~= "}\n"; 743 744 // if the constructor is implicit, make it here 745 if (!hasConstructor) { 746 dhead ~= "extern (C) void *_BCD_new_" ~ mangled ~ "__" ~ curReflection ~ "();\n"; 747 dtail ~= "this() {\n"; 748 dtail ~= "super(cast(ifloat) 0);\n"; 749 dtail ~= "__C_data = _BCD_new_" ~ mangled ~ "__" ~ curReflection ~ "();\n"; 750 dtail ~= "}\n"; 751 cout ~= curReflection ~ " *_BCD_new_" ~ mangled ~ "__" ~ curReflection ~ "() {\n"; 752 cout ~= "return new " ~ curReflection ~ "();\n"; 753 cout ~= "}\n"; 754 } else if (!hasPublicConstructor) { 755 dtail ~= "this() { super(cast(ireal) 0); }\n"; 756 } 757 758 dtail ~= "}\n"; 759 760 // then make the initializer 761 cout ~= "void _BCD_RI_" ~ mangled ~ "(" ~ curReflection ~ " *cd, void *dd) {\n"; 762 cout ~= "cd->__D_data = dd;\n"; 763 cout ~= "}\n"; 764 } 765 766 /** 767 * Recursively and reflectively parse a class' bases 768 */ 769 void parseBaseReflections(xmlNode *node) 770 { 771 xmlNode *curNode = null; 772 for (curNode = node.children; curNode; curNode = curNode.next) { 773 if (curNode.type == xmlElementType.XML_ELEMENT_NODE) { 774 if (toString(curNode.name) == "Base") { 775 776 // find the base class 777 char[] type = toStringFree(xmlGetProp(curNode, "type")); 778 xmlNode *curBCNode = null; 779 for (curBCNode = gccxml.children; curBCNode; curBCNode = curBCNode.next) { 780 if (curBCNode.type == xmlElementType.XML_ELEMENT_NODE) { 781 if (type == toStringFree(xmlGetProp(curBCNode, "id"))) { 782 // parse this one too 783 parseBaseReflections(curBCNode); 784 } 785 } 786 } 787 788 } 789 } 790 } 791 792 // then parse this level 793 parseMembers(node, true, false, true); 643 794 } 644 795 … … 753 904 void parse_Arguments(xmlNode *node, inout char[] Dargs, inout char[] Deargs, 754 905 inout char[] Cargs, inout char[] Dcall, 755 inout char[] Ccall, 906 inout char[] Ccall, bool reflection = false, 756 907 int *argc = null) 757 908 { … … 772 923 Dargs ~= ", "; 773 924 } 774 Dargs ~= atype.DType ~ " " ~ aname; 775 776 if (atype.isClass || atype.isClassPtr) { 925 if (!reflection || (!atype.isClass && !atype.isClassPtr)) { 926 Dargs ~= atype.DType ~ " " ~ aname; 927 } else { 928 Dargs ~= "void *" ~ aname; 929 } 930 931 if (!reflection && (atype.isClass || atype.isClassPtr)) { 777 932 // this becomes a void * in D's view 778 933 if (Deargs != "") { 779 934 Deargs ~= ", "; 780 935 } 781 Deargs ~= "void *" ~ aname;936 Deargs ~= "void *"; 782 937 } else { 783 938 if (Deargs != "") { 784 939 Deargs ~= ", "; 785 940 } 786 Deargs ~= atype.DType ~ " " ~ aname;941 Deargs ~= atype.DType; 787 942 } 788 943 … … 795 950 Dcall ~= ", "; 796 951 } 797 Dcall ~= aname; 798 if (atype.isClass || atype.isClassPtr) { 799 // turn this into the real info 800 Dcall ~= ".__C_data"; 952 if (!reflection) { 953 Dcall ~= aname; 954 if (atype.isClass || atype.isClassPtr) { 955 // turn this into the real info 956 Dcall ~= ".__C_data"; 957 } 958 } else { 959 if (atype.isClass) { 960 Dcall ~= "new " ~ atype.className ~ "(cast(ifloat) 0, " ~ aname ~ ")"; 961 } else if (atype.isClassPtr) { 962 Dcall ~= "cast(" ~ atype.DType ~ ") new " ~ replace(atype.DType, " *", "") ~ "(cast(ifloat) 0, " ~ aname ~ ")"; 963 } else { 964 Dcall ~= aname; 965 } 801 966 } 802 967 … … 806 971 Ccall ~= ", "; 807 972 } 808 Ccall ~= "*" ~ aname; 973 if (!reflection) { 974 Ccall ~= "*" ~ aname; 975 } else { 976 Ccall ~= "&" ~ aname; 977 } 809 978 } else { 810 979 if (Ccall != "") { … … 890 1059 } 891 1060 1061 void parse_Function_reflection(xmlNode *node, char[] name, char[] cname, 1062 char[] mangled, ParsedType type, 1063 char[] Dargs, char[] Deargs, char[] Cargs, char[] Dcall, char[] Ccall) 1064 { 1065 // tie to the particular class being reflected 1066 mangled ~= "__" ~ curReflection; 1067 1068 // make sure it's not already reflected 1069 char[] fid = name ~ "(" ~ Deargs ~ ")"; 1070 if (fid in reflectedFunctions) return; 1071 reflectedFunctions[fid] = true; 1072 1073 // make sure it's virtual 1074 char* isvirtual = xmlGetProp(node, "virtual"); 1075 if (isvirtual) free(isvirtual); 1076 else return; 1077 1078 // the C++ interface to the reflection 1079 cout ~= "int _BCD_R_" ~ mangled ~ "_CHECK(void *);\n"; 1080 1081 if (Cargs != "") 1082 cout ~= type.CType ~ " _BCD_R_" ~ mangled ~ "(void *, " ~ Cargs ~ ");\n"; 1083 else 1084 cout ~= type.CType ~ " _BCD_R_" ~ mangled ~ "(void *);\n"; 1085 1086 reflectionCode ~= type.CType ~ " " ~ name ~ "(" ~ Cargs ~ ") {\n"; 1087 1088 reflectionCode ~= "if (_BCD_R_" ~ mangled ~ "_CHECK(__D_data))\n"; 1089 if (type.CType != "void") reflectionCode ~= "return "; 1090 1091 reflectionCode ~= "_BCD_R_" ~ mangled ~ "(__D_data"; 1092 if (Ccall != "") reflectionCode ~= ", "; 1093 reflectionCode ~= Ccall ~ ");\n"; 1094 1095 reflectionCode ~= "else\n"; 1096 if (type.CType != "void") reflectionCode ~= "return "; 1097 reflectionCode ~= curReflectionCBase ~ "::" ~ cname ~ "(" ~ Ccall ~ ");\n"; 1098 reflectionCode ~= "}\n"; 1099 1100 // and the D interface 1101 dhead ~= "extern (C) int _BCD_R_" ~ mangled ~ "_CHECK(" ~ curReflection ~ " x) {\n"; 1102 dhead ~= "union dp {\n"; 1103 dhead ~= type.DType ~ " delegate(" ~ Deargs ~ ") d;\n"; 1104 dhead ~= "struct { void *o; void *f; }\n"; 1105 dhead ~= "}\n"; 1106 dhead ~= "dp d; d.d = &x." ~ name ~ ";\n"; 1107 dhead ~= "return cast(int) (d.f != &" ~ curReflectionDBase ~ "." ~ name ~ ");\n"; 1108 dhead ~= "}\n"; 1109 1110 dhead ~= "extern (C) " ~ type.DType ~ " _BCD_R_" ~ mangled ~ "(" ~ curReflection ~ " __D_class, " ~ 1111 Dargs ~ ") {\n"; 1112 if (type.DType != "void") dhead ~= "return "; 1113 dhead ~= "__D_class." ~ name ~ "(" ~ Dcall ~ ");\n"; 1114 dhead ~= "}\n"; 1115 } 1116 892 1117 /** 893 1118 * Parse a Method node 894 1119 */ 895 void parse_Method(xmlNode *node )1120 void parse_Method(xmlNode *node, bool reflection) 896 1121 { 897 1122 char[] name = getNName(node); … … 899 1124 ParsedType type = parseType(toStringFree(xmlGetProp(node, "returns"))); 900 1125 char[] Dargs; 901 char[] Deargs = "void *This"; 902 char[] Cargs = curClass ~ " *This"; 903 char[] Dcall = "__C_data"; 1126 char[] Deargs; 1127 if (!reflection) Deargs = "void *This"; 1128 char[] Cargs; 1129 if (!reflection) Cargs = curClass ~ " *This"; 1130 char[] Dcall; 1131 if (!reflection) Dcall = "__C_data"; 904 1132 char[] Ccall; 905 1133 906 parse_Arguments(node, Dargs, Deargs, Cargs, Dcall, Ccall); 907 parse_Function_body(node, safeName(name), mangled, "This->" ~ name, type, 908 Dargs, Deargs, Cargs, Dcall, Ccall); 1134 parse_Arguments(node, Dargs, Deargs, Cargs, Dcall, Ccall, reflection); 1135 if (!reflection) 1136 parse_Function_body(node, safeName(name), mangled, "This->" ~ name, type, 1137 Dargs, Deargs, Cargs, Dcall, Ccall); 1138 else 1139 parse_Function_reflection(node, safeName(name), name, mangled, type, 1140 Dargs, Deargs, Cargs, Dcall, Ccall); 909 1141 } 910 1142 … … 912 1144 * Parse an OperatorMethod node 913 1145 */ 914 void parse_OperatorMethod(xmlNode *node )1146 void parse_OperatorMethod(xmlNode *node, bool reflection) 915 1147 { 916 1148 char[] name = toStringFree(xmlGetProp(node, "name"));; … … 918 1150 ParsedType type = parseType(toStringFree(xmlGetProp(node, "returns"))); 919 1151 char[] Dargs; 920 char[] Deargs = "void *This"; 921 char[] Cargs = curClass ~ " *This"; 922 char[] Dcall = "__C_data"; 1152 char[] Deargs; 1153 if (!reflection) Deargs = "void *This"; 1154 char[] Cargs; 1155 if (!reflection) Cargs = curClass ~ " *This"; 1156 char[] Dcall; 1157 if (!reflection) Dcall = "__C_data"; 923 1158 char[] Ccall; 924 1159 int argc; 925 1160 926 parse_Arguments(node, Dargs, Deargs, Cargs, Dcall, Ccall, &argc);1161 parse_Arguments(node, Dargs, Deargs, Cargs, Dcall, Ccall, reflection, &argc); 927 1162 928 1163 // get the D name … … 1069 1304 if (dname == "") return; 1070 1305 1071 parse_Function_body(node, dname, mangled, "This->" ~ name, type, 1072 Dargs, Deargs, Cargs, Dcall, Ccall); 1306 if (!reflection) 1307 parse_Function_body(node, dname, mangled, "This->" ~ name, type, 1308 Dargs, Deargs, Cargs, Dcall, Ccall); 1309 else 1310 parse_Function_reflection(node, dname, name, mangled, type, 1311 Dargs, Deargs, Cargs, Dcall, Ccall); 1073 1312 } 1074 1313 … … 1102 1341 * Parse a Constructor node 1103 1342 */ 1104 void parse_Constructor(xmlNode *node )1343 void parse_Constructor(xmlNode *node, bool reflection) 1105 1344 { 1106 1345 if (outputC) return; // no constructors in C … … 1108 1347 char[] name = getNName(node); 1109 1348 char[] mangled = toStringFree(getMangled(node)); 1349 if (reflection) mangled ~= "_R"; 1110 1350 1111 1351 while (find(mangled, "*INTERNAL*") != -1) { … … 1114 1354 1115 1355 char[] Dargs; 1116 char[] Deargs = "void *This"; 1356 char[] Deargs; 1357 if (!reflection) Deargs = "void *"; 1117 1358 char[] Cargs; 1118 if (outputC) { 1119 Cargs = "struct " ~ curClass ~ " *This"; 1120 } else { 1121 Cargs = curClass ~ " *This"; 1122 } 1123 char[] Dcall = "__C_data"; 1359 if (!reflection) { 1360 if (outputC) { 1361 Cargs = "struct " ~ curClass ~ " *This"; 1362 } else { 1363 Cargs = curClass ~ " *This"; 1364 } 1365 } 1366 char[] Dcall; 1367 if (!reflection) Dcall = "__C_data"; 1124 1368 char[] Ccall; 1125 1369 1126 parse_Arguments(node, Dargs, Deargs, Cargs, Dcall, Ccall); 1370 if (reflection) { 1371 // only reflect one level of constructors 1372 if (name != curReflectionDBase) return; 1373 } 1374 1375 parse_Arguments(node, Dargs, Deargs, Cargs, Dcall, Ccall, reflection); 1376 1377 if (reflection) { 1378 // make sure it's not already reflected 1379 char[] fid = name ~ "(" ~ Deargs ~ ")"; 1380 if (fid in reflectedFunctions) return; 1381 reflectedFunctions[fid] = true; 1382 } 1127 1383 1128 1384 dhead ~= "extern (C) void *_BCD_new_" ~ mangled ~ "(" ~ Deargs ~ ");\n"; … … 1131 1387 dtail ~= "super(cast(ifloat) 0);\n"; 1132 1388 dtail ~= "__C_data = _BCD_new_" ~ mangled ~ "(" ~ Dcall ~ ");\n"; 1389 if (reflection) { 1390 dtail ~= curReflectionInit ~ "(__C_data, cast(void *) this);\n"; 1391 } 1133 1392 dtail ~= "}\n"; 1134 1393 1135 cout ~= curClass ~ " *_BCD_new_" ~ mangled ~ "(" ~ Cargs ~ ") {\n"; 1136 cout ~= "return new " ~ curClass ~ "(" ~ Ccall ~ ");\n"; 1137 cout ~= "}\n"; 1394 if (!reflection) { 1395 cout ~= curClass ~ " *_BCD_new_" ~ mangled ~ "(" ~ Cargs ~ ") {\n"; 1396 cout ~= "return new "; 1397 cout ~= curClass; 1398 cout ~= "(" ~ Ccall ~ ");\n"; 1399 cout ~= "}\n"; 1400 } else { 1401 reflectionCode ~= curReflection ~ "(" ~ Cargs ~ ") : " ~ curReflectionCBase ~ "(" ~ Ccall ~ ") {}\n"; 1402 reflectionPostCode ~= curReflection ~ " *_BCD_new_" ~ mangled ~ "(" ~ Cargs ~ ") {\n"; 1403 reflectionPostCode ~= "return new "; 1404 reflectionPostCode ~= curReflection; 1405 reflectionPostCode ~= "(" ~ Ccall ~ ");\n"; 1406 reflectionPostCode ~= "}\n"; 1407 } 1408 1409 hasPublicConstructor = true; 1138 1410 } 1139 1411 … … 1377 1649 pt.DType ~= " *"; 1378 1650 pt.isClassPtr = true; 1651 1652 // if this is a const, our const will be on the wrong side! 1653 if (pt.CType.length >= 7 && 1654 pt.CType[pt.CType.length - 7 .. pt.CType.length] == "* const") { 1655 pt.CType[pt.CType.length - 7 .. pt.CType.length] = "const *"; 1656 } 1657 1379 1658 parsedCache[type] = pt; 1380 1659 } else { … … 1419 1698 1420 1699 // 1) cut off the * 1421 baseType.CType = baseType.CType[0 .. baseType.CType.length - 2]; 1700 int l = rfind(baseType.CType, '*'); 1701 if (l != -1) baseType.CType[l] = ' '; 1422 1702 1423 1703 // 2) add the & … … 1493 1773 // this is just a const 1494 1774 ParsedType pt = parseType(toStringFree(xmlGetProp(curNode, "type"))); 1495 1496 if (pt.CType.length < 6 || 1775 1776 /*if (pt.CType.length >= 2) { 1777 char[] pfix = pt.CType[pt.CType.length - 2 .. pt.CType.length]; 1778 if (pfix == " *" || 1779 pfix == " &") { 1780 pt.CType = pt.CType[0 .. pt.CType.length - 2] ~ 1781 " const" ~ pfix; 1782 parsedCache[type] = pt; 1783 break; 1784 } 1785 }*/ 1786 1787 /*if (pt.CType.length < 6 || 1497 1788 pt.CType[0..6] != "const ") 1498 pt.CType = "const " ~ pt.CType; 1789 pt.CType = "const " ~ pt.CType;*/ 1790 pt.CType ~= " const"; 1791 1499 1792 parsedCache[type] = pt; 1500 1793
