comparison lphobos/std/moduleinit.d @ 473:373489eeaf90

Applied downs' lphobos update
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Mon, 04 Aug 2008 19:28:49 +0200
parents 56a21f3e5d3e
children eef8ac26c66c
comparison
equal deleted inserted replaced
472:15c804b6ce77 473:373489eeaf90
49 extern (C) void _moduleCtor() 49 extern (C) void _moduleCtor()
50 { 50 {
51 debug printf("_moduleCtor()\n"); 51 debug printf("_moduleCtor()\n");
52 int len = 0; 52 int len = 0;
53 53
54 ModuleInfo* mrbegin = cast(ModuleInfo*)_d_get_moduleinfo_array(); 54 for (auto mr = _Dmodule_ref; mr; mr=mr.next)
55 assert(mrbegin !is null);
56
57 ModuleInfo* mr;
58 for (mr = mrbegin; *mr !is null; ++mr)
59 len++; 55 len++;
60 _moduleinfo_array = new ModuleInfo[len]; 56 _moduleinfo_array = new ModuleInfo[len];
61 len = 0; 57 len = 0;
62 for (mr = mrbegin; *mr !is null; ++mr) 58 for (auto mr = _Dmodule_ref; mr; mr=mr.next)
63 { _moduleinfo_array[len] = *mr; 59 { _moduleinfo_array[len] = mr.mod;
64 len++; 60 len++;
65 } 61 }
66 62
67 version (Win32) 63 version (Win32)
68 { 64 {
95 ModuleInfo m = mi[i]; 91 ModuleInfo m = mi[i];
96 92
97 debug printf("\tmodule[%d] = '%p'\n", i, m); 93 debug printf("\tmodule[%d] = '%p'\n", i, m);
98 if (!m) 94 if (!m)
99 continue; 95 continue;
100 debug printf("\tmodule[%d] = '%.*s'\n", i, m.name); 96 debug printf("\tmodule[%d] = '%.*s'\n", i, m.name.length, m.name.ptr);
101 if (m.flags & MIctordone) 97 if (m.flags & MIctordone)
102 continue; 98 continue;
103 debug printf("\tmodule[%d] = '%.*s', m = x%x\n", i, m.name, m); 99 debug printf("\tmodule[%d] = '%.*s', m = 0x%x\n", i, m.name.length, m.name.ptr, m);
104 100
105 if (m.ctor || m.dtor) 101 if (m.ctor || m.dtor)
106 { 102 {
107 if (m.flags & MIctorstart) 103 if (m.flags & MIctorstart)
108 { if (skip || m.flags & MIstandalone) 104 { if (skip || m.flags & MIstandalone)
109 continue; 105 continue;
106 debug printf("\tmodule[%d] = '%.*s', cyclic dependency!\n", i, m.name.length, m.name.ptr);
107 int x = 0; x /= x;
110 throw new ModuleCtorError(m); 108 throw new ModuleCtorError(m);
111 } 109 }
112 110
113 m.flags |= MIctorstart; 111 m.flags |= MIctorstart;
114 _moduleCtor2(m.importedModules, 0); 112 _moduleCtor2(m.importedModules, 0);
158 * Run unit tests. 156 * Run unit tests.
159 */ 157 */
160 158
161 extern (C) void _moduleUnitTests() 159 extern (C) void _moduleUnitTests()
162 { 160 {
163 debug printf("_moduleUnitTests()\n"); 161 debug printf("_moduleUnitTests() %i\n", _moduleinfo_array.length);
164 for (uint i = 0; i < _moduleinfo_array.length; i++) 162 for (uint i = 0; i < _moduleinfo_array.length; i++)
165 { 163 {
166 ModuleInfo m = _moduleinfo_array[i]; 164 ModuleInfo m = _moduleinfo_array[i];
167 165
168 if (!m) 166 if (!m)