Mercurial > projects > ldc
comparison dmd/mars.c @ 1587:def7a1d494fd
Merge DMD 1.051
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Fri, 06 Nov 2009 23:58:01 +0100 |
parents | dd5dbe7b3923 |
children | a413ae7329bf |
comparison
equal
deleted
inserted
replaced
1586:7f728c52e63c | 1587:def7a1d494fd |
---|---|
30 #include "mtype.h" | 30 #include "mtype.h" |
31 #include "id.h" | 31 #include "id.h" |
32 #include "cond.h" | 32 #include "cond.h" |
33 #include "expression.h" | 33 #include "expression.h" |
34 #include "lexer.h" | 34 #include "lexer.h" |
35 #include "json.h" | |
35 | 36 |
36 #include "gen/revisions.h" | 37 #include "gen/revisions.h" |
37 | 38 |
38 Global global; | 39 Global global; |
39 | 40 |
42 mars_ext = "d"; | 43 mars_ext = "d"; |
43 sym_ext = "d"; | 44 sym_ext = "d"; |
44 hdr_ext = "di"; | 45 hdr_ext = "di"; |
45 doc_ext = "html"; | 46 doc_ext = "html"; |
46 ddoc_ext = "ddoc"; | 47 ddoc_ext = "ddoc"; |
48 json_ext = "json"; | |
47 | 49 |
48 // LDC | 50 // LDC |
49 ll_ext = "ll"; | 51 ll_ext = "ll"; |
50 bc_ext = "bc"; | 52 bc_ext = "bc"; |
51 s_ext = "s"; | 53 s_ext = "s"; |
54 obj_ext_alt = "obj"; | 56 obj_ext_alt = "obj"; |
55 #endif | 57 #endif |
56 | 58 |
57 copyright = "Copyright (c) 1999-2009 by Digital Mars and Tomas Lindquist Olsen"; | 59 copyright = "Copyright (c) 1999-2009 by Digital Mars and Tomas Lindquist Olsen"; |
58 written = "written by Walter Bright and Tomas Lindquist Olsen"; | 60 written = "written by Walter Bright and Tomas Lindquist Olsen"; |
59 version = "v1.045"; | 61 version = "v1.051"; |
60 ldc_version = LDC_REV; | 62 ldc_version = LDC_REV; |
61 llvm_version = LLVM_REV_STR; | 63 llvm_version = LLVM_REV_STR; |
62 global.structalign = 8; | 64 global.structalign = 8; |
63 | 65 |
64 // This should only be used as a global, so the other fields are | 66 // This should only be used as a global, so the other fields are |
88 { | 90 { |
89 this->linnum = linnum; | 91 this->linnum = linnum; |
90 this->filename = mod ? mod->srcfile->toChars() : NULL; | 92 this->filename = mod ? mod->srcfile->toChars() : NULL; |
91 } | 93 } |
92 | 94 |
95 bool Loc::equals(const Loc& loc) | |
96 { | |
97 return linnum == loc.linnum && FileName::equals(filename, loc.filename); | |
98 } | |
99 | |
93 /************************************** | 100 /************************************** |
94 * Print error message and exit. | 101 * Print error message and exit. |
95 */ | 102 */ |
96 | 103 |
97 void error(Loc loc, const char *format, ...) | 104 void error(Loc loc, const char *format, ...) |
178 * The string is separated into arguments, processing \ and ". | 185 * The string is separated into arguments, processing \ and ". |
179 */ | 186 */ |
180 | 187 |
181 void getenv_setargv(const char *envvar, int *pargc, char** *pargv) | 188 void getenv_setargv(const char *envvar, int *pargc, char** *pargv) |
182 { | 189 { |
183 char *env; | |
184 char *p; | 190 char *p; |
185 Array *argv; | 191 |
186 int argc; | |
187 | |
188 int wildcard; // do wildcard expansion | |
189 int instring; | 192 int instring; |
190 int slash; | 193 int slash; |
191 char c; | 194 char c; |
192 int j; | 195 |
193 | 196 char *env = getenv(envvar); |
194 env = getenv(envvar); | |
195 if (!env) | 197 if (!env) |
196 return; | 198 return; |
197 | 199 |
198 env = mem.strdup(env); // create our own writable copy | 200 env = mem.strdup(env); // create our own writable copy |
199 | 201 |
200 argc = *pargc; | 202 int argc = *pargc; |
201 argv = new Array(); | 203 Array *argv = new Array(); |
202 argv->setDim(argc); | 204 argv->setDim(argc); |
203 | 205 |
204 int argc_left = 0; | 206 int argc_left = 0; |
205 for (int i = 0; i < argc; i++) { | 207 for (int i = 0; i < argc; i++) { |
206 if (!strcmp((*pargv)[i], "-run") || !strcmp((*pargv)[i], "--run")) { | 208 if (!strcmp((*pargv)[i], "-run") || !strcmp((*pargv)[i], "--run")) { |
218 } | 220 } |
219 // HACK to stop required values from command line being drawn from DFLAGS | 221 // HACK to stop required values from command line being drawn from DFLAGS |
220 argv->push((char*)""); | 222 argv->push((char*)""); |
221 argc++; | 223 argc++; |
222 | 224 |
223 j = 1; // leave argv[0] alone | 225 int j = 1; // leave argv[0] alone |
224 while (1) | 226 while (1) |
225 { | 227 { |
226 wildcard = 1; | 228 int wildcard = 1; // do wildcard expansion |
227 switch (*env) | 229 switch (*env) |
228 { | 230 { |
229 case ' ': | 231 case ' ': |
230 case '\t': | 232 case '\t': |
231 env++; | 233 env++; |