annotate run/bug_20041226_A.d @ 1559:ec5e144583ea

D1 -> D2 : 1/N
author thomask
date Sun, 19 Aug 2007 19:11:54 +0000
parents 6e4063f99377
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
1 // $HeadURL$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
2 // $Date$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
3 // $Author$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
4
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
5 // @author@ h3r3tic <foo@bar.baz>
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
6 // @date@ 2004-12-26
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
7 // @uri@ news:cqmufn$26oj$1@digitaldaemon.com
1487
6e4063f99377 changed nntp: URLs to http: URLs
thomask
parents: 1383
diff changeset
8 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=2606
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
9
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
10
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
11 module dstress.run.bug_20041226_A;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
12
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
13 void dummy(...){
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
14 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
15
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
16 struct vec3{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
17 vec3 opSub(vec3 a){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
18 vec3 x;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
19 return x;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
20 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
21 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
22
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
23 struct Face{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
24 vec3 a;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
25 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
26
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
27 struct Mesh{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
28 Face[] faces;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
29 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
30
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
31 struct GeomObject{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
32 Mesh mesh;
1559
ec5e144583ea D1 -> D2 : 1/N
thomask
parents: 1487
diff changeset
33 string name;
ec5e144583ea D1 -> D2 : 1/N
thomask
parents: 1487
diff changeset
34 vec3 xlate;
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
35 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
36
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
37 class AseLoader{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
38 this(){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
39 GeomObject go;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
40 go.name = "NODE";
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
41 geomObjects ~= go;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
42 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
43
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
44 GeomObject[] geomObjects;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
45 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
46
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
47
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
48 void extractTriangles(GeomObject geomObj){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
49 void foobar(){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
50 try{
1269
c99e8aac0e0c partial review
thomask
parents: 736
diff changeset
51 dummy("name: ", geomObj.name);
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
52
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
53 return; // avoid accessing the array with 0 elements in the next line
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
54 geomObj.mesh.faces[0].a - geomObj.xlate; // when this line is removed, the bug doesn't appear
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
55 }catch(Object err){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
56 throw err;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
57 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
58 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
59
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
60 foobar();
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
61 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
62
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
63 int main(){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
64 try{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
65 AseLoader al = new AseLoader;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
66
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
67 foreach(GeomObject go; al.geomObjects){
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
68 dummy("processing ", go.name);
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
69 extractTriangles(go);
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
70 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
71 }catch(Object err){
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
72 dummy("Exception caught:", err);
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
73 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
74
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
75 return 0;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
76 }
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
77