Mercurial > projects > ldc
comparison dmd/module.c @ 1103:b30fe7e1dbb9
- Updated to DMD frontend 1.041.
- Removed dmd/inifile.c , it's not under a free license, replaced with libconfig based config file.
author | Tomas Lindquist Olsen <tomas.l.olsen gmail.com> |
---|---|
date | Thu, 12 Mar 2009 20:37:27 +0100 |
parents | a8cb25d478c4 |
children | eeb8b95ea92e |
comparison
equal
deleted
inserted
replaced
1102:ae950bd712d3 | 1103:b30fe7e1dbb9 |
---|---|
22 | 22 |
23 #if IN_GCC | 23 #if IN_GCC |
24 #include "gdc_alloca.h" | 24 #include "gdc_alloca.h" |
25 #endif | 25 #endif |
26 | 26 |
27 #include "mem.h" | 27 #include "rmem.h" |
28 | 28 |
29 #include "mars.h" | 29 #include "mars.h" |
30 #include "module.h" | 30 #include "module.h" |
31 #include "parse.h" | 31 #include "parse.h" |
32 #include "scope.h" | 32 #include "scope.h" |
86 isDocFile = 0; | 86 isDocFile = 0; |
87 needmoduleinfo = 0; | 87 needmoduleinfo = 0; |
88 #ifdef IN_GCC | 88 #ifdef IN_GCC |
89 strictlyneedmoduleinfo = 0; | 89 strictlyneedmoduleinfo = 0; |
90 #endif | 90 #endif |
91 selfimports = 0; | |
91 insearch = 0; | 92 insearch = 0; |
92 searchCacheIdent = NULL; | 93 searchCacheIdent = NULL; |
93 searchCacheSymbol = NULL; | 94 searchCacheSymbol = NULL; |
94 searchCacheFlags = 0; | 95 searchCacheFlags = 0; |
95 semanticstarted = 0; | 96 semanticstarted = 0; |
143 llvmForceLogging = false; | 144 llvmForceLogging = false; |
144 this->doDocComment = doDocComment; | 145 this->doDocComment = doDocComment; |
145 this->doHdrGen = doHdrGen; | 146 this->doHdrGen = doHdrGen; |
146 } | 147 } |
147 | 148 |
148 File* Module::buildFilePath(char* forcename, char* path, char* ext) | 149 File* Module::buildFilePath(const char* forcename, const char* path, const char* ext) |
149 { | 150 { |
150 char *argobj; | 151 const char *argobj; |
151 if (forcename) | 152 if (forcename) |
152 argobj = forcename; | 153 argobj = forcename; |
153 else | 154 else |
154 { | 155 { |
155 if (preservePaths) | 156 if (preservePaths) |
158 argobj = FileName::name((char*)this->arg); | 159 argobj = FileName::name((char*)this->arg); |
159 | 160 |
160 if (fqnNames) | 161 if (fqnNames) |
161 { | 162 { |
162 if(md) | 163 if(md) |
163 argobj = FileName::replaceName(argobj, md->toChars()); | 164 argobj = FileName::replaceName((char*)argobj, md->toChars()); |
164 else | 165 else |
165 argobj = FileName::replaceName(argobj, toChars()); | 166 argobj = FileName::replaceName((char*)argobj, toChars()); |
166 | 167 |
167 // add ext, otherwise forceExt will make nested.module into nested.bc | 168 // add ext, otherwise forceExt will make nested.module into nested.bc |
168 size_t len = strlen(argobj); | 169 size_t len = strlen(argobj); |
169 size_t extlen = strlen(ext); | 170 size_t extlen = strlen(ext); |
170 char* s = (char *)alloca(len + 1 + extlen + 1); | 171 char* s = (char *)alloca(len + 1 + extlen + 1); |
924 return TRUE; | 925 return TRUE; |
925 if (!mi->insearch) | 926 if (!mi->insearch) |
926 { | 927 { |
927 mi->insearch = 1; | 928 mi->insearch = 1; |
928 int r = mi->imports(m); | 929 int r = mi->imports(m); |
929 mi->insearch = 0; | |
930 if (r) | 930 if (r) |
931 return r; | 931 return r; |
932 } | 932 } |
933 } | 933 } |
934 return FALSE; | 934 return FALSE; |
935 } | 935 } |
936 | |
937 /************************************* | |
938 * Return !=0 if module imports itself. | |
939 */ | |
940 | |
941 int Module::selfImports() | |
942 { | |
943 //printf("Module::selfImports() %s\n", toChars()); | |
944 if (!selfimports) | |
945 { | |
946 for (int i = 0; i < amodules.dim; i++) | |
947 { Module *mi = (Module *)amodules.data[i]; | |
948 //printf("\t[%d] %s\n", i, mi->toChars()); | |
949 mi->insearch = 0; | |
950 } | |
951 | |
952 selfimports = imports(this) + 1; | |
953 | |
954 for (int i = 0; i < amodules.dim; i++) | |
955 { Module *mi = (Module *)amodules.data[i]; | |
956 //printf("\t[%d] %s\n", i, mi->toChars()); | |
957 mi->insearch = 0; | |
958 } | |
959 } | |
960 return selfimports - 1; | |
961 } | |
962 | |
936 | 963 |
937 /* =========================== ModuleDeclaration ===================== */ | 964 /* =========================== ModuleDeclaration ===================== */ |
938 | 965 |
939 ModuleDeclaration::ModuleDeclaration(Array *packages, Identifier *id) | 966 ModuleDeclaration::ModuleDeclaration(Array *packages, Identifier *id) |
940 { | 967 { |