mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-17 05:13:14 +01:00
DMD 2.032 Merge.
This commit is contained in:
@@ -333,6 +333,17 @@ void Expression::buildArrayIdent(OutBuffer *buf, Expressions *arguments)
|
||||
arguments->shift(this);
|
||||
}
|
||||
|
||||
void CastExp::buildArrayIdent(OutBuffer *buf, Expressions *arguments)
|
||||
{
|
||||
Type *tb = type->toBasetype();
|
||||
if (tb->ty == Tarray || tb->ty == Tsarray)
|
||||
{
|
||||
e1->buildArrayIdent(buf, arguments);
|
||||
}
|
||||
else
|
||||
Expression::buildArrayIdent(buf, arguments);
|
||||
}
|
||||
|
||||
void SliceExp::buildArrayIdent(OutBuffer *buf, Expressions *arguments)
|
||||
{
|
||||
buf->writestring("Slice");
|
||||
@@ -417,6 +428,17 @@ Expression *Expression::buildArrayLoop(Arguments *fparams)
|
||||
return e;
|
||||
}
|
||||
|
||||
Expression *CastExp::buildArrayLoop(Arguments *fparams)
|
||||
{
|
||||
Type *tb = type->toBasetype();
|
||||
if (tb->ty == Tarray || tb->ty == Tsarray)
|
||||
{
|
||||
return e1->buildArrayLoop(fparams);
|
||||
}
|
||||
else
|
||||
Expression::buildArrayLoop(fparams);
|
||||
}
|
||||
|
||||
Expression *SliceExp::buildArrayLoop(Arguments *fparams)
|
||||
{
|
||||
Identifier *id = Identifier::generateId("p", fparams->dim);
|
||||
@@ -435,12 +457,14 @@ Expression *AssignExp::buildArrayLoop(Arguments *fparams)
|
||||
/* Evaluate assign expressions right to left
|
||||
*/
|
||||
Expression *ex2 = e2->buildArrayLoop(fparams);
|
||||
#if DMDV2
|
||||
/* Need the cast because:
|
||||
* b = c + p[i];
|
||||
* where b is a byte fails because (c + p[i]) is an int
|
||||
* which cannot be implicitly cast to byte.
|
||||
*/
|
||||
ex2 = new CastExp(0, ex2, e1->type->nextOf());
|
||||
#endif
|
||||
Expression *ex1 = e1->buildArrayLoop(fparams);
|
||||
Argument *param = (Argument *)fparams->data[0];
|
||||
param->storageClass = 0;
|
||||
|
||||
234
dmd2/attrib.c
234
dmd2/attrib.c
@@ -77,6 +77,41 @@ int AttribDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum)
|
||||
return m;
|
||||
}
|
||||
|
||||
void AttribDeclaration::setScopeNewSc(Scope *sc,
|
||||
unsigned stc, enum LINK linkage, enum PROT protection, int explicitProtection,
|
||||
unsigned structalign)
|
||||
{
|
||||
if (decl)
|
||||
{
|
||||
Scope *newsc = sc;
|
||||
if (stc != sc->stc ||
|
||||
linkage != sc->linkage ||
|
||||
protection != sc->protection ||
|
||||
explicitProtection != sc->explicitProtection ||
|
||||
structalign != sc->structalign)
|
||||
{
|
||||
// create new one for changes
|
||||
newsc = new Scope(*sc);
|
||||
newsc->flags &= ~SCOPEfree;
|
||||
newsc->stc = stc;
|
||||
newsc->linkage = linkage;
|
||||
newsc->protection = protection;
|
||||
newsc->explicitProtection = explicitProtection;
|
||||
newsc->structalign = structalign;
|
||||
}
|
||||
for (unsigned i = 0; i < decl->dim; i++)
|
||||
{ Dsymbol *s = (Dsymbol *)decl->data[i];
|
||||
|
||||
s->setScope(newsc); // yes, the only difference from semanticNewSc()
|
||||
}
|
||||
if (newsc != sc)
|
||||
{
|
||||
sc->offset = newsc->offset;
|
||||
newsc->pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AttribDeclaration::semanticNewSc(Scope *sc,
|
||||
unsigned stc, enum LINK linkage, enum PROT protection, int explicitProtection,
|
||||
unsigned structalign)
|
||||
@@ -340,11 +375,33 @@ Dsymbol *StorageClassDeclaration::syntaxCopy(Dsymbol *s)
|
||||
return scd;
|
||||
}
|
||||
|
||||
void StorageClassDeclaration::setScope(Scope *sc)
|
||||
{
|
||||
if (decl)
|
||||
{
|
||||
unsigned scstc = sc->stc;
|
||||
|
||||
/* These sets of storage classes are mutually exclusive,
|
||||
* so choose the innermost or most recent one.
|
||||
*/
|
||||
if (stc & (STCauto | STCscope | STCstatic | STCextern | STCmanifest))
|
||||
scstc &= ~(STCauto | STCscope | STCstatic | STCextern | STCmanifest);
|
||||
if (stc & (STCauto | STCscope | STCstatic | STCtls | STCmanifest | STCgshared))
|
||||
scstc &= ~(STCauto | STCscope | STCstatic | STCtls | STCmanifest | STCgshared);
|
||||
if (stc & (STCconst | STCimmutable | STCmanifest))
|
||||
scstc &= ~(STCconst | STCimmutable | STCmanifest);
|
||||
if (stc & (STCgshared | STCshared | STCtls))
|
||||
scstc &= ~(STCgshared | STCshared | STCtls);
|
||||
scstc |= stc;
|
||||
|
||||
setScopeNewSc(sc, scstc, sc->linkage, sc->protection, sc->explicitProtection, sc->structalign);
|
||||
}
|
||||
}
|
||||
|
||||
void StorageClassDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
if (decl)
|
||||
{
|
||||
#if 1
|
||||
unsigned scstc = sc->stc;
|
||||
|
||||
/* These sets of storage classes are mutually exclusive,
|
||||
@@ -361,29 +418,6 @@ void StorageClassDeclaration::semantic(Scope *sc)
|
||||
scstc |= stc;
|
||||
|
||||
semanticNewSc(sc, scstc, sc->linkage, sc->protection, sc->explicitProtection, sc->structalign);
|
||||
#else
|
||||
unsigned stc_save = sc->stc;
|
||||
|
||||
/* These sets of storage classes are mutually exclusive,
|
||||
* so choose the innermost or most recent one.
|
||||
*/
|
||||
if (stc & (STCauto | STCscope | STCstatic | STCextern | STCmanifest))
|
||||
sc->stc &= ~(STCauto | STCscope | STCstatic | STCextern | STCmanifest);
|
||||
if (stc & (STCauto | STCscope | STCstatic | STCtls | STCmanifest | STCgshared))
|
||||
sc->stc &= ~(STCauto | STCscope | STCstatic | STCtls | STCmanifest | STCgshared);
|
||||
if (stc & (STCconst | STCimmutable | STCmanifest))
|
||||
sc->stc &= ~(STCconst | STCimmutable | STCmanifest);
|
||||
if (stc & (STCgshared | STCshared | STCtls))
|
||||
sc->stc &= ~(STCgshared | STCshared | STCtls);
|
||||
sc->stc |= stc;
|
||||
for (unsigned i = 0; i < decl->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)decl->data[i];
|
||||
|
||||
s->semantic(sc);
|
||||
}
|
||||
sc->stc = stc_save;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -402,22 +436,24 @@ void StorageClassDeclaration::stcToCBuffer(OutBuffer *buf, int stc)
|
||||
{ STCstatic, TOKstatic },
|
||||
{ STCextern, TOKextern },
|
||||
{ STCconst, TOKconst },
|
||||
{ STCimmutable, TOKimmutable },
|
||||
{ STCshared, TOKshared },
|
||||
{ STCfinal, TOKfinal },
|
||||
{ STCabstract, TOKabstract },
|
||||
{ STCsynchronized, TOKsynchronized },
|
||||
{ STCdeprecated, TOKdeprecated },
|
||||
{ STCoverride, TOKoverride },
|
||||
{ STClazy, TOKlazy },
|
||||
{ STCalias, TOKalias },
|
||||
{ STCout, TOKout },
|
||||
{ STCin, TOKin },
|
||||
#if DMDV2
|
||||
{ STCimmutable, TOKimmutable },
|
||||
{ STCshared, TOKshared },
|
||||
{ STCnothrow, TOKnothrow },
|
||||
{ STCpure, TOKpure },
|
||||
{ STCref, TOKref },
|
||||
{ STCtls, TOKtls },
|
||||
{ STCgshared, TOKgshared },
|
||||
{ STClazy, TOKlazy },
|
||||
{ STCalias, TOKalias },
|
||||
{ STCout, TOKout },
|
||||
{ STCin, TOKin },
|
||||
#endif
|
||||
};
|
||||
|
||||
for (int i = 0; i < sizeof(table)/sizeof(table[0]); i++)
|
||||
@@ -454,25 +490,21 @@ Dsymbol *LinkDeclaration::syntaxCopy(Dsymbol *s)
|
||||
return ld;
|
||||
}
|
||||
|
||||
void LinkDeclaration::setScope(Scope *sc)
|
||||
{
|
||||
//printf("LinkDeclaration::setScope(linkage = %d, decl = %p)\n", linkage, decl);
|
||||
if (decl)
|
||||
{
|
||||
setScopeNewSc(sc, sc->stc, linkage, sc->protection, sc->explicitProtection, sc->structalign);
|
||||
}
|
||||
}
|
||||
|
||||
void LinkDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
//printf("LinkDeclaration::semantic(linkage = %d, decl = %p)\n", linkage, decl);
|
||||
if (decl)
|
||||
{
|
||||
#if 1
|
||||
semanticNewSc(sc, sc->stc, linkage, sc->protection, sc->explicitProtection, sc->structalign);
|
||||
#else
|
||||
enum LINK linkage_save = sc->linkage;
|
||||
|
||||
sc->linkage = linkage;
|
||||
for (unsigned i = 0; i < decl->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)decl->data[i];
|
||||
|
||||
s->semantic(sc);
|
||||
}
|
||||
sc->linkage = linkage_save;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -544,27 +576,19 @@ Dsymbol *ProtDeclaration::syntaxCopy(Dsymbol *s)
|
||||
return pd;
|
||||
}
|
||||
|
||||
void ProtDeclaration::setScope(Scope *sc)
|
||||
{
|
||||
if (decl)
|
||||
{
|
||||
setScopeNewSc(sc, sc->stc, sc->linkage, protection, 1, sc->structalign);
|
||||
}
|
||||
}
|
||||
|
||||
void ProtDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
if (decl)
|
||||
{
|
||||
#if 1
|
||||
semanticNewSc(sc, sc->stc, sc->linkage, protection, 1, sc->structalign);
|
||||
#else
|
||||
enum PROT protection_save = sc->protection;
|
||||
int explicitProtection_save = sc->explicitProtection;
|
||||
|
||||
sc->protection = protection;
|
||||
sc->explicitProtection = 1;
|
||||
for (unsigned i = 0; i < decl->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)decl->data[i];
|
||||
|
||||
s->semantic(sc);
|
||||
}
|
||||
sc->protection = protection_save;
|
||||
sc->explicitProtection = explicitProtection_save;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -611,44 +635,21 @@ Dsymbol *AlignDeclaration::syntaxCopy(Dsymbol *s)
|
||||
return ad;
|
||||
}
|
||||
|
||||
void AlignDeclaration::setScope(Scope *sc)
|
||||
{
|
||||
//printf("\tAlignDeclaration::setScope '%s'\n",toChars());
|
||||
if (decl)
|
||||
{
|
||||
setScopeNewSc(sc, sc->stc, sc->linkage, sc->protection, sc->explicitProtection, salign);
|
||||
}
|
||||
}
|
||||
|
||||
void AlignDeclaration::semantic(Scope *sc)
|
||||
{
|
||||
// LDC
|
||||
// we only support packed structs, as from the spec: align(1) struct Packed { ... }
|
||||
// other alignments are simply ignored. my tests show this is what llvm-gcc does too ...
|
||||
|
||||
//printf("\tAlignDeclaration::semantic '%s'\n",toChars());
|
||||
if (decl)
|
||||
{
|
||||
#if 1
|
||||
semanticNewSc(sc, sc->stc, sc->linkage, sc->protection, sc->explicitProtection, salign);
|
||||
#else
|
||||
unsigned salign_save = sc->structalign;
|
||||
|
||||
#if IN_DMD
|
||||
sc->structalign = salign;
|
||||
#endif
|
||||
for (unsigned i = 0; i < decl->dim; i++)
|
||||
{
|
||||
Dsymbol *s = (Dsymbol *)decl->data[i];
|
||||
|
||||
#if IN_LLVM
|
||||
if (s->isStructDeclaration() && salign == 1)
|
||||
{
|
||||
sc->structalign = salign;
|
||||
s->semantic(sc);
|
||||
sc->structalign = salign_save;
|
||||
}
|
||||
else
|
||||
{
|
||||
#endif
|
||||
s->semantic(sc);
|
||||
#if IN_LLVM
|
||||
}
|
||||
#endif
|
||||
}
|
||||
sc->structalign = salign_save;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
assert(0 && "what kind of align use triggers this?");
|
||||
@@ -870,6 +871,39 @@ Dsymbol *PragmaDeclaration::syntaxCopy(Dsymbol *s)
|
||||
return pd;
|
||||
}
|
||||
|
||||
void PragmaDeclaration::setScope(Scope *sc)
|
||||
{
|
||||
#if TARGET_NET
|
||||
if (ident == Lexer::idPool("assembly"))
|
||||
{
|
||||
if (!args || args->dim != 1)
|
||||
{
|
||||
error("pragma has invalid number of arguments");
|
||||
}
|
||||
else
|
||||
{
|
||||
Expression *e = (Expression *)args->data[0];
|
||||
e = e->semantic(sc);
|
||||
e = e->optimize(WANTvalue | WANTinterpret);
|
||||
args->data[0] = (void *)e;
|
||||
if (e->op != TOKstring)
|
||||
{
|
||||
error("string expected, not '%s'", e->toChars());
|
||||
}
|
||||
PragmaScope* pragma = new PragmaScope(this, sc->parent, static_cast<StringExp*>(e));
|
||||
|
||||
assert(sc);
|
||||
pragma->setScope(sc);
|
||||
|
||||
//add to module members
|
||||
assert(sc->module);
|
||||
assert(sc->module->members);
|
||||
sc->module->members->push(pragma);
|
||||
}
|
||||
}
|
||||
#endif // TARGET_NET
|
||||
}
|
||||
|
||||
void PragmaDeclaration::semantic(Scope *sc)
|
||||
{ // Should be merged with PragmaStatement
|
||||
|
||||
@@ -892,7 +926,7 @@ void PragmaDeclaration::semantic(Scope *sc)
|
||||
if (e->op == TOKstring)
|
||||
{
|
||||
StringExp *se = (StringExp *)e;
|
||||
fprintf(stdmsg, "%.*s", (int)se->len, (char*)se->string);
|
||||
fprintf(stdmsg, "%.*s", (int)se->len, (char *)se->string);
|
||||
}
|
||||
else
|
||||
error("string expected for message, not '%s'", e->toChars());
|
||||
@@ -981,22 +1015,6 @@ void PragmaDeclaration::semantic(Scope *sc)
|
||||
#if TARGET_NET
|
||||
else if (ident == Lexer::idPool("assembly"))
|
||||
{
|
||||
if (!args || args->dim != 1)
|
||||
error("pragma has invalid number of arguments");
|
||||
else
|
||||
{
|
||||
Expression *e = (Expression *)args->data[0];
|
||||
e = e->semantic(sc);
|
||||
e = e->optimize(WANTvalue | WANTinterpret);
|
||||
args->data[0] = (void *)e;
|
||||
if (e->op != TOKstring)
|
||||
{
|
||||
error("string expected, not '%s'", e->toChars());
|
||||
}
|
||||
PragmaScope* pragma = new PragmaScope(this, sc->parent, static_cast<StringExp*>(e));
|
||||
decl = new Array;
|
||||
decl->push(pragma);
|
||||
}
|
||||
}
|
||||
#endif // TARGET_NET
|
||||
// LDC
|
||||
|
||||
@@ -36,6 +36,9 @@ struct AttribDeclaration : Dsymbol
|
||||
AttribDeclaration(Array *decl);
|
||||
virtual Array *include(Scope *sc, ScopeDsymbol *s);
|
||||
int addMember(Scope *sc, ScopeDsymbol *s, int memnum);
|
||||
void setScopeNewSc(Scope *sc,
|
||||
unsigned newstc, enum LINK linkage, enum PROT protection, int explictProtection,
|
||||
unsigned structalign);
|
||||
void semanticNewSc(Scope *sc,
|
||||
unsigned newstc, enum LINK linkage, enum PROT protection, int explictProtection,
|
||||
unsigned structalign);
|
||||
@@ -69,6 +72,7 @@ struct StorageClassDeclaration: AttribDeclaration
|
||||
|
||||
StorageClassDeclaration(unsigned stc, Array *decl);
|
||||
Dsymbol *syntaxCopy(Dsymbol *s);
|
||||
void setScope(Scope *sc);
|
||||
void semantic(Scope *sc);
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
|
||||
@@ -81,6 +85,7 @@ struct LinkDeclaration : AttribDeclaration
|
||||
|
||||
LinkDeclaration(enum LINK p, Array *decl);
|
||||
Dsymbol *syntaxCopy(Dsymbol *s);
|
||||
void setScope(Scope *sc);
|
||||
void semantic(Scope *sc);
|
||||
void semantic3(Scope *sc);
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
@@ -93,6 +98,7 @@ struct ProtDeclaration : AttribDeclaration
|
||||
|
||||
ProtDeclaration(enum PROT p, Array *decl);
|
||||
Dsymbol *syntaxCopy(Dsymbol *s);
|
||||
void setScope(Scope *sc);
|
||||
void semantic(Scope *sc);
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
|
||||
@@ -105,6 +111,7 @@ struct AlignDeclaration : AttribDeclaration
|
||||
|
||||
AlignDeclaration(Loc loc, unsigned sa, Array *decl);
|
||||
Dsymbol *syntaxCopy(Dsymbol *s);
|
||||
void setScope(Scope *sc);
|
||||
void semantic(Scope *sc);
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
};
|
||||
@@ -128,6 +135,7 @@ struct PragmaDeclaration : AttribDeclaration
|
||||
PragmaDeclaration(Loc loc, Identifier *ident, Expressions *args, Array *decl);
|
||||
Dsymbol *syntaxCopy(Dsymbol *s);
|
||||
void semantic(Scope *sc);
|
||||
void setScope(Scope *sc);
|
||||
int oneMember(Dsymbol **ps);
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
const char *kind();
|
||||
|
||||
16
dmd2/cast.c
16
dmd2/cast.c
@@ -1796,8 +1796,17 @@ Expression *BinExp::typeCombine(Scope *sc)
|
||||
|
||||
if (op == TOKmin || op == TOKadd)
|
||||
{
|
||||
if (t1 == t2 && (t1->ty == Tstruct || t1->ty == Tclass))
|
||||
goto Lerror;
|
||||
if (t1->ty == Tstruct)
|
||||
{
|
||||
if (t2->ty == Tstruct &&
|
||||
((TypeStruct *)t1)->sym == ((TypeStruct *)t2)->sym)
|
||||
goto Lerror;
|
||||
}
|
||||
else if (t1->ty == Tclass)
|
||||
{
|
||||
if (t2->ty == Tclass)
|
||||
goto Lerror;
|
||||
}
|
||||
}
|
||||
|
||||
if (!typeMerge(sc, this, &type, &e1, &e2))
|
||||
@@ -1941,6 +1950,9 @@ IntRange DivExp::getIntRange()
|
||||
IntRange ir1 = e1->getIntRange();
|
||||
IntRange ir2 = e2->getIntRange();
|
||||
|
||||
if (ir2.imax == 0 || ir2.imin == 0)
|
||||
return Expression::getIntRange();
|
||||
|
||||
ir.imin = ir1.imin / ir2.imax;
|
||||
ir.imax = ir1.imax / ir2.imin;
|
||||
|
||||
|
||||
21
dmd2/class.c
21
dmd2/class.c
@@ -349,6 +349,8 @@ void ClassDeclaration::semantic(Scope *sc)
|
||||
//printf("\ttry later, forward reference of base class %s\n", tc->sym->toChars());
|
||||
scope = scx ? scx : new Scope(*sc);
|
||||
scope->setNoFree();
|
||||
if (tc->sym->scope)
|
||||
tc->sym->scope->module->addDeferredSemantic(tc->sym);
|
||||
scope->module->addDeferredSemantic(this);
|
||||
return;
|
||||
}
|
||||
@@ -402,6 +404,12 @@ void ClassDeclaration::semantic(Scope *sc)
|
||||
error("inherits from duplicate interface %s", b2->base->toChars());
|
||||
}
|
||||
|
||||
if (!tc->sym->symtab)
|
||||
{ // Try to resolve forward reference
|
||||
if (sc->mustsemantic && tc->sym->scope)
|
||||
tc->sym->semantic(NULL);
|
||||
}
|
||||
|
||||
b->base = tc->sym;
|
||||
if (!b->base->symtab || b->base->scope)
|
||||
{
|
||||
@@ -410,6 +418,8 @@ void ClassDeclaration::semantic(Scope *sc)
|
||||
//printf("\ttry later, forward reference of base %s\n", baseClass->toChars());
|
||||
scope = scx ? scx : new Scope(*sc);
|
||||
scope->setNoFree();
|
||||
if (tc->sym->scope)
|
||||
tc->sym->scope->module->addDeferredSemantic(tc->sym);
|
||||
scope->module->addDeferredSemantic(this);
|
||||
return;
|
||||
}
|
||||
@@ -798,8 +808,8 @@ int ClassDeclaration::isBaseOf(ClassDeclaration *cd, int *poffset)
|
||||
Dsymbol *ClassDeclaration::search(Loc loc, Identifier *ident, int flags)
|
||||
{
|
||||
Dsymbol *s;
|
||||
|
||||
//printf("%s.ClassDeclaration::search('%s')\n", toChars(), ident->toChars());
|
||||
|
||||
if (scope)
|
||||
{ Scope *sc = scope;
|
||||
sc->mustsemantic++;
|
||||
@@ -962,10 +972,12 @@ int ClassDeclaration::isCOMinterface()
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if DMDV2
|
||||
int ClassDeclaration::isCPPinterface()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/****************************************
|
||||
@@ -1142,6 +1154,11 @@ void InterfaceDeclaration::semantic(Scope *sc)
|
||||
baseclasses.remove(i);
|
||||
continue;
|
||||
}
|
||||
if (!b->base->symtab)
|
||||
{ // Try to resolve forward reference
|
||||
if (sc->mustsemantic && b->base->scope)
|
||||
b->base->semantic(NULL);
|
||||
}
|
||||
if (!b->base->symtab || b->base->scope || b->base->inuse)
|
||||
{
|
||||
//error("forward reference of base class %s", baseClass->toChars());
|
||||
@@ -1326,10 +1343,12 @@ int InterfaceDeclaration::isCOMinterface()
|
||||
return com;
|
||||
}
|
||||
|
||||
#if DMDV2
|
||||
int InterfaceDeclaration::isCPPinterface()
|
||||
{
|
||||
return cpp;
|
||||
}
|
||||
#endif
|
||||
|
||||
/*******************************************
|
||||
*/
|
||||
|
||||
@@ -65,6 +65,11 @@ int ComplexExp::isConst()
|
||||
return 1;
|
||||
}
|
||||
|
||||
int NullExp::isConst()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int SymOffExp::isConst()
|
||||
{
|
||||
return 2;
|
||||
@@ -1084,6 +1089,8 @@ Expression *Cast(Type *type, Type *to, Expression *e1)
|
||||
Type *tb = to->toBasetype();
|
||||
Type *typeb = type->toBasetype();
|
||||
|
||||
/* Allow casting from one string type to another
|
||||
*/
|
||||
if (e1->op == TOKstring)
|
||||
{
|
||||
if (tb->ty == Tarray && typeb->ty == Tarray &&
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// Compiler implementation of the D programming language
|
||||
// Copyright (c) 1999-2007 by Digital Mars
|
||||
// Copyright (c) 1999-2009 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -25,7 +25,7 @@
|
||||
#include "import.h"
|
||||
#include "aggregate.h"
|
||||
|
||||
#if DMDV2
|
||||
#if CPP_MANGLE
|
||||
|
||||
/* Do mangling for C++ linkage.
|
||||
* Follows Itanium C++ ABI 1.86
|
||||
|
||||
@@ -141,7 +141,7 @@ void Declaration::checkModify(Loc loc, Scope *sc, Type *t)
|
||||
if (isConst())
|
||||
p = "const";
|
||||
else if (isInvariant())
|
||||
p = "mutable";
|
||||
p = "immutable";
|
||||
else if (storage_class & STCmanifest)
|
||||
p = "enum";
|
||||
else if (!t->isAssignable())
|
||||
@@ -639,6 +639,7 @@ VarDeclaration::VarDeclaration(Loc loc, Type *type, Identifier *id, Initializer
|
||||
onstack = 0;
|
||||
canassign = 0;
|
||||
value = NULL;
|
||||
rundtor = NULL;
|
||||
#if IN_LLVM
|
||||
aggrIndex = 0;
|
||||
|
||||
@@ -956,9 +957,7 @@ Lagain:
|
||||
Expression *e1;
|
||||
e1 = new VarExp(loc, this);
|
||||
e = new AssignExp(loc, e1, e);
|
||||
#if DMDV2
|
||||
e->op = TOKconstruct;
|
||||
#endif
|
||||
e->type = e1->type; // don't type check this, it would fail
|
||||
init = new ExpInitializer(loc, e);
|
||||
return;
|
||||
@@ -979,10 +978,8 @@ Lagain:
|
||||
{
|
||||
init = getExpInitializer();
|
||||
}
|
||||
#if DMDV2
|
||||
// Default initializer is always a blit
|
||||
op = TOKblit;
|
||||
#endif
|
||||
}
|
||||
|
||||
if (init)
|
||||
@@ -1039,7 +1036,7 @@ Lagain:
|
||||
Expression *e1 = new VarExp(loc, this);
|
||||
|
||||
Type *t = type->toBasetype();
|
||||
if (t->ty == Tsarray)
|
||||
if (t->ty == Tsarray && !(storage_class & (STCref | STCout)))
|
||||
{
|
||||
ei->exp = ei->exp->semantic(sc);
|
||||
if (!ei->exp->implicitConvTo(type))
|
||||
@@ -1167,7 +1164,7 @@ Lagain:
|
||||
e = e->optimize(WANTvalue | WANTinterpret);
|
||||
else
|
||||
e = e->optimize(WANTvalue);
|
||||
if (e->op == TOKint64 || e->op == TOKstring)
|
||||
if (e->op == TOKint64 || e->op == TOKstring || e->op == TOKfloat64)
|
||||
{
|
||||
ei->exp = e; // no errors, keep result
|
||||
}
|
||||
|
||||
@@ -261,7 +261,11 @@ struct VarDeclaration : Declaration
|
||||
Initializer *init;
|
||||
unsigned offset;
|
||||
int noauto; // no auto semantics
|
||||
#if DMDV2
|
||||
FuncDeclarations nestedrefs; // referenced by these lexically nested functions
|
||||
#else
|
||||
int nestedref; // referenced by a lexically nested function
|
||||
#endif
|
||||
int ctorinit; // it has been initialized in a ctor
|
||||
int onstack; // 1: it has been allocated on the stack
|
||||
// 2: on stack, run destructor anyway
|
||||
@@ -269,6 +273,11 @@ struct VarDeclaration : Declaration
|
||||
Dsymbol *aliassym; // if redone as alias to another symbol
|
||||
Expression *value; // when interpreting, this is the value
|
||||
// (NULL if value not determinable)
|
||||
#if DMDV2
|
||||
VarDeclaration *rundtor; // if !NULL, rundtor is tested at runtime to see
|
||||
// if the destructor should be run. Used to prevent
|
||||
// dtor calls on postblitted vars
|
||||
#endif
|
||||
|
||||
VarDeclaration(Loc loc, Type *t, Identifier *id, Initializer *init);
|
||||
Dsymbol *syntaxCopy(Dsymbol *);
|
||||
@@ -285,8 +294,10 @@ struct VarDeclaration : Declaration
|
||||
int isDataseg();
|
||||
int isThreadlocal();
|
||||
int hasPointers();
|
||||
#if DMDV2
|
||||
int canTakeAddressOf();
|
||||
int needsAutoDtor();
|
||||
#endif
|
||||
Expression *callAutoDtor(Scope *sc);
|
||||
ExpInitializer *getExpInitializer();
|
||||
Expression *getConstInitializer();
|
||||
@@ -625,6 +636,8 @@ enum BUILTIN
|
||||
|
||||
Expression *eval_builtin(enum BUILTIN builtin, Expressions *arguments);
|
||||
|
||||
#else
|
||||
enum BUILTIN { };
|
||||
#endif
|
||||
|
||||
struct FuncDeclaration : Declaration
|
||||
@@ -718,6 +731,7 @@ struct FuncDeclaration : Declaration
|
||||
void appendExp(Expression *e);
|
||||
void appendState(Statement *s);
|
||||
char *mangle();
|
||||
const char *toPrettyChars();
|
||||
int isMain();
|
||||
int isWinMain();
|
||||
int isDllMain();
|
||||
@@ -734,7 +748,7 @@ struct FuncDeclaration : Declaration
|
||||
virtual int isFinal();
|
||||
virtual int addPreInvariant();
|
||||
virtual int addPostInvariant();
|
||||
Expression *interpret(InterState *istate, Expressions *arguments);
|
||||
Expression *interpret(InterState *istate, Expressions *arguments, Expression *thisexp = NULL);
|
||||
void inlineScan();
|
||||
int canInline(int hasthis, int hdrscan = 0);
|
||||
Expression *doInline(InlineScanState *iss, Expression *ethis, Array *arguments);
|
||||
@@ -788,12 +802,13 @@ struct FuncDeclaration : Declaration
|
||||
#endif
|
||||
};
|
||||
|
||||
#if DMDV2
|
||||
FuncDeclaration *resolveFuncCall(Scope *sc, Loc loc, Dsymbol *s,
|
||||
Objects *tiargs,
|
||||
Expression *ethis,
|
||||
Expressions *arguments,
|
||||
int flags);
|
||||
|
||||
#endif
|
||||
|
||||
struct FuncAliasDeclaration : FuncDeclaration
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// Compiler implementation of the D programming language
|
||||
// Copyright (c) 1999-2008 by Digital Mars
|
||||
// Copyright (c) 1999-2009 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -238,7 +238,7 @@ void Module::gendocfile()
|
||||
// Generate predefined macros
|
||||
|
||||
// Set the title to be the name of the module
|
||||
{ char *p = toPrettyChars();
|
||||
{ const char *p = toPrettyChars();
|
||||
Macro::define(¯otable, (unsigned char *)"TITLE", 5, (unsigned char *)p, strlen(p));
|
||||
}
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ char *Dsymbol::toChars()
|
||||
return ident ? ident->toChars() : (char *)"__anonymous";
|
||||
}
|
||||
|
||||
char *Dsymbol::toPrettyChars()
|
||||
const char *Dsymbol::toPrettyChars()
|
||||
{ Dsymbol *p;
|
||||
char *s;
|
||||
char *q;
|
||||
@@ -452,10 +452,12 @@ int Dsymbol::isDeprecated()
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
#if DMDV2
|
||||
int Dsymbol::isOverloadable()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
LabelDsymbol *Dsymbol::isLabel() // is this a LabelDsymbol()?
|
||||
{
|
||||
@@ -695,6 +697,7 @@ void Dsymbol::addComment(unsigned char *comment)
|
||||
|
||||
/********************************* OverloadSet ****************************/
|
||||
|
||||
#if DMDV2
|
||||
OverloadSet::OverloadSet()
|
||||
: Dsymbol()
|
||||
{
|
||||
@@ -709,6 +712,7 @@ const char *OverloadSet::kind()
|
||||
{
|
||||
return "overloadset";
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/********************************* ScopeDsymbol ****************************/
|
||||
|
||||
@@ -62,6 +62,7 @@ struct Type;
|
||||
struct TypeTuple;
|
||||
struct WithStatement;
|
||||
struct LabelDsymbol;
|
||||
struct ScopeDsymbol;
|
||||
struct TemplateDeclaration;
|
||||
struct TemplateInstance;
|
||||
struct TemplateMixin;
|
||||
@@ -130,7 +131,6 @@ struct Dsymbol : Object
|
||||
Dsymbol();
|
||||
Dsymbol(Identifier *);
|
||||
char *toChars();
|
||||
char *toPrettyChars();
|
||||
char *locToChars();
|
||||
int equals(Object *o);
|
||||
int isAnonymous();
|
||||
@@ -148,6 +148,7 @@ struct Dsymbol : Object
|
||||
|
||||
static Array *arraySyntaxCopy(Array *a);
|
||||
|
||||
virtual const char *toPrettyChars();
|
||||
virtual const char *kind();
|
||||
virtual Dsymbol *toAlias(); // resolve real symbol
|
||||
virtual int addMember(Scope *sc, ScopeDsymbol *s, int memnum);
|
||||
@@ -173,7 +174,9 @@ struct Dsymbol : Object
|
||||
virtual int isExport(); // is Dsymbol exported?
|
||||
virtual int isImportedSymbol(); // is Dsymbol imported?
|
||||
virtual int isDeprecated(); // is Dsymbol deprecated?
|
||||
#if DMDV2
|
||||
virtual int isOverloadable();
|
||||
#endif
|
||||
virtual LabelDsymbol *isLabel(); // is this a LabelDsymbol?
|
||||
virtual AggregateDeclaration *isMember(); // is this symbol a member of an AggregateDeclaration?
|
||||
virtual Type *getType(); // is this a type?
|
||||
@@ -322,6 +325,7 @@ struct ArrayScopeSymbol : ScopeDsymbol
|
||||
|
||||
// Overload Sets
|
||||
|
||||
#if DMDV2
|
||||
struct OverloadSet : Dsymbol
|
||||
{
|
||||
Dsymbols a; // array of Dsymbols
|
||||
@@ -331,6 +335,7 @@ struct OverloadSet : Dsymbol
|
||||
OverloadSet *isOverloadSet() { return this; }
|
||||
const char *kind();
|
||||
};
|
||||
#endif
|
||||
|
||||
// Table of Dsymbol's
|
||||
|
||||
|
||||
@@ -3235,7 +3235,7 @@ Expression *StructLiteralExp::semantic(Scope *sc)
|
||||
e = resolveProperties(sc, e);
|
||||
if (i >= nfields)
|
||||
{ error("more initializers than fields of %s", sd->toChars());
|
||||
break;
|
||||
return new ErrorExp();
|
||||
}
|
||||
Dsymbol *s = (Dsymbol *)sd->fields.data[i];
|
||||
VarDeclaration *v = s->isVarDeclaration();
|
||||
@@ -4429,7 +4429,9 @@ Expression *FuncExp::semantic(Scope *sc)
|
||||
else
|
||||
{
|
||||
fd->semantic2(sc);
|
||||
if (!global.errors)
|
||||
if (!global.errors ||
|
||||
// need to infer return type
|
||||
(fd->type && fd->type->ty == Tfunction && !fd->type->nextOf()))
|
||||
{
|
||||
fd->semantic3(sc);
|
||||
|
||||
@@ -4438,6 +4440,10 @@ Expression *FuncExp::semantic(Scope *sc)
|
||||
}
|
||||
}
|
||||
|
||||
// need to infer return type
|
||||
if (global.errors && fd->type && fd->type->ty == Tfunction && !fd->type->nextOf())
|
||||
((TypeFunction *)fd->type)->next = Type::terror;
|
||||
|
||||
// Type is a "delegate to" or "pointer to" the function literal
|
||||
if (fd->isNested())
|
||||
{
|
||||
@@ -4788,6 +4794,12 @@ Expression *IsExp::semantic(Scope *sc)
|
||||
goto Lno;
|
||||
tded = targ;
|
||||
break;
|
||||
|
||||
case TOKshared:
|
||||
if (!targ->isShared())
|
||||
goto Lno;
|
||||
tded = targ;
|
||||
break;
|
||||
#endif
|
||||
|
||||
case TOKsuper:
|
||||
@@ -5293,7 +5305,7 @@ Expression *FileExp::semantic(Scope *sc)
|
||||
}
|
||||
|
||||
if (global.params.verbose)
|
||||
printf("file %s\t(%s)\n", (char*)se->string, name);
|
||||
printf("file %s\t(%s)\n", (char *)se->string, name);
|
||||
|
||||
{ File f(name);
|
||||
if (f.read())
|
||||
@@ -6219,7 +6231,7 @@ Expression *CallExp::semantic(Scope *sc)
|
||||
}
|
||||
}
|
||||
|
||||
#if DMDV2
|
||||
#if 1
|
||||
/* This recognizes:
|
||||
* foo!(tiargs)(funcargs)
|
||||
*/
|
||||
@@ -6346,7 +6358,7 @@ Lagain:
|
||||
if (t1->ty == Tstruct)
|
||||
{
|
||||
ad = ((TypeStruct *)t1)->sym;
|
||||
|
||||
#if DMDV2
|
||||
// First look for constructor
|
||||
if (ad->ctor && arguments && arguments->dim)
|
||||
{
|
||||
@@ -6374,7 +6386,7 @@ Lagain:
|
||||
e = e->semantic(sc);
|
||||
return e;
|
||||
}
|
||||
|
||||
#endif
|
||||
// No constructor, look for overload of opCall
|
||||
if (search_function(ad, Id::call))
|
||||
goto L1; // overload of opCall, therefore it's a call
|
||||
@@ -6449,7 +6461,7 @@ Lagain:
|
||||
f->addPostInvariant()
|
||||
)
|
||||
{
|
||||
error("cannot call public/export function %s from immutable", f->toChars());
|
||||
error("cannot call public/export function %s from invariant", f->toChars());
|
||||
}
|
||||
|
||||
checkDeprecated(sc, f);
|
||||
@@ -6484,19 +6496,27 @@ Lagain:
|
||||
Type *tthis = ue->e1->type->toBasetype();
|
||||
if (tthis->ty == Tpointer)
|
||||
tthis = tthis->nextOf()->toBasetype();
|
||||
#if 0 // this checking should have been already done
|
||||
if (f->type->isInvariant())
|
||||
{
|
||||
if (tthis->mod != MODinvariant)
|
||||
error("%s can only be called on an invariant object", e1->toChars());
|
||||
error("%s can only be called with an immutable object", e1->toChars());
|
||||
}
|
||||
else if (f->type->isShared())
|
||||
{
|
||||
if (tthis->mod != MODinvariant &&
|
||||
tthis->mod != MODshared &&
|
||||
tthis->mod != (MODshared | MODconst))
|
||||
error("shared %s can only be called with a shared or immutable object", e1->toChars());
|
||||
}
|
||||
else
|
||||
{
|
||||
if (tthis->mod != 0)
|
||||
{ //printf("mod = %x\n", tthis->mod);
|
||||
error("%s can only be called on a mutable object, not %s", e1->toChars(), tthis->toChars());
|
||||
error("%s can only be called with a mutable object, not %s", e1->toChars(), tthis->toChars());
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
/* Cannot call mutable method on a final struct
|
||||
*/
|
||||
if (tthis->ty == Tstruct &&
|
||||
@@ -7586,27 +7606,30 @@ Expression *SliceExp::semantic(Scope *sc)
|
||||
else
|
||||
goto Lerror;
|
||||
|
||||
{
|
||||
Scope *sc2 = sc;
|
||||
if (t->ty == Tsarray || t->ty == Tarray || t->ty == Ttuple)
|
||||
{
|
||||
sym = new ArrayScopeSymbol(sc, this);
|
||||
sym->loc = loc;
|
||||
sym->parent = sc->scopesym;
|
||||
sc = sc->push(sym);
|
||||
sc2 = sc->push(sym);
|
||||
}
|
||||
|
||||
if (lwr)
|
||||
{ lwr = lwr->semantic(sc);
|
||||
lwr = resolveProperties(sc, lwr);
|
||||
lwr = lwr->implicitCastTo(sc, Type::tsize_t);
|
||||
{ lwr = lwr->semantic(sc2);
|
||||
lwr = resolveProperties(sc2, lwr);
|
||||
lwr = lwr->implicitCastTo(sc2, Type::tsize_t);
|
||||
}
|
||||
if (upr)
|
||||
{ upr = upr->semantic(sc);
|
||||
upr = resolveProperties(sc, upr);
|
||||
upr = upr->implicitCastTo(sc, Type::tsize_t);
|
||||
{ upr = upr->semantic(sc2);
|
||||
upr = resolveProperties(sc2, upr);
|
||||
upr = upr->implicitCastTo(sc2, Type::tsize_t);
|
||||
}
|
||||
|
||||
if (t->ty == Tsarray || t->ty == Tarray || t->ty == Ttuple)
|
||||
sc->pop();
|
||||
if (sc2 != sc)
|
||||
sc2->pop();
|
||||
}
|
||||
|
||||
if (t->ty == Ttuple)
|
||||
{
|
||||
@@ -8292,6 +8315,15 @@ Expression *AssignExp::semantic(Scope *sc)
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if this is an initialization of a reference
|
||||
int refinit = 0;
|
||||
if (op == TOKconstruct && e1->op == TOKvar)
|
||||
{ VarExp *ve = (VarExp *)e1;
|
||||
VarDeclaration *v = ve->var->isVarDeclaration();
|
||||
if (v->storage_class & (STCout | STCref))
|
||||
refinit = 1;
|
||||
}
|
||||
|
||||
Type *t1 = e1->type->toBasetype();
|
||||
|
||||
if (t1->ty == Tfunction)
|
||||
@@ -8313,22 +8345,14 @@ Expression *AssignExp::semantic(Scope *sc)
|
||||
if (e)
|
||||
return e;
|
||||
}
|
||||
else if (op == TOKconstruct)
|
||||
else if (op == TOKconstruct && !refinit)
|
||||
{ Type *t2 = e2->type->toBasetype();
|
||||
if (t2->ty == Tstruct &&
|
||||
sd == ((TypeStruct *)t2)->sym &&
|
||||
sd->cpctor)
|
||||
{ /* We have a copy constructor for this
|
||||
*/
|
||||
if (e2->op == TOKvar || e2->op == TOKstar)
|
||||
{ /* Write as:
|
||||
* e1.cpctor(e2);
|
||||
*/
|
||||
Expression *e = new DotVarExp(loc, e1, sd->cpctor, 0);
|
||||
e = new CallExp(loc, e, e2);
|
||||
return e->semantic(sc);
|
||||
}
|
||||
else if (e2->op == TOKquestion)
|
||||
if (e2->op == TOKquestion)
|
||||
{ /* Write as:
|
||||
* a ? e1 = b : e1 = c;
|
||||
*/
|
||||
@@ -8340,6 +8364,17 @@ Expression *AssignExp::semantic(Scope *sc)
|
||||
Expression *e = new CondExp(loc, ec->econd, ea1, ea2);
|
||||
return e->semantic(sc);
|
||||
}
|
||||
else if (e2->op == TOKvar ||
|
||||
e2->op == TOKdotvar ||
|
||||
e2->op == TOKstar ||
|
||||
e2->op == TOKindex)
|
||||
{ /* Write as:
|
||||
* e1.cpctor(e2);
|
||||
*/
|
||||
Expression *e = new DotVarExp(loc, e1, sd->cpctor, 0);
|
||||
e = new CallExp(loc, e, e2);
|
||||
return e->semantic(sc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8353,7 +8388,7 @@ Expression *AssignExp::semantic(Scope *sc)
|
||||
}
|
||||
}
|
||||
|
||||
if (t1->ty == Tsarray)
|
||||
if (t1->ty == Tsarray && !refinit)
|
||||
{ // Convert e1 to e1[]
|
||||
Expression *e = new SliceExp(e1->loc, e1, NULL, NULL);
|
||||
e1 = e->semantic(sc);
|
||||
@@ -8398,7 +8433,7 @@ Expression *AssignExp::semantic(Scope *sc)
|
||||
{
|
||||
/* Should have already converted e1 => e1[]
|
||||
*/
|
||||
assert(0);
|
||||
assert(op == TOKconstruct);
|
||||
//error("cannot assign to static array %s", e1->toChars());
|
||||
}
|
||||
else if (e1->op == TOKslice)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
// Compiler implementation of the D programming language
|
||||
// Copyright (c) 1999-2008 by Digital Mars
|
||||
// Copyright (c) 1999-2009 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -323,6 +323,7 @@ struct ThisExp : Expression
|
||||
|
||||
ThisExp(Loc loc);
|
||||
Expression *semantic(Scope *sc);
|
||||
Expression *interpret(InterState *istate);
|
||||
int isBool(int result);
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
int isLvalue();
|
||||
@@ -361,6 +362,7 @@ struct NullExp : Expression
|
||||
NullExp(Loc loc);
|
||||
Expression *semantic(Scope *sc);
|
||||
int isBool(int result);
|
||||
int isConst();
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
void toMangleBuffer(OutBuffer *buf);
|
||||
MATCH implicitConvTo(Type *t);
|
||||
@@ -620,6 +622,7 @@ struct NewExp : Expression
|
||||
Type *newtype, Expressions *arguments);
|
||||
Expression *syntaxCopy();
|
||||
Expression *semantic(Scope *sc);
|
||||
Expression *optimize(int result);
|
||||
#if IN_DMD
|
||||
elem *toElem(IRState *irs);
|
||||
#endif
|
||||
@@ -1245,6 +1248,8 @@ struct CastExp : UnaExp
|
||||
int checkSideEffect(int flag);
|
||||
void checkEscape();
|
||||
void toCBuffer(OutBuffer *buf, HdrGenState *hgs);
|
||||
void buildArrayIdent(OutBuffer *buf, Expressions *arguments);
|
||||
Expression *buildArrayLoop(Arguments *fparams);
|
||||
#if IN_DMD
|
||||
elem *toElem(IRState *irs);
|
||||
#endif
|
||||
|
||||
75
dmd2/func.c
75
dmd2/func.c
@@ -180,7 +180,7 @@ void FuncDeclaration::semantic(Scope *sc)
|
||||
stc |= STCimmutable;
|
||||
if (type->isConst())
|
||||
stc |= STCconst;
|
||||
if (type->isShared())
|
||||
if (type->isShared() || storage_class & STCsynchronized)
|
||||
stc |= STCshared;
|
||||
switch (stc & STC_TYPECTOR)
|
||||
{
|
||||
@@ -1199,12 +1199,13 @@ void FuncDeclaration::semantic3(Scope *sc)
|
||||
error("expected to return a value of type %s", type->nextOf()->toChars());
|
||||
else if (!inlineAsm)
|
||||
{
|
||||
#if DMDV2
|
||||
int blockexit = fbody ? fbody->blockExit() : BEfallthru;
|
||||
if (f->isnothrow && blockexit & BEthrow)
|
||||
error("'%s' is nothrow yet may throw", toChars());
|
||||
|
||||
int offend = blockexit & BEfallthru;
|
||||
|
||||
#endif
|
||||
if (type->nextOf()->ty == Tvoid)
|
||||
{
|
||||
if (offend && isMain())
|
||||
@@ -1217,10 +1218,11 @@ void FuncDeclaration::semantic3(Scope *sc)
|
||||
{
|
||||
if (offend)
|
||||
{ Expression *e;
|
||||
|
||||
//warning(loc, "no return exp; or assert(0); at end of function");
|
||||
#if DMDV1
|
||||
warning(loc, "no return exp; or assert(0); at end of function");
|
||||
#else
|
||||
error("no return exp; or assert(0); at end of function");
|
||||
|
||||
#endif
|
||||
if (global.params.useAssert &&
|
||||
!global.params.useInline)
|
||||
{ /* Add an assert(0, msg); where the missing return
|
||||
@@ -1412,7 +1414,7 @@ void FuncDeclaration::semantic3(Scope *sc)
|
||||
|
||||
fbody = new CompoundStatement(0, a);
|
||||
|
||||
#if IN_LLVM
|
||||
#if 0 // This seems to have been added in with dmd 2.032, see below
|
||||
// wrap body of synchronized functions in a synchronized statement
|
||||
if (isSynchronized())
|
||||
{
|
||||
@@ -1450,7 +1452,7 @@ void FuncDeclaration::semantic3(Scope *sc)
|
||||
fbody = new CompoundStatement(0, a);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if DMDV2
|
||||
/* Append destructor calls for parameters as finally blocks.
|
||||
*/
|
||||
if (parameters)
|
||||
@@ -1479,6 +1481,46 @@ void FuncDeclaration::semantic3(Scope *sc)
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 1
|
||||
if (isSynchronized())
|
||||
{ /* Wrap the entire function body in a synchronized statement
|
||||
*/
|
||||
ClassDeclaration *cd = parent->isClassDeclaration();
|
||||
if (cd)
|
||||
{
|
||||
#if TARGET_WINDOS
|
||||
if (/*config.flags2 & CFG2seh &&*/ // always on for WINDOS
|
||||
!isStatic() && !fbody->usesEH())
|
||||
{
|
||||
/* The back end uses the "jmonitor" hack for syncing;
|
||||
* no need to do the sync at this level.
|
||||
*/
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
Expression *vsync;
|
||||
if (isStatic())
|
||||
{ // The monitor is in the ClassInfo
|
||||
vsync = new DotIdExp(loc, new DsymbolExp(loc, cd), Id::classinfo);
|
||||
}
|
||||
else
|
||||
{ // 'this' is the monitor
|
||||
vsync = new VarExp(loc, vthis);
|
||||
}
|
||||
fbody = new PeelStatement(fbody); // don't redo semantic()
|
||||
fbody = new SynchronizedStatement(loc, vsync, fbody);
|
||||
fbody = fbody->semantic(sc2);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
error("synchronized function %s must be a member of a class", toChars());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
sc2->callSuper = 0;
|
||||
@@ -1914,12 +1956,18 @@ if (arguments)
|
||||
{
|
||||
OutBuffer buf;
|
||||
|
||||
buf.writeByte('(');
|
||||
if (arguments)
|
||||
{
|
||||
HdrGenState hgs;
|
||||
|
||||
argExpTypesToCBuffer(&buf, arguments, &hgs);
|
||||
buf.writeByte(')');
|
||||
if (ethis)
|
||||
ethis->type->modToBuffer(&buf);
|
||||
}
|
||||
else
|
||||
buf.writeByte(')');
|
||||
|
||||
if (m.last == MATCHnomatch)
|
||||
{
|
||||
@@ -1928,9 +1976,13 @@ if (arguments)
|
||||
|
||||
tf = (TypeFunction *)type;
|
||||
|
||||
OutBuffer buf2;
|
||||
tf->modToBuffer(&buf2);
|
||||
|
||||
//printf("tf = %s, args = %s\n", tf->deco, ((Expression *)arguments->data[0])->type->deco);
|
||||
error(loc, "%s does not match parameter types (%s)",
|
||||
error(loc, "%s%s is not callable using argument types %s",
|
||||
Argument::argsTypesToChars(tf->parameters, tf->varargs),
|
||||
buf2.toChars(),
|
||||
buf.toChars());
|
||||
return m.anyf; // as long as it's not a FuncAliasDeclaration
|
||||
}
|
||||
@@ -2202,6 +2254,13 @@ void FuncDeclaration::appendState(Statement *s)
|
||||
}
|
||||
}
|
||||
|
||||
const char *FuncDeclaration::toPrettyChars()
|
||||
{
|
||||
if (isMain())
|
||||
return "D main";
|
||||
else
|
||||
return Dsymbol::toPrettyChars();
|
||||
}
|
||||
|
||||
int FuncDeclaration::isMain()
|
||||
{
|
||||
|
||||
10
dmd2/id.c
10
dmd2/id.c
@@ -103,6 +103,7 @@ Identifier *Id::sort;
|
||||
Identifier *Id::reverse;
|
||||
Identifier *Id::dup;
|
||||
Identifier *Id::idup;
|
||||
Identifier *Id::property;
|
||||
Identifier *Id::___out;
|
||||
Identifier *Id::___in;
|
||||
Identifier *Id::__int;
|
||||
@@ -180,6 +181,10 @@ Identifier *Id::aaLen;
|
||||
Identifier *Id::aaKeys;
|
||||
Identifier *Id::aaValues;
|
||||
Identifier *Id::aaRehash;
|
||||
Identifier *Id::monitorenter;
|
||||
Identifier *Id::monitorexit;
|
||||
Identifier *Id::criticalenter;
|
||||
Identifier *Id::criticalexit;
|
||||
Identifier *Id::GNU_asm;
|
||||
Identifier *Id::lib;
|
||||
Identifier *Id::msg;
|
||||
@@ -333,6 +338,7 @@ void Id::initialize()
|
||||
reverse = Lexer::idPool("reverse");
|
||||
dup = Lexer::idPool("dup");
|
||||
idup = Lexer::idPool("idup");
|
||||
property = Lexer::idPool("property");
|
||||
___out = Lexer::idPool("out");
|
||||
___in = Lexer::idPool("in");
|
||||
__int = Lexer::idPool("int");
|
||||
@@ -410,6 +416,10 @@ void Id::initialize()
|
||||
aaKeys = Lexer::idPool("_aaKeys");
|
||||
aaValues = Lexer::idPool("_aaValues");
|
||||
aaRehash = Lexer::idPool("_aaRehash");
|
||||
monitorenter = Lexer::idPool("_d_monitorenter");
|
||||
monitorexit = Lexer::idPool("_d_monitorexit");
|
||||
criticalenter = Lexer::idPool("_d_criticalenter");
|
||||
criticalexit = Lexer::idPool("_d_criticalexit");
|
||||
GNU_asm = Lexer::idPool("GNU_asm");
|
||||
lib = Lexer::idPool("lib");
|
||||
msg = Lexer::idPool("msg");
|
||||
|
||||
@@ -105,6 +105,7 @@ struct Id
|
||||
static Identifier *reverse;
|
||||
static Identifier *dup;
|
||||
static Identifier *idup;
|
||||
static Identifier *property;
|
||||
static Identifier *___out;
|
||||
static Identifier *___in;
|
||||
static Identifier *__int;
|
||||
@@ -182,6 +183,10 @@ struct Id
|
||||
static Identifier *aaKeys;
|
||||
static Identifier *aaValues;
|
||||
static Identifier *aaRehash;
|
||||
static Identifier *monitorenter;
|
||||
static Identifier *monitorexit;
|
||||
static Identifier *criticalenter;
|
||||
static Identifier *criticalexit;
|
||||
static Identifier *GNU_asm;
|
||||
static Identifier *lib;
|
||||
static Identifier *msg;
|
||||
|
||||
@@ -137,6 +137,8 @@ Msgtable msgtable[] =
|
||||
{ "dup" },
|
||||
{ "idup" },
|
||||
|
||||
{ "property" },
|
||||
|
||||
// For inline assembler
|
||||
{ "___out", "out" },
|
||||
{ "___in", "in" },
|
||||
@@ -232,6 +234,10 @@ Msgtable msgtable[] =
|
||||
{ "aaKeys", "_aaKeys" },
|
||||
{ "aaValues", "_aaValues" },
|
||||
{ "aaRehash", "_aaRehash" },
|
||||
{ "monitorenter", "_d_monitorenter" },
|
||||
{ "monitorexit", "_d_monitorexit" },
|
||||
{ "criticalenter", "_d_criticalenter" },
|
||||
{ "criticalexit", "_d_criticalexit" },
|
||||
|
||||
// For pragma's
|
||||
{ "GNU_asm" },
|
||||
|
||||
340
dmd2/impcnvtab.c
340
dmd2/impcnvtab.c
@@ -2,181 +2,185 @@
|
||||
#include "mtype.h"
|
||||
unsigned char Type::impcnvResult[TMAX][TMAX] =
|
||||
{
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,22,23,24,28,29,30,36,19,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,22,23,24,28,29,30,36,20,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,22,23,24,28,29,30,36,21,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,22,23,24,28,29,30,36,22,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,23,23,24,29,29,30,36,23,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,24,24,24,30,30,30,36,24,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,36,22,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,36,23,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,36,24,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,28,28,28,28,28,28,28,28,28,29,30,28,29,30,28,29,30,36,28,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,29,29,29,29,29,29,29,29,29,29,30,29,29,30,29,29,30,36,29,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,30,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,28,29,30,36,32,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,20,20,20,20,20,20,21,22,23,24,25,23,24,25,29,30,31,37,20,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,21,21,21,21,21,21,21,22,23,24,25,23,24,25,29,30,31,37,21,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,22,22,22,22,22,22,22,22,23,24,25,23,24,25,29,30,31,37,22,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,23,23,23,23,23,23,23,23,23,24,25,23,24,25,29,30,31,37,23,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,24,24,24,24,24,24,24,24,24,24,25,24,24,25,30,30,31,37,24,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,25,25,25,25,25,25,25,25,25,25,25,25,25,25,31,31,31,37,25,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,23,23,23,23,23,23,23,23,23,24,25,26,27,28,29,30,31,37,23,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,24,24,24,24,24,24,24,24,24,24,25,27,27,28,30,30,31,37,24,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,25,25,25,25,25,25,25,25,25,25,25,28,28,28,31,31,31,37,25,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,29,29,29,29,29,29,29,29,29,30,31,29,30,31,29,30,31,37,29,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,30,30,30,30,30,30,30,30,30,30,31,30,30,31,30,30,31,37,30,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,37,31,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,29,30,31,37,33,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
};
|
||||
unsigned char Type::impcnvType1[TMAX][TMAX] =
|
||||
{
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,22,23,24,22,23,24,36,19,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,22,23,24,22,23,24,36,20,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,22,23,24,22,23,24,36,21,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,22,23,24,22,23,24,36,22,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,23,23,24,23,23,24,36,23,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,24,36,24,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,25,25,25,25,25,25,25,25,25,26,27,25,26,27,25,26,27,36,25,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,26,26,26,26,26,26,26,26,26,26,27,26,26,27,26,26,27,36,26,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,27,36,27,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,28,28,28,28,28,28,28,28,28,29,30,28,29,30,28,29,30,36,28,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,29,29,29,29,29,29,29,29,29,29,30,29,29,30,29,29,30,36,29,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,36,30,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,22,23,24,22,23,24,36,32,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,23,24,25,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,23,24,25,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,23,24,25,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,23,24,25,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,23,24,25,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,20,20,20,20,20,20,21,22,23,24,25,23,24,25,23,24,25,37,20,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,21,21,21,21,21,21,21,22,23,24,25,23,24,25,23,24,25,37,21,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,22,22,22,22,22,22,22,22,23,24,25,23,24,25,23,24,25,37,22,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,23,23,23,23,23,23,23,23,23,24,25,23,24,25,23,24,25,37,23,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,24,24,24,24,24,24,24,24,24,24,25,24,24,25,24,24,25,37,24,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,25,37,25,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,26,26,26,26,26,26,26,26,26,27,28,26,27,28,26,27,28,37,26,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,27,27,27,27,27,27,27,27,27,27,28,27,27,28,27,27,28,37,27,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,37,28,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,29,29,29,29,29,29,29,29,29,30,31,29,30,31,29,30,31,37,29,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,30,30,30,30,30,30,30,30,30,30,31,30,30,31,30,30,31,37,30,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,31,37,31,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,23,24,25,23,24,25,37,33,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
};
|
||||
unsigned char Type::impcnvType2[TMAX][TMAX] =
|
||||
{
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,36,18,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,19,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,36,19,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,20,20,20,20,20,20,20,21,22,23,24,25,26,27,28,29,30,36,20,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,21,21,21,21,21,21,21,21,22,23,24,25,26,27,28,29,30,36,21,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,36,22,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,36,23,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,36,24,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,36,22,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,36,23,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,36,24,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,22,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,36,22,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,23,23,23,23,23,23,23,23,23,23,24,26,26,27,29,29,30,36,23,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,24,24,24,24,24,24,24,24,24,24,24,27,27,27,30,30,30,36,24,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,18,18,18,18,18,19,20,21,22,23,24,25,26,27,28,29,30,36,32,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,36,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,31,37,19,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,20,20,20,20,20,20,21,22,23,24,25,26,27,28,29,30,31,37,20,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,21,21,21,21,21,21,21,22,23,24,25,26,27,28,29,30,31,37,21,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,22,22,22,22,22,22,22,22,23,24,25,26,27,28,29,30,31,37,22,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,23,23,23,23,23,23,23,23,23,24,25,26,27,28,29,30,31,37,23,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,24,24,24,24,24,24,24,24,24,24,25,27,27,28,30,30,31,37,24,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,25,25,25,25,25,25,25,25,25,25,25,28,28,28,31,31,31,37,25,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,23,23,23,23,23,23,23,23,23,24,25,26,27,28,29,30,31,37,23,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,24,24,24,24,24,24,24,24,24,24,25,27,27,28,30,30,31,37,24,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,25,25,25,25,25,25,25,25,25,25,25,28,28,28,31,31,31,37,25,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,23,23,23,23,23,23,23,23,23,24,25,26,27,28,29,30,31,37,23,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,24,24,24,24,24,24,24,24,24,24,25,27,27,28,30,30,31,37,24,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,25,25,25,25,25,25,25,25,25,25,25,28,28,28,31,31,31,37,25,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,19,19,19,19,19,20,21,22,23,24,25,26,27,28,29,30,31,37,33,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,37,
|
||||
};
|
||||
unsigned char Type::impcnvWarn[TMAX][TMAX] =
|
||||
{
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,0,1,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
|
||||
};
|
||||
|
||||
15
dmd2/init.c
15
dmd2/init.c
@@ -412,15 +412,24 @@ Expression *ArrayInitializer::toExpression()
|
||||
|
||||
case Tpointer:
|
||||
case Tarray:
|
||||
edim = dim;
|
||||
break;
|
||||
edim = dim;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
edim = value.dim;
|
||||
for (size_t i = 0, j = 0; i < value.dim; i++, j++)
|
||||
{
|
||||
if (index.data[i])
|
||||
j = ((Expression *)index.data[i])->toInteger();
|
||||
if (j >= edim)
|
||||
edim = j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
elements = new Expressions();
|
||||
elements->setDim(edim);
|
||||
@@ -464,7 +473,7 @@ Expression *ArrayInitializer::toExpression()
|
||||
Lno:
|
||||
delete elements;
|
||||
error(loc, "array initializers as expressions are not allowed");
|
||||
return NULL;
|
||||
return new ErrorExp();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
// Copyright (c) 1999-2008 by Digital Mars
|
||||
// Copyright (c) 1999-2009 by Digital Mars
|
||||
// All Rights Reserved
|
||||
// written by Walter Bright
|
||||
// http://www.digitalmars.com
|
||||
@@ -870,7 +870,8 @@ Statement *ForStatement::inlineScan(InlineScanState *iss)
|
||||
condition = condition->inlineScan(iss);
|
||||
if (increment)
|
||||
increment = increment->inlineScan(iss);
|
||||
body = body->inlineScan(iss);
|
||||
if (body)
|
||||
body = body->inlineScan(iss);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1072,6 +1073,31 @@ void scanVar(Dsymbol *s, InlineScanState *iss)
|
||||
|
||||
if (ie)
|
||||
{
|
||||
#if DMDV2
|
||||
if (vd->type)
|
||||
{ Type *tb = vd->type->toBasetype();
|
||||
if (tb->ty == Tstruct)
|
||||
{ StructDeclaration *sd = ((TypeStruct *)tb)->sym;
|
||||
if (sd->cpctor)
|
||||
{ /* The problem here is that if the initializer is a
|
||||
* function call that returns a struct S with a cpctor:
|
||||
* S s = foo();
|
||||
* the postblit is done by the return statement in foo()
|
||||
* in s2ir.c, the intermediate code generator.
|
||||
* But, if foo() is inlined and now the code looks like:
|
||||
* S s = x;
|
||||
* the postblit is not there, because such assignments
|
||||
* are rewritten as s.cpctor(&x) by the front end.
|
||||
* So, the inlining won't get the postblit called.
|
||||
* Work around by not inlining these cases.
|
||||
* A proper fix would be to move all the postblit
|
||||
* additions to the front end.
|
||||
*/
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
ie->exp = ie->exp->inlineScan(iss);
|
||||
}
|
||||
}
|
||||
@@ -1499,6 +1525,9 @@ Expression *FuncDeclaration::doInline(InlineScanState *iss, Expression *ethis, A
|
||||
inlineNest++;
|
||||
Expression *eb = fbody->doInline(&ids);
|
||||
inlineNest--;
|
||||
//eb->type->print();
|
||||
//eb->print();
|
||||
//eb->dump(0);
|
||||
return Expression::combine(e, eb);
|
||||
}
|
||||
|
||||
|
||||
707
dmd2/interpret.c
707
dmd2/interpret.c
File diff suppressed because it is too large
Load Diff
@@ -1160,6 +1160,7 @@ void Lexer::scan(Token *t)
|
||||
SINGLE(';', TOKsemicolon)
|
||||
SINGLE(':', TOKcolon)
|
||||
SINGLE('$', TOKdollar)
|
||||
SINGLE('@', TOKat)
|
||||
|
||||
#undef SINGLE
|
||||
|
||||
@@ -3088,6 +3089,7 @@ void Lexer::initKeywords()
|
||||
|
||||
Token::tochars[TOKorass] = "|=";
|
||||
Token::tochars[TOKidentifier] = "identifier";
|
||||
Token::tochars[TOKat] = "@";
|
||||
|
||||
// For debugging
|
||||
Token::tochars[TOKdotexp] = "dotexp";
|
||||
|
||||
@@ -31,7 +31,7 @@ struct Module;
|
||||
+ - += -=
|
||||
* / % *= /= %=
|
||||
& | ^ &= |= ^=
|
||||
= ! ~
|
||||
= ! ~ @
|
||||
++ --
|
||||
. -> : ,
|
||||
? && ||
|
||||
@@ -159,7 +159,8 @@ enum TOK
|
||||
TOKgshared,
|
||||
TOKline,
|
||||
TOKfile,
|
||||
TOKshared,
|
||||
TOKshared,
|
||||
TOKat,
|
||||
#endif
|
||||
|
||||
// LDC specific
|
||||
|
||||
@@ -122,7 +122,7 @@ char *Declaration::mangle()
|
||||
return ident->toChars();
|
||||
|
||||
case LINKcpp:
|
||||
#if DMDV2 && (TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS)
|
||||
#if CPP_MANGLE
|
||||
return cpp_mangle(this);
|
||||
#else
|
||||
// Windows C++ mangling is done by C++ back end
|
||||
|
||||
@@ -98,7 +98,7 @@ Global::Global()
|
||||
"\nMSIL back-end (alpha release) by Cristian L. Vlasceanu and associates.";
|
||||
#endif
|
||||
;
|
||||
version = "v2.031";
|
||||
version = "v2.032";
|
||||
#if IN_LLVM
|
||||
ldc_version = LDC_REV;
|
||||
llvm_version = LLVM_REV_STR;
|
||||
|
||||
@@ -95,6 +95,9 @@ the target object file format:
|
||||
#define STRUCTTHISREF DMDV2 // if 'this' for struct is a reference, not a pointer
|
||||
#define SNAN_DEFAULT_INIT DMDV2 // if floats are default initialized to signalling NaN
|
||||
|
||||
// Set if C++ mangling is done by the front end
|
||||
#define CPP_MANGLE (DMDV2 && (TARGET_LINUX || TARGET_OSX || TARGET_FREEBSD || TARGET_SOLARIS))
|
||||
|
||||
/* Other targets are TARGET_LINUX, TARGET_OSX, TARGET_FREEBSD and
|
||||
* TARGET_SOLARIS, which are
|
||||
* set on the command line via the compiler makefile.
|
||||
|
||||
120
dmd2/mtype.c
120
dmd2/mtype.c
@@ -198,6 +198,7 @@ void Type::init()
|
||||
sizeTy[i] = sizeof(TypeBasic);
|
||||
sizeTy[Tsarray] = sizeof(TypeSArray);
|
||||
sizeTy[Tarray] = sizeof(TypeDArray);
|
||||
//sizeTy[Tnarray] = sizeof(TypeNArray);
|
||||
sizeTy[Taarray] = sizeof(TypeAArray);
|
||||
sizeTy[Tpointer] = sizeof(TypePointer);
|
||||
sizeTy[Treference] = sizeof(TypeReference);
|
||||
@@ -216,6 +217,7 @@ void Type::init()
|
||||
|
||||
mangleChar[Tarray] = 'A';
|
||||
mangleChar[Tsarray] = 'G';
|
||||
mangleChar[Tnarray] = '@';
|
||||
mangleChar[Taarray] = 'H';
|
||||
mangleChar[Tpointer] = 'P';
|
||||
mangleChar[Treference] = 'R';
|
||||
@@ -1151,6 +1153,16 @@ void Type::toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod)
|
||||
}
|
||||
}
|
||||
|
||||
void Type::modToBuffer(OutBuffer *buf)
|
||||
{
|
||||
if (mod & MODshared)
|
||||
buf->writestring(" shared");
|
||||
if (mod & MODconst)
|
||||
buf->writestring(" const");
|
||||
if (mod & MODinvariant)
|
||||
buf->writestring(" immutable");
|
||||
}
|
||||
|
||||
/************************************
|
||||
*/
|
||||
|
||||
@@ -1651,6 +1663,12 @@ Type *TypeNext::reliesOnTident()
|
||||
return next->reliesOnTident();
|
||||
}
|
||||
|
||||
/*******************************
|
||||
* For TypeFunction, nextOf() can return NULL if the function return
|
||||
* type is meant to be inferred, and semantic() hasn't yet ben run
|
||||
* on the function. After semantic(), it must no longer be NULL.
|
||||
*/
|
||||
|
||||
Type *TypeNext::nextOf()
|
||||
{
|
||||
return next;
|
||||
@@ -3251,6 +3269,88 @@ int TypeDArray::hasPointers()
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***************************** TypeNewArray *****************************/
|
||||
|
||||
#if 0
|
||||
|
||||
TypeNewArray::TypeNewArray(Type *telement)
|
||||
: TypeArray(Tnewarray, telement)
|
||||
{
|
||||
sym = NULL;
|
||||
}
|
||||
|
||||
Type *TypeNewArray::syntaxCopy()
|
||||
{
|
||||
Type *t = next->syntaxCopy();
|
||||
if (t == next)
|
||||
t = this;
|
||||
else
|
||||
{ t = new TypeNewArray(t);
|
||||
t->mod = mod;
|
||||
}
|
||||
return t;
|
||||
}
|
||||
|
||||
d_uns64 TypeNewArray::size(Loc loc)
|
||||
{
|
||||
//printf("TypeNewArray::size()\n");
|
||||
return PTRSIZE;
|
||||
}
|
||||
|
||||
unsigned TypeNewArray::alignsize()
|
||||
{
|
||||
return PTRSIZE;
|
||||
}
|
||||
|
||||
Type *TypeNewArray::semantic(Loc loc, Scope *sc)
|
||||
{ Type *tn = next;
|
||||
|
||||
tn = next->semantic(loc,sc);
|
||||
Type *tbn = tn->toBasetype();
|
||||
switch (tbn->ty)
|
||||
{
|
||||
case Tfunction:
|
||||
case Tnone:
|
||||
case Ttuple:
|
||||
error(loc, "can't have array of %s", tbn->toChars());
|
||||
tn = next = tint32;
|
||||
break;
|
||||
case Tstruct:
|
||||
{ TypeStruct *ts = (TypeStruct *)tbn;
|
||||
if (ts->sym->isnested)
|
||||
error(loc, "cannot have array of inner structs %s", ts->toChars());
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (tn->isauto())
|
||||
error(loc, "cannot have array of auto %s", tn->toChars());
|
||||
|
||||
next = tn;
|
||||
transitive();
|
||||
return merge();
|
||||
}
|
||||
|
||||
void TypeNewArray::toDecoBuffer(OutBuffer *buf, int flag)
|
||||
{
|
||||
Type::toDecoBuffer(buf, flag);
|
||||
buf->writeByte('e');
|
||||
if (next)
|
||||
next->toDecoBuffer(buf, (flag & 0x100) ? 0 : mod);
|
||||
}
|
||||
|
||||
void TypeNewArray::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod)
|
||||
{
|
||||
if (mod != this->mod)
|
||||
{ toCBuffer3(buf, hgs, mod);
|
||||
return;
|
||||
}
|
||||
next->toCBuffer2(buf, hgs, this->mod);
|
||||
buf->writestring("[new]");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
/***************************** TypeAArray *****************************/
|
||||
|
||||
TypeAArray::TypeAArray(Type *t, Type *index)
|
||||
@@ -3774,6 +3874,7 @@ TypeFunction::TypeFunction(Arguments *parameters, Type *treturn, int varargs, en
|
||||
this->inuse = 0;
|
||||
this->isnothrow = false;
|
||||
this->ispure = false;
|
||||
this->isproperty = false;
|
||||
this->isref = false;
|
||||
|
||||
#if IN_LLVM
|
||||
@@ -3789,6 +3890,7 @@ Type *TypeFunction::syntaxCopy()
|
||||
t->mod = mod;
|
||||
t->isnothrow = isnothrow;
|
||||
t->ispure = ispure;
|
||||
t->isproperty = isproperty;
|
||||
t->isref = isref;
|
||||
return t;
|
||||
}
|
||||
@@ -3958,8 +4060,7 @@ void TypeFunction::toDecoBuffer(OutBuffer *buf, int flag, bool mangle)
|
||||
assert(0);
|
||||
}
|
||||
buf->writeByte(mc);
|
||||
|
||||
if (ispure || isnothrow || isref)
|
||||
if (ispure || isnothrow || isproperty || isref)
|
||||
{
|
||||
if (ispure)
|
||||
buf->writestring("Na");
|
||||
@@ -3967,6 +4068,8 @@ void TypeFunction::toDecoBuffer(OutBuffer *buf, int flag, bool mangle)
|
||||
buf->writestring("Nb");
|
||||
if (isref)
|
||||
buf->writestring("Nc");
|
||||
if (isproperty)
|
||||
buf->writestring("Nd");
|
||||
}
|
||||
|
||||
// LDC: if we're not producing a mangle string, add the this
|
||||
@@ -4026,6 +4129,8 @@ void TypeFunction::toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs
|
||||
buf->writestring("pure ");
|
||||
if (isnothrow)
|
||||
buf->writestring("nothrow ");
|
||||
if (isproperty)
|
||||
buf->writestring("@property ");
|
||||
if (isref)
|
||||
buf->writestring("ref ");
|
||||
|
||||
@@ -4098,17 +4203,14 @@ void TypeFunction::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod)
|
||||
*/
|
||||
if (mod != this->mod)
|
||||
{
|
||||
if (mod & MODconst)
|
||||
buf->writestring(" const");
|
||||
if (mod & MODinvariant)
|
||||
buf->writestring(" immutable");
|
||||
if (mod & MODshared)
|
||||
buf->writestring(" shared");
|
||||
modToBuffer(buf);
|
||||
}
|
||||
if (ispure)
|
||||
buf->writestring(" pure");
|
||||
if (isnothrow)
|
||||
buf->writestring(" nothrow");
|
||||
if (isproperty)
|
||||
buf->writestring(" @property");
|
||||
if (isref)
|
||||
buf->writestring(" ref");
|
||||
|
||||
@@ -6170,7 +6272,7 @@ char *TypeClass::toChars()
|
||||
{
|
||||
if (mod)
|
||||
return Type::toChars();
|
||||
return sym->toPrettyChars();
|
||||
return (char *)sym->toPrettyChars();
|
||||
}
|
||||
|
||||
Type *TypeClass::syntaxCopy()
|
||||
|
||||
40
dmd2/mtype.h
40
dmd2/mtype.h
@@ -60,9 +60,10 @@ struct Symbol;
|
||||
|
||||
enum ENUMTY
|
||||
{
|
||||
Tarray, // dynamic array
|
||||
Tsarray, // static array
|
||||
Taarray, // associative array
|
||||
Tarray, // slice array, aka T[]
|
||||
Tsarray, // static array, aka T[dimension]
|
||||
Tnarray, // resizable array, aka T[new]
|
||||
Taarray, // associative array, aka T[type]
|
||||
Tpointer,
|
||||
Treference,
|
||||
Tfunction,
|
||||
@@ -128,7 +129,10 @@ struct Type : Object
|
||||
#define MODshared 2 // type is shared
|
||||
char *deco;
|
||||
|
||||
/* Note that there is no "shared immutable", because that is just immutable
|
||||
/* These are cached values that are lazily evaluated by constOf(), invariantOf(), etc.
|
||||
* They should not be referenced by anybody but mtype.c.
|
||||
* They can be NULL if not lazily evaluated yet.
|
||||
* Note that there is no "shared immutable", because that is just immutable
|
||||
*/
|
||||
|
||||
Type *cto; // MODconst ? mutable version of this type : const version
|
||||
@@ -242,7 +246,8 @@ struct Type : Object
|
||||
virtual void toCBuffer(OutBuffer *buf, Identifier *ident, HdrGenState *hgs);
|
||||
virtual void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
|
||||
void toCBuffer3(OutBuffer *buf, HdrGenState *hgs, int mod);
|
||||
#if POSIX
|
||||
void modToBuffer(OutBuffer *buf);
|
||||
#if CPP_MANGLE
|
||||
virtual void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
virtual int isintegral();
|
||||
@@ -359,7 +364,7 @@ struct TypeBasic : Type
|
||||
Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
|
||||
char *toChars();
|
||||
void toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod);
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
int isintegral();
|
||||
@@ -413,7 +418,7 @@ struct TypeSArray : TypeArray
|
||||
TypeInfoDeclaration *getTypeInfoDeclaration();
|
||||
Expression *toExpression();
|
||||
int hasPointers();
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
|
||||
@@ -443,7 +448,7 @@ struct TypeDArray : TypeArray
|
||||
MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
|
||||
TypeInfoDeclaration *getTypeInfoDeclaration();
|
||||
int hasPointers();
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
|
||||
@@ -472,7 +477,7 @@ struct TypeAArray : TypeArray
|
||||
int hasPointers();
|
||||
MATCH implicitConvTo(Type *to);
|
||||
MATCH constConv(Type *to);
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
|
||||
@@ -500,7 +505,7 @@ struct TypePointer : TypeNext
|
||||
TypeInfoDeclaration *getTypeInfoDeclaration();
|
||||
int hasPointers();
|
||||
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
|
||||
@@ -519,7 +524,7 @@ struct TypeReference : TypeNext
|
||||
Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
|
||||
Expression *defaultInit(Loc loc);
|
||||
int isZeroInit(Loc loc);
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
};
|
||||
@@ -539,6 +544,7 @@ struct TypeFunction : TypeNext
|
||||
// 2: T t ...) style for variable number of arguments
|
||||
bool isnothrow; // true: nothrow
|
||||
bool ispure; // true: pure
|
||||
bool isproperty; // can be called without parentheses
|
||||
bool isref; // true: returns a reference
|
||||
enum LINK linkage; // calling convention
|
||||
|
||||
@@ -553,7 +559,7 @@ struct TypeFunction : TypeNext
|
||||
MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
|
||||
TypeInfoDeclaration *getTypeInfoDeclaration();
|
||||
Type *reliesOnTident();
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
bool parameterEscapes(Argument *p);
|
||||
@@ -591,7 +597,7 @@ struct TypeDelegate : TypeNext
|
||||
TypeInfoDeclaration *getTypeInfoDeclaration();
|
||||
Expression *dotExp(Scope *sc, Expression *e, Identifier *ident);
|
||||
int hasPointers();
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
|
||||
@@ -697,7 +703,7 @@ struct TypeStruct : Type
|
||||
MATCH implicitConvTo(Type *to);
|
||||
MATCH constConv(Type *to);
|
||||
Type *toHeadMutable();
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
|
||||
@@ -738,7 +744,7 @@ struct TypeEnum : Type
|
||||
MATCH deduceType(Scope *sc, Type *tparam, TemplateParameters *parameters, Objects *dedtypes);
|
||||
TypeInfoDeclaration *getTypeInfoDeclaration();
|
||||
int hasPointers();
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
|
||||
@@ -784,7 +790,7 @@ struct TypeTypedef : Type
|
||||
TypeInfoDeclaration *getTypeInfoDeclaration();
|
||||
int hasPointers();
|
||||
Type *toHeadMutable();
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
|
||||
@@ -821,7 +827,7 @@ struct TypeClass : Type
|
||||
#if DMDV2
|
||||
Type *toHeadMutable();
|
||||
MATCH constConv(Type *to);
|
||||
#if POSIX
|
||||
#if CPP_MANGLE
|
||||
void toCppMangle(OutBuffer *buf, CppMangleState *cms);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -86,6 +86,8 @@ Expression *expandVar(int result, VarDeclaration *v)
|
||||
e = ei->syntaxCopy();
|
||||
e = e->semantic(v->scope);
|
||||
e = e->implicitCastTo(v->scope, v->type);
|
||||
// enabling this line causes test22 in test suite to fail
|
||||
//ei->type = e->type;
|
||||
v->scope = NULL;
|
||||
v->inuse--;
|
||||
}
|
||||
@@ -426,11 +428,50 @@ Expression *DotVarExp::optimize(int result)
|
||||
return this;
|
||||
}
|
||||
|
||||
Expression *NewExp::optimize(int result)
|
||||
{
|
||||
if (thisexp)
|
||||
thisexp = thisexp->optimize(WANTvalue);
|
||||
|
||||
// Optimize parameters
|
||||
if (newargs)
|
||||
{
|
||||
for (size_t i = 0; i < newargs->dim; i++)
|
||||
{ Expression *e = (Expression *)newargs->data[i];
|
||||
|
||||
e = e->optimize(WANTvalue);
|
||||
newargs->data[i] = (void *)e;
|
||||
}
|
||||
}
|
||||
|
||||
if (arguments)
|
||||
{
|
||||
for (size_t i = 0; i < arguments->dim; i++)
|
||||
{ Expression *e = (Expression *)arguments->data[i];
|
||||
|
||||
e = e->optimize(WANTvalue);
|
||||
arguments->data[i] = (void *)e;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
Expression *CallExp::optimize(int result)
|
||||
{
|
||||
//printf("CallExp::optimize(result = %d) %s\n", result, toChars());
|
||||
Expression *e = this;
|
||||
|
||||
// Optimize parameters
|
||||
if (arguments)
|
||||
{
|
||||
for (size_t i = 0; i < arguments->dim; i++)
|
||||
{ Expression *e = (Expression *)arguments->data[i];
|
||||
|
||||
e = e->optimize(WANTvalue);
|
||||
arguments->data[i] = (void *)e;
|
||||
}
|
||||
}
|
||||
|
||||
e1 = e1->optimize(result);
|
||||
if (e1->op == TOKvar)
|
||||
{
|
||||
@@ -792,7 +833,8 @@ Expression *IdentityExp::optimize(int result)
|
||||
e2 = e2->optimize(WANTvalue | (result & WANTinterpret));
|
||||
e = this;
|
||||
|
||||
if (this->e1->isConst() && this->e2->isConst())
|
||||
if ((this->e1->isConst() && this->e2->isConst()) ||
|
||||
(this->e1->op == TOKnull && this->e2->op == TOKnull))
|
||||
{
|
||||
e = Identity(op, type, this->e1, this->e2);
|
||||
}
|
||||
|
||||
22
dmd2/parse.c
22
dmd2/parse.c
@@ -2266,7 +2266,7 @@ Type *Parser::parseBasicType2(Type *t)
|
||||
nextToken();
|
||||
arguments = parseParameters(&varargs);
|
||||
while (1)
|
||||
{ // Postfixes of 'pure' or 'nothrow'
|
||||
{ // Postfixes
|
||||
if (token.value == TOKpure)
|
||||
ispure = true;
|
||||
else if (token.value == TOKnothrow)
|
||||
@@ -2433,6 +2433,22 @@ Type *Parser::parseDeclarator(Type *t, Identifier **pident, TemplateParameters *
|
||||
((TypeFunction *)tf)->ispure = 1;
|
||||
nextToken();
|
||||
continue;
|
||||
|
||||
case TOKat:
|
||||
nextToken();
|
||||
if (token.value != TOKidentifier)
|
||||
{ error("attribute identifier expected");
|
||||
nextToken();
|
||||
continue;
|
||||
}
|
||||
Identifier *id = token.ident;
|
||||
if (id == Id::property)
|
||||
((TypeFunction *)tf)->ispure = 1;
|
||||
else
|
||||
error("valid attribute identifiers are property, not %s", id->toChars());
|
||||
nextToken();
|
||||
continue;
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -4361,6 +4377,10 @@ int Parser::isDeclarator(Token **pt, int *haveId, enum TOK endtok)
|
||||
case TOKnothrow:
|
||||
t = peek(t);
|
||||
continue;
|
||||
case TOKat:
|
||||
t = peek(t); // skip '@'
|
||||
t = peek(t); // skip identifier
|
||||
continue;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -14,16 +14,13 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#if !__DMC__
|
||||
#include <sys/stat.h>
|
||||
#endif
|
||||
|
||||
#if _WIN32
|
||||
#include <tchar.h>
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#if linux || __APPLE__ || __FreeBSD__ || __sun&&__SVR4
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
|
||||
@@ -409,10 +409,12 @@ Array *FileName::splitPath(const char *path)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
case ' ':
|
||||
case '\t': // tabs in filenames?
|
||||
if (!instring) // if not in string
|
||||
break; // treat as end of path
|
||||
#endif
|
||||
default:
|
||||
buf.writeByte(c);
|
||||
continue;
|
||||
|
||||
379
dmd2/statement.c
379
dmd2/statement.c
@@ -29,6 +29,12 @@
|
||||
#include "template.h"
|
||||
#include "attrib.h"
|
||||
|
||||
#if IN_LLVM
|
||||
#include "gen/tollvm.h"
|
||||
#elif IN_DMD
|
||||
extern int os_critsecsize();
|
||||
#endif
|
||||
|
||||
/******************************** Statement ***************************/
|
||||
|
||||
Statement::Statement(Loc loc)
|
||||
@@ -182,6 +188,22 @@ Statements *Statement::flatten(Scope *sc)
|
||||
}
|
||||
|
||||
|
||||
/******************************** PeelStatement ***************************/
|
||||
|
||||
PeelStatement::PeelStatement(Statement *s)
|
||||
: Statement(s->loc)
|
||||
{
|
||||
this->s = s;
|
||||
}
|
||||
|
||||
Statement *PeelStatement::semantic(Scope *sc)
|
||||
{
|
||||
/* "peel" off this wrapper, and don't run semantic()
|
||||
* on the result.
|
||||
*/
|
||||
return s;
|
||||
}
|
||||
|
||||
/******************************** ExpStatement ***************************/
|
||||
|
||||
ExpStatement::ExpStatement(Loc loc, Expression *exp)
|
||||
@@ -344,6 +366,25 @@ void DeclarationStatement::scopeCode(Scope *sc, Statement **sentry, Statement **
|
||||
if (e)
|
||||
{
|
||||
//printf("dtor is: "); e->print();
|
||||
#if 0
|
||||
if (v->type->toBasetype()->ty == Tstruct)
|
||||
{ /* Need a 'gate' to turn on/off destruction,
|
||||
* in case v gets moved elsewhere.
|
||||
*/
|
||||
Identifier *id = Lexer::uniqueId("__runDtor");
|
||||
ExpInitializer *ie = new ExpInitializer(loc, new IntegerExp(1));
|
||||
VarDeclaration *rd = new VarDeclaration(loc, Type::tint32, id, ie);
|
||||
*sentry = new DeclarationStatement(loc, rd);
|
||||
v->rundtor = rd;
|
||||
|
||||
/* Rewrite e as:
|
||||
* rundtor && e
|
||||
*/
|
||||
Expression *ve = new VarExp(loc, v->rundtor);
|
||||
e = new AndAndExp(loc, ve, e);
|
||||
e->type = Type::tbool;
|
||||
}
|
||||
#endif
|
||||
*sfinally = new ExpStatement(loc, e);
|
||||
}
|
||||
}
|
||||
@@ -418,7 +459,12 @@ Statement *CompoundStatement::semantic(Scope *sc)
|
||||
if (sentry)
|
||||
{
|
||||
sentry = sentry->semantic(sc);
|
||||
statements->data[i] = sentry;
|
||||
if (s->isDeclarationStatement())
|
||||
{ statements->insert(i, sentry);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
statements->data[i] = sentry;
|
||||
}
|
||||
if (sexception)
|
||||
{
|
||||
@@ -562,7 +608,8 @@ int CompoundStatement::blockExit()
|
||||
//printf("%s\n", s->toChars());
|
||||
if (!(result & BEfallthru) && !s->comeFrom())
|
||||
{
|
||||
s->warning("statement is not reachable");
|
||||
if (s->blockExit() != BEhalt)
|
||||
s->warning("statement is not reachable");
|
||||
}
|
||||
|
||||
result &= ~BEfallthru;
|
||||
@@ -909,46 +956,12 @@ Statement *WhileStatement::syntaxCopy()
|
||||
|
||||
Statement *WhileStatement::semantic(Scope *sc)
|
||||
{
|
||||
#if 0
|
||||
if (condition->op == TOKmatch)
|
||||
{
|
||||
/* Rewrite while (condition) body as:
|
||||
* if (condition)
|
||||
* do
|
||||
* body
|
||||
* while ((_match = _match.opNext), _match);
|
||||
*/
|
||||
/* Rewrite as a for(;condition;) loop
|
||||
*/
|
||||
|
||||
Expression *ew = new IdentifierExp(0, Id::_match);
|
||||
ew = new DotIdExp(0, ew, Id::next);
|
||||
ew = new AssignExp(0, new IdentifierExp(0, Id::_match), ew);
|
||||
////ew = new EqualExp(TOKnotequal, 0, ew, new NullExp(0));
|
||||
Expression *ev = new IdentifierExp(0, Id::_match);
|
||||
//ev = new CastExp(0, ev, Type::tvoidptr);
|
||||
ew = new CommaExp(0, ew, ev);
|
||||
Statement *sw = new DoStatement(loc, body, ew);
|
||||
Statement *si = new IfStatement(loc, condition, sw, NULL);
|
||||
return si->semantic(sc);
|
||||
}
|
||||
#endif
|
||||
|
||||
condition = condition->semantic(sc);
|
||||
condition = resolveProperties(sc, condition);
|
||||
condition = condition->optimize(WANTvalue);
|
||||
condition = condition->checkToBoolean();
|
||||
|
||||
sc->noctor++;
|
||||
|
||||
Scope *scd = sc->push();
|
||||
scd->sbreak = this;
|
||||
scd->scontinue = this;
|
||||
if (body)
|
||||
body = body->semantic(scd);
|
||||
scd->pop();
|
||||
|
||||
sc->noctor--;
|
||||
|
||||
return this;
|
||||
Statement *s = new ForStatement(loc, NULL, condition, NULL, body);
|
||||
s = s->semantic(sc);
|
||||
return s;
|
||||
}
|
||||
|
||||
int WhileStatement::hasBreak()
|
||||
@@ -963,11 +976,13 @@ int WhileStatement::hasContinue()
|
||||
|
||||
int WhileStatement::usesEH()
|
||||
{
|
||||
assert(0);
|
||||
return body ? body->usesEH() : 0;
|
||||
}
|
||||
|
||||
int WhileStatement::blockExit()
|
||||
{
|
||||
assert(0);
|
||||
//printf("WhileStatement::blockExit(%p)\n", this);
|
||||
|
||||
int result = BEnone;
|
||||
@@ -998,6 +1013,7 @@ int WhileStatement::blockExit()
|
||||
|
||||
int WhileStatement::comeFrom()
|
||||
{
|
||||
assert(0);
|
||||
if (body)
|
||||
return body->comeFrom();
|
||||
return FALSE;
|
||||
@@ -1193,6 +1209,10 @@ int ForStatement::blockExit()
|
||||
if (condition)
|
||||
{ if (condition->canThrow())
|
||||
result |= BEthrow;
|
||||
if (condition->isBool(TRUE))
|
||||
result &= ~BEfallthru;
|
||||
else if (condition->isBool(FALSE))
|
||||
return result;
|
||||
}
|
||||
else
|
||||
result &= ~BEfallthru; // the body must do the exiting
|
||||
@@ -1452,11 +1472,14 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
for (size_t i = 0; i < dim; i++)
|
||||
{ // Declare args
|
||||
Argument *arg = (Argument *)arguments->data[i];
|
||||
Type *argtype = arg->type->semantic(loc, sc);
|
||||
VarDeclaration *var;
|
||||
|
||||
var = new VarDeclaration(loc, arg->type, arg->ident, NULL);
|
||||
var = new VarDeclaration(loc, argtype, arg->ident, NULL);
|
||||
var->storage_class |= STCforeach;
|
||||
var->storage_class |= arg->storageClass & (STCin | STCout | STCref | STC_TYPECTOR);
|
||||
if (var->storage_class & (STCref | STCout))
|
||||
var->storage_class |= STCnodtor;
|
||||
if (dim == 2 && i == 0)
|
||||
{ key = var;
|
||||
//var->storage_class |= STCfinal;
|
||||
@@ -1471,20 +1494,68 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
var->storage_class |= STCconst;
|
||||
}
|
||||
}
|
||||
#if 1
|
||||
#if 0
|
||||
DeclarationExp *de = new DeclarationExp(loc, var);
|
||||
de->semantic(sc);
|
||||
#else
|
||||
var->semantic(sc);
|
||||
if (!sc->insert(var))
|
||||
error("%s already defined", var->ident->toChars());
|
||||
#endif
|
||||
}
|
||||
|
||||
sc->sbreak = this;
|
||||
sc->scontinue = this;
|
||||
body = body->semantic(sc);
|
||||
#if 1
|
||||
{
|
||||
/* Convert to a ForStatement
|
||||
* foreach (key, value; a) body =>
|
||||
* for (T[] tmp = a[], size_t key; key < tmp.length; ++key)
|
||||
* { T value = tmp[k]; body }
|
||||
*
|
||||
* foreach_reverse (key, value; a) body =>
|
||||
* for (T[] tmp = a[], size_t key = tmp.length; key--; )
|
||||
* { T value = tmp[k]; body }
|
||||
*/
|
||||
Identifier *id = Lexer::uniqueId("__aggr");
|
||||
ExpInitializer *ie = new ExpInitializer(loc, new SliceExp(loc, aggr, NULL, NULL));
|
||||
VarDeclaration *tmp = new VarDeclaration(loc, aggr->type->nextOf()->arrayOf(), id, ie);
|
||||
|
||||
Expression *tmp_length = new DotIdExp(loc, new VarExp(loc, tmp), Id::length);
|
||||
|
||||
if (!key)
|
||||
{
|
||||
Identifier *id = Lexer::uniqueId("__key");
|
||||
key = new VarDeclaration(loc, Type::tsize_t, id, NULL);
|
||||
}
|
||||
if (op == TOKforeach_reverse)
|
||||
key->init = new ExpInitializer(loc, tmp_length);
|
||||
else
|
||||
key->init = new ExpInitializer(loc, new IntegerExp(0));
|
||||
|
||||
Statements *cs = new Statements();
|
||||
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp)));
|
||||
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, key)));
|
||||
Statement *forinit = new CompoundDeclarationStatement(loc, cs);
|
||||
|
||||
Expression *cond;
|
||||
if (op == TOKforeach_reverse)
|
||||
// key--
|
||||
cond = new PostExp(TOKminusminus, loc, new VarExp(loc, key));
|
||||
else
|
||||
// key < tmp.length
|
||||
cond = new CmpExp(TOKlt, loc, new VarExp(loc, key), tmp_length);
|
||||
|
||||
Expression *increment = NULL;
|
||||
if (op == TOKforeach)
|
||||
// key += 1
|
||||
increment = new AddAssignExp(loc, new VarExp(loc, key), new IntegerExp(1));
|
||||
|
||||
// T value = tmp[key];
|
||||
value->init = new ExpInitializer(loc, new IndexExp(loc, new VarExp(loc, tmp), new VarExp(loc, key)));
|
||||
Statement *ds = new DeclarationStatement(loc, new DeclarationExp(loc, value));
|
||||
|
||||
body = new CompoundStatement(loc, ds, body);
|
||||
|
||||
ForStatement *fs = new ForStatement(loc, forinit, cond, increment, body);
|
||||
s = fs->semantic(sc);
|
||||
break;
|
||||
}
|
||||
#else
|
||||
if (tab->nextOf()->implicitConvTo(value->type) < MATCHconst)
|
||||
{
|
||||
if (aggr->op == TOKstring)
|
||||
@@ -1494,20 +1565,23 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
tab->toChars(), value->type->toChars());
|
||||
}
|
||||
|
||||
if (key && key->type->ty != Tint32 && key->type->ty != Tuns32)
|
||||
if (key)
|
||||
{
|
||||
if (global.params.is64bit)
|
||||
{
|
||||
if (key->type->ty != Tint64 && key->type->ty != Tuns64)
|
||||
error("foreach: key type must be int or uint, long or ulong, not %s", key->type->toChars());
|
||||
}
|
||||
else
|
||||
error("foreach: key type must be int or uint, not %s", key->type->toChars());
|
||||
|
||||
if (key->storage_class & (STCout | STCref))
|
||||
error("foreach: key cannot be out or ref");
|
||||
}
|
||||
|
||||
if (key && key->storage_class & (STCout | STCref))
|
||||
error("foreach: key cannot be out or ref");
|
||||
sc->sbreak = this;
|
||||
sc->scontinue = this;
|
||||
body = body->semantic(sc);
|
||||
break;
|
||||
#endif
|
||||
|
||||
case Taarray:
|
||||
if (!checkForArgTypes())
|
||||
@@ -1745,12 +1819,14 @@ Statement *ForeachStatement::semantic(Scope *sc)
|
||||
keysize = (keysize + (PTRSIZE-1)) & ~(PTRSIZE-1);
|
||||
exps->push(new IntegerExp(0, keysize, Type::tsize_t));
|
||||
|
||||
#if IN_LLVM
|
||||
// LDC paint delegate argument to the type runtime expects
|
||||
if (!fldeTy->equals(flde->type))
|
||||
{
|
||||
flde = new CastExp(loc, flde, flde->type);
|
||||
flde->type = fldeTy;
|
||||
}
|
||||
#endif
|
||||
exps->push(flde);
|
||||
e = new CallExp(loc, ec, exps);
|
||||
e->type = Type::tindex; // don't run semantic() on e
|
||||
@@ -2055,6 +2131,55 @@ Statement *ForeachRangeStatement::semantic(Scope *sc)
|
||||
lwr = ea.e1;
|
||||
upr = ea.e2;
|
||||
}
|
||||
#if 1
|
||||
/* Convert to a for loop:
|
||||
* foreach (key; lwr .. upr) =>
|
||||
* for (auto key = lwr, auto tmp = upr; key < tmp; ++key)
|
||||
*
|
||||
* foreach_reverse (key; lwr .. upr) =>
|
||||
* for (auto tmp = lwr, auto key = upr; key-- > tmp;)
|
||||
*/
|
||||
|
||||
ExpInitializer *ie = new ExpInitializer(loc, (op == TOKforeach) ? lwr : upr);
|
||||
key = new VarDeclaration(loc, arg->type, arg->ident, ie);
|
||||
|
||||
Identifier *id = Lexer::uniqueId("__limit");
|
||||
ie = new ExpInitializer(loc, (op == TOKforeach) ? upr : lwr);
|
||||
VarDeclaration *tmp = new VarDeclaration(loc, arg->type, id, ie);
|
||||
|
||||
Statements *cs = new Statements();
|
||||
// Keep order of evaluation as lwr, then upr
|
||||
if (op == TOKforeach)
|
||||
{
|
||||
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, key)));
|
||||
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp)));
|
||||
}
|
||||
else
|
||||
{
|
||||
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp)));
|
||||
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, key)));
|
||||
}
|
||||
Statement *forinit = new CompoundDeclarationStatement(loc, cs);
|
||||
|
||||
Expression *cond;
|
||||
if (op == TOKforeach_reverse)
|
||||
{ // key-- > tmp
|
||||
cond = new PostExp(TOKminusminus, loc, new VarExp(loc, key));
|
||||
cond = new CmpExp(TOKgt, loc, cond, new VarExp(loc, tmp));
|
||||
}
|
||||
else
|
||||
// key < tmp
|
||||
cond = new CmpExp(TOKlt, loc, new VarExp(loc, key), new VarExp(loc, tmp));
|
||||
|
||||
Expression *increment = NULL;
|
||||
if (op == TOKforeach)
|
||||
// key += 1
|
||||
increment = new AddAssignExp(loc, new VarExp(loc, key), new IntegerExp(1));
|
||||
|
||||
ForStatement *fs = new ForStatement(loc, forinit, cond, increment, body);
|
||||
s = fs->semantic(sc);
|
||||
return s;
|
||||
#else
|
||||
if (!arg->type->isscalar())
|
||||
error("%s is not a scalar type", arg->type->toChars());
|
||||
|
||||
@@ -2078,6 +2203,7 @@ Statement *ForeachRangeStatement::semantic(Scope *sc)
|
||||
sc->noctor--;
|
||||
sc->pop();
|
||||
return s;
|
||||
#endif
|
||||
}
|
||||
|
||||
int ForeachRangeStatement::hasBreak()
|
||||
@@ -2092,11 +2218,14 @@ int ForeachRangeStatement::hasContinue()
|
||||
|
||||
int ForeachRangeStatement::usesEH()
|
||||
{
|
||||
assert(0);
|
||||
return body->usesEH();
|
||||
}
|
||||
|
||||
int ForeachRangeStatement::blockExit()
|
||||
{ int result = BEfallthru;
|
||||
{
|
||||
assert(0);
|
||||
int result = BEfallthru;
|
||||
|
||||
if (lwr && lwr->canThrow())
|
||||
result |= BEthrow;
|
||||
@@ -2113,6 +2242,7 @@ int ForeachRangeStatement::blockExit()
|
||||
|
||||
int ForeachRangeStatement::comeFrom()
|
||||
{
|
||||
assert(0);
|
||||
if (body)
|
||||
return body->comeFrom();
|
||||
return FALSE;
|
||||
@@ -2462,7 +2592,7 @@ Statement *PragmaStatement::semantic(Scope *sc)
|
||||
{
|
||||
sc->func->allowInlining = true;
|
||||
}
|
||||
|
||||
#if DMDV2
|
||||
else if (ident == Id::startaddress)
|
||||
{
|
||||
if (!args || args->dim != 1)
|
||||
@@ -2483,6 +2613,7 @@ Statement *PragmaStatement::semantic(Scope *sc)
|
||||
return this;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
else
|
||||
error("unrecognized pragma(%s)", ident->toChars());
|
||||
|
||||
@@ -2657,7 +2788,7 @@ Statement *SwitchStatement::semantic(Scope *sc)
|
||||
;
|
||||
}
|
||||
|
||||
if (!sc->sw->sdefault)
|
||||
if (!sc->sw->sdefault && !isFinal)
|
||||
{ hasNoDefault = 1;
|
||||
|
||||
warning("switch statement has no default");
|
||||
@@ -3693,21 +3824,145 @@ Statement *SynchronizedStatement::syntaxCopy()
|
||||
Statement *SynchronizedStatement::semantic(Scope *sc)
|
||||
{
|
||||
if (exp)
|
||||
{ ClassDeclaration *cd;
|
||||
|
||||
{
|
||||
exp = exp->semantic(sc);
|
||||
exp = resolveProperties(sc, exp);
|
||||
cd = exp->type->isClassHandle();
|
||||
ClassDeclaration *cd = exp->type->isClassHandle();
|
||||
if (!cd)
|
||||
error("can only synchronize on class objects, not '%s'", exp->type->toChars());
|
||||
else if (cd->isInterfaceDeclaration())
|
||||
{ Type *t = new TypeIdentifier(0, Id::Object);
|
||||
{ /* Cast the interface to an object, as the object has the monitor,
|
||||
* not the interface.
|
||||
*/
|
||||
Type *t = new TypeIdentifier(0, Id::Object);
|
||||
|
||||
t = t->semantic(0, sc);
|
||||
exp = new CastExp(loc, exp, t);
|
||||
exp = exp->semantic(sc);
|
||||
}
|
||||
|
||||
#if 1
|
||||
/* Rewrite as:
|
||||
* auto tmp = exp;
|
||||
* _d_monitorenter(tmp);
|
||||
* try { body } finally { _d_monitorexit(tmp); }
|
||||
*/
|
||||
Identifier *id = Lexer::uniqueId("__sync");
|
||||
ExpInitializer *ie = new ExpInitializer(loc, exp);
|
||||
VarDeclaration *tmp = new VarDeclaration(loc, exp->type, id, ie);
|
||||
|
||||
Statements *cs = new Statements();
|
||||
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp)));
|
||||
|
||||
#if IN_LLVM
|
||||
// LDC: Build args
|
||||
Arguments* args = new Arguments;
|
||||
args->push(new Argument(STCin, ClassDeclaration::object->type, NULL, NULL));
|
||||
FuncDeclaration *fdenter = FuncDeclaration::genCfunc(args, Type::tvoid, Id::monitorenter);
|
||||
#else
|
||||
FuncDeclaration *fdenter = FuncDeclaration::genCfunc(Type::tvoid, Id::monitorenter);
|
||||
#endif
|
||||
Expression *e = new CallExp(loc, new VarExp(loc, fdenter), new VarExp(loc, tmp));
|
||||
e->type = Type::tvoid; // do not run semantic on e
|
||||
cs->push(new ExpStatement(loc, e));
|
||||
|
||||
#if IN_LLVM
|
||||
FuncDeclaration *fdexit = FuncDeclaration::genCfunc(args, Type::tvoid, Id::monitorexit);
|
||||
#else
|
||||
FuncDeclaration *fdexit = FuncDeclaration::genCfunc(args, Type::tvoid, Id::monitorexit);
|
||||
#endif
|
||||
e = new CallExp(loc, new VarExp(loc, fdexit), new VarExp(loc, tmp));
|
||||
e->type = Type::tvoid; // do not run semantic on e
|
||||
Statement *s = new ExpStatement(loc, e);
|
||||
s = new TryFinallyStatement(loc, body, s);
|
||||
cs->push(s);
|
||||
|
||||
s = new CompoundStatement(loc, cs);
|
||||
return s->semantic(sc);
|
||||
#endif
|
||||
}
|
||||
#if 1
|
||||
else
|
||||
{ /* Generate our own critical section, then rewrite as:
|
||||
* __gshared byte[CriticalSection.sizeof] critsec;
|
||||
* _d_criticalenter(critsec.ptr);
|
||||
* try { body } finally { _d_criticalexit(critsec.ptr); }
|
||||
*/
|
||||
Identifier *id = Lexer::uniqueId("__critsec");
|
||||
#if IN_LLVM
|
||||
Type *t = new TypeSArray(Type::tint8, new IntegerExp(PTRSIZE + getTypePaddedSize(DtoMutexType())));
|
||||
#elif IN_DMD
|
||||
Type *t = new TypeSArray(Type::tint8, new IntegerExp(PTRSIZE + os_critsecsize()));
|
||||
#endif
|
||||
VarDeclaration *tmp = new VarDeclaration(loc, t, id, NULL);
|
||||
tmp->storage_class |= STCgshared | STCstatic;
|
||||
|
||||
Statements *cs = new Statements();
|
||||
cs->push(new DeclarationStatement(loc, new DeclarationExp(loc, tmp)));
|
||||
|
||||
#if IN_LLVM
|
||||
// LDC: Build args (based on the code from gen/tollvm.cpp:DtoMutexType()
|
||||
Arguments* args = new Arguments;
|
||||
StructDeclaration* dcs = new StructDeclaration(loc, id);
|
||||
if (global.params.os == OSWindows)
|
||||
{
|
||||
dcs->addField(dcs->scope, new VarDeclaration(loc, Type::tint32, id, NULL));
|
||||
}
|
||||
else if (global.params.os == OSFreeBSD)
|
||||
{
|
||||
dcs->addField(dcs->scope, new VarDeclaration(loc, Type::tsize_t, id, NULL));
|
||||
}
|
||||
else
|
||||
{
|
||||
// pthread_fastlock
|
||||
StructDeclaration* pfl = new StructDeclaration(loc, id);
|
||||
pfl->scope->linkage = LINKc;
|
||||
pfl->addField(pfl->scope, new VarDeclaration(loc, Type::tsize_t, id, NULL));
|
||||
pfl->addField(pfl->scope, new VarDeclaration(loc, Type::tint32, id, NULL));
|
||||
|
||||
// pthread_mutex
|
||||
StructDeclaration* pm = new StructDeclaration(loc, id);
|
||||
pm->scope->linkage = LINKc;
|
||||
pm->addField(pm->scope, new VarDeclaration(loc, Type::tint32, id, NULL));
|
||||
pm->addField(pm->scope, new VarDeclaration(loc, Type::tint32, id, NULL));
|
||||
pm->addField(pm->scope, new VarDeclaration(loc, Type::tvoidptr, id, NULL));
|
||||
pm->addField(pm->scope, new VarDeclaration(loc, Type::tint32, id, NULL));
|
||||
pm->addField(pm->scope, new VarDeclaration(loc, pfl->type, id, NULL));
|
||||
|
||||
// D_CRITICAL_SECTION
|
||||
dcs->scope->linkage = LINKc;
|
||||
dcs->addField(dcs->scope, new VarDeclaration(loc, dcs->type->pointerTo(), id, NULL));
|
||||
dcs->addField(dcs->scope, new VarDeclaration(loc, pm->type, id, NULL));
|
||||
}
|
||||
args->push(new Argument(STCin, dcs->type->pointerTo(), NULL, NULL));
|
||||
|
||||
FuncDeclaration *fdenter = FuncDeclaration::genCfunc(args, Type::tvoid, Id::criticalenter);
|
||||
#else
|
||||
FuncDeclaration *fdenter = FuncDeclaration::genCfunc(Type::tvoid, Id::criticalenter);
|
||||
#endif
|
||||
Expression *e = new DotIdExp(loc, new VarExp(loc, tmp), Id::ptr);
|
||||
e = e->semantic(sc);
|
||||
e = new CallExp(loc, new VarExp(loc, fdenter), e);
|
||||
e->type = Type::tvoid; // do not run semantic on e
|
||||
cs->push(new ExpStatement(loc, e));
|
||||
|
||||
#if IN_LLVM
|
||||
FuncDeclaration *fdexit = FuncDeclaration::genCfunc(args, Type::tvoid, Id::criticalexit);
|
||||
#else
|
||||
FuncDeclaration *fdexit = FuncDeclaration::genCfunc(Type::tvoid, Id::criticalexit);
|
||||
#endif
|
||||
e = new DotIdExp(loc, new VarExp(loc, tmp), Id::ptr);
|
||||
e = e->semantic(sc);
|
||||
e = new CallExp(loc, new VarExp(loc, fdexit), e);
|
||||
e->type = Type::tvoid; // do not run semantic on e
|
||||
Statement *s = new ExpStatement(loc, e);
|
||||
s = new TryFinallyStatement(loc, body, s);
|
||||
cs->push(s);
|
||||
|
||||
s = new CompoundStatement(loc, cs);
|
||||
return s->semantic(sc);
|
||||
}
|
||||
#endif
|
||||
if (body)
|
||||
{
|
||||
Statement* oldScopeExit = sc->enclosingScopeExit;
|
||||
|
||||
@@ -153,6 +153,14 @@ struct Statement : Object
|
||||
#endif
|
||||
};
|
||||
|
||||
struct PeelStatement : Statement
|
||||
{
|
||||
Statement *s;
|
||||
|
||||
PeelStatement(Statement *s);
|
||||
Statement *semantic(Scope *sc);
|
||||
};
|
||||
|
||||
struct ExpStatement : Statement
|
||||
{
|
||||
Expression *exp;
|
||||
|
||||
@@ -1972,14 +1972,21 @@ MATCH TypeInstance::deduceType(Scope *sc,
|
||||
|
||||
L2:
|
||||
|
||||
for (int i = 0; i < tempinst->tiargs->dim; i++)
|
||||
for (int i = 0; 1; i++)
|
||||
{
|
||||
//printf("\ttest: tempinst->tiargs[%d]\n", i);
|
||||
Object *o1;
|
||||
if (i < tempinst->tiargs->dim)
|
||||
o1 = (Object *)tempinst->tiargs->data[i];
|
||||
else if (i < tempinst->tdtypes.dim && i < tp->tempinst->tiargs->dim)
|
||||
// Pick up default arg
|
||||
o1 = (Object *)tempinst->tdtypes.data[i];
|
||||
else
|
||||
break;
|
||||
|
||||
if (i >= tp->tempinst->tiargs->dim)
|
||||
goto Lnomatch;
|
||||
|
||||
int j;
|
||||
Object *o1 = (Object *)tempinst->tiargs->data[i];
|
||||
Object *o2 = (Object *)tp->tempinst->tiargs->data[i];
|
||||
|
||||
Type *t1 = isType(o1);
|
||||
@@ -2005,6 +2012,7 @@ MATCH TypeInstance::deduceType(Scope *sc,
|
||||
#endif
|
||||
|
||||
TemplateTupleParameter *ttp;
|
||||
int j;
|
||||
if (t2 &&
|
||||
t2->ty == Tident &&
|
||||
i == tp->tempinst->tiargs->dim - 1 &&
|
||||
@@ -2119,6 +2127,7 @@ MATCH TypeInstance::deduceType(Scope *sc,
|
||||
return Type::deduceType(sc, tparam, parameters, dedtypes);
|
||||
|
||||
Lnomatch:
|
||||
//printf("no match\n");
|
||||
return MATCHnomatch;
|
||||
}
|
||||
|
||||
@@ -4143,7 +4152,7 @@ Identifier *TemplateInstance::genIdent()
|
||||
Expression *ea = isExpression(o);
|
||||
Dsymbol *sa = isDsymbol(o);
|
||||
Tuple *va = isTuple(o);
|
||||
//printf("\to %p ta %p ea %p sa %p va %p\n", o, ta, ea, sa, va);
|
||||
//printf("\to [%d] %p ta %p ea %p sa %p va %p\n", i, o, ta, ea, sa, va);
|
||||
if (ta)
|
||||
{
|
||||
buf.writeByte('T');
|
||||
|
||||
@@ -732,7 +732,11 @@ LLConstant* DtoDefineClassInfo(ClassDeclaration* cd)
|
||||
|
||||
// class name
|
||||
// code from dmd
|
||||
#if DMDV2
|
||||
const char *name = cd->ident->toChars();
|
||||
#else
|
||||
char *name = cd->ident->toChars();
|
||||
#endif
|
||||
size_t namelen = strlen(name);
|
||||
if (!(namelen > 9 && memcmp(name, "TypeInfo_", 9) == 0))
|
||||
{
|
||||
|
||||
@@ -874,8 +874,11 @@ const LLStructType* DtoMutexType()
|
||||
opaque->refineAbstractTypeTo(pa.get());
|
||||
pmutex = isaStruct(pa.get());
|
||||
|
||||
gIR->mutexType = pmutex;
|
||||
gIR->module->addTypeName("D_CRITICAL_SECTION", pmutex);
|
||||
if (gIR->module != NULL)
|
||||
{
|
||||
gIR->mutexType = pmutex;
|
||||
gIR->module->addTypeName("D_CRITICAL_SECTION", pmutex);
|
||||
}
|
||||
return pmutex;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user