Skip to content

Commit a61b10e

Browse files
committed
continue dgetcmd.d
1 parent c6acc3d commit a61b10e

File tree

4 files changed

+48
-39
lines changed

4 files changed

+48
-39
lines changed

dm/src/dmc/cc.d

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,10 +1645,10 @@ struct EEcontext
16451645
uint EElinnum; // line number to insert expression
16461646
char *EEexpr; // expression
16471647
char *EEtypedef; // typedef identifier
1648-
char EEpending; // !=0 means we haven't compiled it yet
1649-
char EEimminent; // we've installed it in the source text
1650-
char EEcompile; // we're compiling for the EE expression
1651-
char EEin; // we are parsing an EE expression
1648+
byte EEpending; // !=0 means we haven't compiled it yet
1649+
byte EEimminent; // we've installed it in the source text
1650+
byte EEcompile; // we're compiling for the EE expression
1651+
byte EEin; // we are parsing an EE expression
16521652
elem *EEelem; // compiled version of EEexpr
16531653
Symbol *EEfunc; // function expression is in
16541654
code *EEcode; // generated code

dm/src/dmc/dgetcmd.d

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,16 +60,14 @@ enum INC_ENV = "INCLUDE";
6060
/*private*/ void predefine(const char *name);
6161
/*private*/ void sw_d(char *);
6262
/*private*/ void addpath(phstring_t *, const char *);
63-
/*private*/ phstring_t mergepaths(phstring_t pathlist, phstring_t pathsyslist);
63+
/*private*/ void mergepaths(phstring_t pathlist, phstring_t pathsyslist, ref phstring_t result);
6464
/*private*/ void getcmd_cflags(int *,char ***);
6565
+/
6666

