Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/MacGenerator.d @ 7:e831403a80a9
Add 'cast' to casts
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Wed, 27 Aug 2008 14:30:35 +0200 |
parents | 380af2bdd8e5 |
children | 30a762abda2a |
comparison
equal
deleted
inserted
replaced
6:b903c16b6f48 | 7:e831403a80a9 |
---|---|
53 | 53 |
54 public void generateConstants() | 54 public void generateConstants() |
55 { | 55 { |
56 foreach (str ; xml) | 56 foreach (str ; xml) |
57 { | 57 { |
58 Document document = new Document!(char); | 58 Document document = new Document!cast(wchar); |
59 document.parse(str); | 59 document.parse(str); |
60 | 60 |
61 foreach (node ; document.root.children) | 61 foreach (node ; document.root.children) |
62 { | 62 { |
63 if ("constant" == node.name) | 63 if ("constant" == node.name) |
83 | 83 |
84 public void generateConstantsMetaData() | 84 public void generateConstantsMetaData() |
85 { | 85 { |
86 foreach (str ; xml) | 86 foreach (str ; xml) |
87 { | 87 { |
88 Document document = new Document!(char); | 88 Document document = new Document!cast(wchar); |
89 document.parse(str); | 89 document.parse(str); |
90 | 90 |
91 foreach (node ; document.root.children) | 91 foreach (node ; document.root.children) |
92 { | 92 { |
93 if ("constant" == node.name) | 93 if ("constant" == node.name) |
113 | 113 |
114 public void generateEnums() | 114 public void generateEnums() |
115 { | 115 { |
116 foreach (str ; xml) | 116 foreach (str ; xml) |
117 { | 117 { |
118 Document document = new Document!(char); | 118 Document document = new Document!cast(wchar); |
119 document.parse(str); | 119 document.parse(str); |
120 | 120 |
121 foreach (node ; document.root.children) | 121 foreach (node ; document.root.children) |
122 { | 122 { |
123 if ("enum" == node.name) | 123 if ("enum" == node.name) |
324 outln(); | 324 outln(); |
325 out("\tOS.objc_msgSend_stret(result, "); | 325 out("\tOS.objc_msgSend_stret(result, "); |
326 } else if (returnNode !is null && isFloatingPoint(returnNode)) { | 326 } else if (returnNode !is null && isFloatingPoint(returnNode)) { |
327 String type = getJavaType(returnNode); | 327 String type = getJavaType(returnNode); |
328 out("\treturn "); | 328 out("\treturn "); |
329 if (type.opEquals("float")) out("(float)"); | 329 if (type.opEquals("float")) out("cast(float)"); |
330 out("OS.objc_msgSend_fpret("); | 330 out("OS.objc_msgSend_fpret("); |
331 } else if (returnNode !is null && isObject(returnNode)) { | 331 } else if (returnNode !is null && isObject(returnNode)) { |
332 out("\tint result = OS.objc_msgSend("); | 332 out("\tint result = OS.objc_msgSend("); |
333 } else { | 333 } else { |
334 if (returnNode !is null) { | 334 if (returnNode !is null) { |
433 } | 433 } |
434 } | 434 } |
435 } | 435 } |
436 } | 436 } |
437 for (Iterator iterator = set.iterator(); iterator.hasNext();) { | 437 for (Iterator iterator = set.iterator(); iterator.hasNext();) { |
438 String sel = (String) iterator.next(); | 438 String sel = cast(String) iterator.next(); |
439 String selConst = getSelConst(sel); | 439 String selConst = getSelConst(sel); |
440 out("public static final int "); | 440 out("public static final int "); |
441 out(selConst); | 441 out(selConst); |
442 out(" = "); | 442 out(" = "); |
443 out("sel_registerName(\""); | 443 out("sel_registerName(\""); |
572 outln(); | 572 outln(); |
573 out(key); | 573 out(key); |
574 out("_1=cast=(id)"); | 574 out("_1=cast=(id)"); |
575 outln(); | 575 outln(); |
576 out(key); | 576 out(key); |
577 out("_2=cast=(SEL)"); | 577 out("_2=cast=cast(SEL)"); |
578 outln(); | 578 outln(); |
579 } else { | 579 } else { |
580 out(key); | 580 out(key); |
581 out("_0=cast=(id)"); | 581 out("_0=cast=(id)"); |
582 outln(); | 582 outln(); |
583 out(key); | 583 out(key); |
584 out("_1=cast=(SEL)"); | 584 out("_1=cast=cast(SEL)"); |
585 outln(); | 585 outln(); |
586 } | 586 } |
587 Node method = (Node)set.get(key); | 587 Node method = cast(Node)set.get(key); |
588 NodeList params = method.getChildNodes(); | 588 NodeList params = method.getChildNodes(); |
589 for (int k = 0; k < params.getLength(); k++) { | 589 for (int k = 0; k < params.getLength(); k++) { |
590 Node param = params.item(k); | 590 Node param = params.item(k); |
591 if ("arg".opEquals(param.getLocalName())) { | 591 if ("arg".opEquals(param.getLocalName())) { |
592 out(key); | 592 out(key); |
626 } | 626 } |
627 } | 627 } |
628 } | 628 } |
629 } | 629 } |
630 for (Iterator iterator = set.iterator(); iterator.hasNext();) { | 630 for (Iterator iterator = set.iterator(); iterator.hasNext();) { |
631 String cls = (String) iterator.next(); | 631 String cls = cast(String) iterator.next(); |
632 String clsConst = "class_" + cls; | 632 String clsConst = "class_" + cls; |
633 out("public static final int "); | 633 out("public static final int "); |
634 out(clsConst); | 634 out(clsConst); |
635 out(" = "); | 635 out(" = "); |
636 out("objc_getClass(\""); | 636 out("objc_getClass(\""); |