67-
version (none)
68-
{
6967
__gshared
7068
{
71-
private __gshared char[2] one = "1";
7269

70+
private __gshared char[2] one = "1";
7371
__gshared Config config = // part of configuration saved in ph
7472
{
7573
'D', // compile for C++
@@ -84,20 +82,18 @@ __gshared Config config = // part of configuration saved in ph
8482
Configv configv; // non-ph part of configuration
8583
EEcontext eecontext;
8684

85+
char switch_E = 0; // for LINRECOR.ASM
8786
extern (C)
8887
{
89-
char switch_E = 0; // for LINRECOR.ASM
9088
int _version = VERSIONINT;
9189
}
9290

9391
const(char)* versionString = "(SCVersion)@" ~ COMPILER ~ " " ~ VERSION ~ SUFFIX;
9492
const(char)* copyright = COPYRIGHT;
9593
}
9694

97-
version (none)
98-
{
95+
version (all){
9996

100-
}
10197
version (_WINDLL)
10298
{
10399
}
@@ -234,23 +230,22 @@ version(all){
234230
dotext = filespecdotext(p);
235231
version (SPP)
236232
{
237-
if (filespeccmp(dotext,ext_i) == 0)
233+
if (filespeccmp(dotext,ext_i.ptr) == 0)
238234
foutname = p;
239-
else if (filespeccmp(dotext,ext_dep) == 0)
235+
else if (filespeccmp(dotext,ext_dep.ptr) == 0)
240236
fdepname = p;
241237
else
242238
finname = p;
243239
}
244240
else version (HTOD)
245241
{
246-
if (filespeccmp(dotext,ext_dmodule) == 0)
242+
if (filespeccmp(dotext,ext_dmodule.ptr) == 0)
247243
fdmodulename = p;
248244
else
249245
finname = p;
250246
}
251247
else
252248
{
253-
254249
if (filespeccmp(dotext,ext_obj.ptr) == 0)
255250
foutname = p;
256251
else if (filespeccmp(dotext,ext_dep.ptr) == 0)
@@ -630,6 +625,11 @@ version (HTOD)
630625
default: /* ignore invalid flags */
631626
config.flags2 &= ~(CFG2phgen | CFG2phuse | CFG2phauto | CFG2phautoy | CFG2once);
632627
break;
628+
}
629+
else
630+
{
631+
default:
632+
break;
633633
}
634634
}
635635
break;
@@ -1417,8 +1417,11 @@ else
14171417
addpath(&pathsyslist, p + 7);
14181418
break;
14191419
case 'X':
1420+
version (SCPP)
1421+
{
14201422
if (CPP && template_getcmd(p))
14211423
goto badflag;
1424+
}
14221425
break;
14231426
default:
14241427
break;
@@ -1434,7 +1437,7 @@ else
14341437
*/
14351438
addpath(&pathlist, getenv(INC_ENV)); // get path from environment
14361439
}
1437-
pathlist = mergepaths(pathlist, pathsyslist);
1440+
mergepaths(pathlist, pathsyslist, pathlist);
14381441

14391442
if (!switch_U) /* if didn't turn them off */
14401443
{
@@ -1688,6 +1691,7 @@ else
16881691

16891692
linkage = config.linkage;
16901693
}
1694+
}
16911695

16921696

16931697
/*****************************
@@ -1696,6 +1700,7 @@ else
16961700

16971701
/*private*/ void predefine(const(char)* name)
16981702
{
1703+
__gshared char[2] one = "1";
16991704
if (*name == '_' || !config.ansi_c)
17001705
defmac(name,one.ptr);
17011706
}
@@ -1711,6 +1716,8 @@ else
17111716
/*private*/ void sw_d(char *p)
17121717
{ char *pstart;
17131718

1719+
__gshared char[2] one = "1";
1720+
17141721
if (!*p)
17151722
{ defmac("DEBUG",one.ptr);
17161723
config.flags5 |= CFG5debug | CFG5in | CFG5out | CFG5invariant;
@@ -1813,15 +1820,17 @@ static if (0)
18131820
* pathsysi
18141821
*/
18151822

1816-
/*private*/ phstring_t mergepaths(phstring_t pathlist, phstring_t pathsyslist)
1823+
/*private*/ void mergepaths(phstring_t pathlist, phstring_t pathsyslist, ref phstring_t res)
18171824
{
18181825
if (pathsyslist.length() == 0)
18191826
{
18201827
pathsysi = pathlist.length();
1821-
return pathlist;
1828+
res = pathlist;
1829+
return;
18221830
}
18231831

1824-
phstring_t result;
1832+
phstring_t result = void;
1833+
result.dim = 0;
18251834

18261835
for (size_t i = 0; i < pathlist.length(); ++i)
18271836
{
@@ -1840,8 +1849,7 @@ static if (0)
18401849
pathlist.free(&mem_freefp);
18411850
pathsyslist.free(&mem_freefp);
18421851

1843-
return result;
1844-
}
1852+
res = result;
18451853
}
18461854

18471855
/*********************************

dm/src/dmc/getcmd.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,11 @@ static char __file__[] = __FILE__; /* for tassert.h */
3838
STATIC void predefine(const char *name);
3939
STATIC void sw_d(char *);
4040
STATIC void addpath(phstring_t *, const char *);
41-
static phstring_t mergepaths(phstring_t pathlist, phstring_t pathsyslist);
41+
STATIC void mergepaths(phstring_t pathlist, phstring_t pathsyslist, phstring_t& result);
4242
STATIC void getcmd_cflags(int *,char ***);
4343

44-
static char one[] = "1";
44+
#if 0
45+
STATIC char one[2] = "1";
4546

4647
Config config = // part of configuration saved in ph
4748
{
@@ -1354,7 +1355,7 @@ void getcmd(int argc,char **argv)
13541355
*/
13551356
addpath(&pathlist, getenv(INC_ENV)); // get path from environment
13561357
}
1357-
pathlist = mergepaths(pathlist, pathsyslist);
1358+
mergepaths(pathlist, pathsyslist, pathlist);
13581359

13591360
if (!switch_U) /* if didn't turn them off */
13601361
{
@@ -1717,12 +1718,13 @@ STATIC void addpath(phstring_t *ppathlist, const char *q)
17171718
* pathsysi
17181719
*/
17191720

1720-
static phstring_t mergepaths(phstring_t pathlist, phstring_t pathsyslist)
1721+
STATIC void mergepaths(phstring_t pathlist, phstring_t pathsyslist, phstring_t& res)
17211722
{
17221723
if (pathsyslist.length() == 0)
17231724
{
17241725
pathsysi = pathlist.length();
1725-
return pathlist;
1726+
res = pathlist;
1727+
return;
17261728
}
17271729

17281730
phstring_t result;
@@ -1744,14 +1746,13 @@ static phstring_t mergepaths(phstring_t pathlist, phstring_t pathsyslist)
17441746
pathlist.free(mem_freefp);
17451747
pathsyslist.free(mem_freefp);
17461748

1747-
return result;
1749+
res = result;
17481750
}
17491751

17501752
/*********************************
17511753
* Handle expansion of CFLAGS like SC driver does.
17521754
*/
17531755

1754-
#if 0
17551756
#if SPP
17561757

17571758
static char *cflags;

dm/src/dmc/parser.d

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ struct phstring_t
126126

127127
void free(list_free_fp freeptr);
128128

129-
private:
129+
// private:
130130
size_t dim;
131131
char** data;
132132
}
@@ -400,15 +400,15 @@ int template_paramlstmatch(type *, type *);
400400
/* from file.c */
401401
extern (C)
402402
{
403-
extern __gshared char[] ext_obj;
404-
extern __gshared char[] ext_i;
405-
extern __gshared char[] ext_dep;
406-
extern __gshared char[] ext_lst;
407-
extern __gshared char[] ext_hpp;
408-
extern __gshared char[] ext_c;
409-
extern __gshared char[] ext_cpp;
410-
extern __gshared char[] ext_sym;
411-
extern __gshared char[] ext_tdb;
403+
extern __gshared char[5] ext_obj; // or [3] for ".o"
404+
extern __gshared char[3] ext_i;
405+
extern __gshared char[5] ext_dep;
406+
extern __gshared char[5] ext_lst;
407+
extern __gshared char[5] ext_hpp;
408+
extern __gshared char[3] ext_c;
409+
extern __gshared char[5] ext_cpp;
410+
extern __gshared char[5] ext_sym;
411+
extern __gshared char[5] ext_tdb;
412412
}
413413

414414
// htod

0 commit comments

Comments
 (0)