diff -uNr dmd-0.148/dmd/src/dmd/attrib.c dmd-0.149/dmd/src/dmd/attrib.c --- dmd-0.148/dmd/src/dmd/attrib.c 2006-02-09 15:17:26.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/attrib.c 2006-02-27 22:32:42.000000000 +0100 @@ -43,9 +43,10 @@ return decl; } -void AttribDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) +int AttribDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) { unsigned i; + int m = 0; Array *d = include(sc, sd); if (d) @@ -54,9 +55,10 @@ { Dsymbol *s; s = (Dsymbol *)d->data[i]; - s->addMember(sc, sd, i + memnum); + m |= s->addMember(sc, sd, m | memnum); } } + return m; } void AttribDeclaration::semantic(Scope *sc) @@ -944,7 +946,7 @@ } -void StaticIfDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) +int StaticIfDeclaration::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) { /* This is deferred until semantic(), so that * expressions in the condition can refer to declarations @@ -958,11 +960,13 @@ * } */ this->sd = sd; + int m = 0; if (memnum == 0) - { AttribDeclaration::addMember(sc, sd, memnum); + { m = AttribDeclaration::addMember(sc, sd, memnum); addisdone = 1; } + return m; } diff -uNr dmd-0.148/dmd/src/dmd/attrib.h dmd-0.149/dmd/src/dmd/attrib.h --- dmd-0.148/dmd/src/dmd/attrib.h 2006-02-08 20:42:52.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/attrib.h 2006-02-27 22:26:38.000000000 +0100 @@ -34,7 +34,7 @@ AttribDeclaration(Array *decl); virtual Array *include(Scope *sc, ScopeDsymbol *s); - void addMember(Scope *sc, ScopeDsymbol *s, int memnum); + int addMember(Scope *sc, ScopeDsymbol *s, int memnum); void semantic(Scope *sc); void semantic2(Scope *sc); void semantic3(Scope *sc); @@ -138,7 +138,7 @@ StaticIfDeclaration(Condition *condition, Array *decl, Array *elsedecl); Dsymbol *syntaxCopy(Dsymbol *s); - void addMember(Scope *sc, ScopeDsymbol *s, int memnum); + int addMember(Scope *sc, ScopeDsymbol *s, int memnum); void semantic(Scope *sc); char *kind(); }; diff -uNr dmd-0.148/dmd/src/dmd/cast.c dmd-0.149/dmd/src/dmd/cast.c --- dmd-0.148/dmd/src/dmd/cast.c 2006-02-22 09:48:16.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/cast.c 2006-03-05 00:57:24.000000000 +0100 @@ -150,7 +150,7 @@ { case Tbit: case Tbool: - if (value & ~1) + if ((value & 1) != value) goto Lno; goto Lyes; diff -uNr dmd-0.148/dmd/src/dmd/cond.c dmd-0.149/dmd/src/dmd/cond.c --- dmd-0.148/dmd/src/dmd/cond.c 2006-02-08 22:47:02.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/cond.c 2006-03-03 01:40:08.000000000 +0100 @@ -316,7 +316,7 @@ Array dedtypes; dedtypes.setDim(1); - m = targ->deduceType(tspec, ¶meters, &dedtypes); + m = targ->deduceType(NULL, tspec, ¶meters, &dedtypes); if (m == MATCHnomatch || (m != MATCHexact && tok == TOKequal)) inc = 2; diff -uNr dmd-0.148/dmd/src/dmd/dsymbol.c dmd-0.149/dmd/src/dmd/dsymbol.c --- dmd-0.148/dmd/src/dmd/dsymbol.c 2006-02-11 00:43:52.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/dsymbol.c 2006-02-27 22:32:04.000000000 +0100 @@ -87,6 +87,7 @@ int Dsymbol::oneMember(Dsymbol **ps) { + //printf("Dsymbol::oneMember()\n"); *ps = this; return TRUE; } @@ -97,7 +98,7 @@ int Dsymbol::oneMembers(Array *members, Dsymbol **ps) { - //printf("Dsymbol::oneMembers()\n"); + //printf("Dsymbol::oneMembers() %d\n", members ? members->dim : 0); Dsymbol *s = NULL; if (members) @@ -315,8 +316,9 @@ return FALSE; } -void Dsymbol::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) +int Dsymbol::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) { + //printf("Dsymbol::addMember('%s')\n", toChars()); //printf("Dsymbol::addMember(this = %p, '%s' scopesym = '%s')\n", this, toChars(), sd->toChars()); //printf("Dsymbol::addMember(this = %p, '%s' sd = %p, sd->symtab = %p)\n", this, toChars(), sd, sd->symtab); parent = sd; @@ -337,7 +339,9 @@ if (ident == Id::__sizeof || ident == Id::alignof || ident == Id::mangleof) error(".%s property cannot be redefined", ident->toChars()); } + return 1; } + return 0; } void Dsymbol::error(const char *format, ...) diff -uNr dmd-0.148/dmd/src/dmd/dsymbol.h dmd-0.149/dmd/src/dmd/dsymbol.h --- dmd-0.148/dmd/src/dmd/dsymbol.h 2006-02-12 22:06:20.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/dsymbol.h 2006-02-27 22:26:16.000000000 +0100 @@ -112,7 +112,7 @@ virtual char *kind(); virtual Dsymbol *toAlias(); // resolve real symbol - virtual void addMember(Scope *sc, ScopeDsymbol *s, int memnum); + virtual int addMember(Scope *sc, ScopeDsymbol *s, int memnum); virtual void semantic(Scope *sc); virtual void semantic2(Scope *sc); virtual void semantic3(Scope *sc); diff -uNr dmd-0.148/dmd/src/dmd/expression.c dmd-0.149/dmd/src/dmd/expression.c --- dmd-0.148/dmd/src/dmd/expression.c 2006-02-25 10:44:00.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/expression.c 2006-03-06 21:00:38.000000000 +0100 @@ -258,7 +258,7 @@ * Perform semantic() on an array of Expressions. */ -void arrayExpressionSemantic(Array *a, Scope *sc) +void arrayExpressionSemantic(Expressions *a, Scope *sc) { if (a) { @@ -275,7 +275,7 @@ * Preprocess arguments to function. */ -void preFunctionArguments(Loc loc, Scope *sc, Array *arguments) +void preFunctionArguments(Loc loc, Scope *sc, Expressions *arguments) { if (arguments) { @@ -318,7 +318,7 @@ * 4) add hidden _arguments[] argument */ -void functionArguments(Loc loc, Scope *sc, TypeFunction *tf, Array *arguments) +void functionArguments(Loc loc, Scope *sc, TypeFunction *tf, Expressions *arguments) { unsigned nargs; unsigned nproto; @@ -425,7 +425,7 @@ { /* Set arg to be: * new Tclass(arg0, arg1, ..., argn) */ - Array *args = new Array(); + Expressions *args = new Expressions(); args->setDim(nargs - i); for (int u = i; u < nargs; u++) args->data[u - i] = arguments->data[u]; @@ -534,7 +534,7 @@ * Write out argument list to buf. */ -void argsToCBuffer(OutBuffer *buf, Array *arguments, HdrGenState *hgs) +void argsToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs) { int i; if (arguments) @@ -549,6 +549,27 @@ } } +/************************************************** + * Write out argument types to buf. + */ + +void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs) +{ + if (arguments) + { OutBuffer argbuf; + + for (size_t i = 0; i < arguments->dim; i++) + { Expression *arg = (Expression *)arguments->data[i]; + + if (i) + buf->writeByte(','); + argbuf.reset(); + arg->type->toCBuffer2(&argbuf, NULL, hgs); + buf->write(&argbuf); + } + } +} + /******************************** Expression **************************/ Expression::Expression(Loc loc, enum TOK op, int size) @@ -740,6 +761,12 @@ error("'%s' is not a scalar, it is a %s", toChars(), type->toChars()); } +void Expression::checkNoBool() +{ + if (type->toBasetype()->ty == Tbool) + error("operation not allowed on bool '%s'", toChars()); +} + Expression *Expression::checkIntegral() { if (!type->isintegral()) @@ -864,12 +891,12 @@ return FALSE; } -Array *Expression::arraySyntaxCopy(Array *exps) -{ Array *a = NULL; +Expressions *Expression::arraySyntaxCopy(Expressions *exps) +{ Expressions *a = NULL; if (exps) { - a = new Array(); + a = new Expressions(); a->setDim(exps->dim); for (int i = 0; i < a->dim; i++) { Expression *e = (Expression *)exps->data[i]; @@ -1059,7 +1086,7 @@ break; } case Tchar: - if (isprint(v)) + if (isprint(v) && v != '\\') buf->printf("'%c'", (int)v); else buf->printf("'\\x%02x'", (int)v); @@ -1653,6 +1680,14 @@ return e; } + TemplateDeclaration *td = s->isTemplateDeclaration(); + if (td) + { + e = new TemplateExp(loc, td); + e = e->semantic(sc); + return e; + } + error("%s '%s' is not a variable", s->kind(), s->toChars()); type = Type::terror; return this; @@ -2260,9 +2295,25 @@ } } +/********************** TemplateExp **************************************/ + +// Mainly just a placeholder + +TemplateExp::TemplateExp(Loc loc, TemplateDeclaration *td) + : Expression(loc, TOKtemplate, sizeof(TemplateExp)) +{ + //printf("TemplateExp(): %s\n", td->toChars()); + this->td = td; +} + +void TemplateExp::toCBuffer(OutBuffer *buf, HdrGenState *hgs) +{ + buf->writestring(td->toChars()); +} + /********************** NewExp **************************************/ -NewExp::NewExp(Loc loc, Array *newargs, Type *newtype, Array *arguments) +NewExp::NewExp(Loc loc, Expressions *newargs, Type *newtype, Expressions *arguments) : Expression(loc, TOKnew, sizeof(NewExp)) { this->newargs = newargs; @@ -2339,7 +2390,7 @@ type = tf->next; if (!arguments) - arguments = new Array(); + arguments = new Expressions(); functionArguments(loc, sc, tf, arguments); } else @@ -2356,7 +2407,7 @@ // Prepend the uint size argument to newargs[] e = new IntegerExp(loc, cd->size(loc), Type::tuns32); if (!newargs) - newargs = new Array(); + newargs = new Expressions(); newargs->shift(e); f = f->overloadResolve(loc, newargs); @@ -2390,7 +2441,7 @@ // Prepend the uint size argument to newargs[] e = new IntegerExp(loc, sd->size(loc), Type::tuns32); if (!newargs) - newargs = new Array(); + newargs = new Expressions(); newargs->shift(e); f = f->overloadResolve(loc, newargs); @@ -2463,7 +2514,7 @@ /********************** NewAnonClassExp **************************************/ -NewAnonClassExp::NewAnonClassExp(Loc loc, Array *newargs, ClassDeclaration *cd, Array *arguments) +NewAnonClassExp::NewAnonClassExp(Loc loc, Expressions *newargs, ClassDeclaration *cd, Expressions *arguments) : Expression(loc, TOKnewanonclass, sizeof(NewAnonClassExp)) { this->newargs = newargs; @@ -3026,7 +3077,7 @@ dedtypes.setDim(1); dedtypes.data[0] = NULL; - m = targ->deduceType(tspec, ¶meters, &dedtypes); + m = targ->deduceType(NULL, tspec, ¶meters, &dedtypes); if (m == MATCHnomatch || (m != MATCHexact && tok == TOKequal)) goto Lno; @@ -3197,6 +3248,10 @@ e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); type = e1->type; + if (type->toBasetype()->ty == Tbool) + { + error("operator not allowed on bool expression %s", toChars()); + } typeCombine(); e1->checkArithmetic(); e2->checkArithmetic(); @@ -3224,6 +3279,11 @@ e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); type = e1->type; + if (type->toBasetype()->ty == Tbool) + { + e2 = e2->implicitCastTo(type); + } + typeCombine(); e1->checkIntegral(); e2->checkIntegral(); @@ -3833,7 +3893,7 @@ /************************************************************/ -CallExp::CallExp(Loc loc, Expression *e, Array *arguments) +CallExp::CallExp(Loc loc, Expression *e, Expressions *arguments) : UnaExp(loc, TOKcall, sizeof(CallExp), e) { this->arguments = arguments; @@ -3848,7 +3908,7 @@ CallExp::CallExp(Loc loc, Expression *e, Expression *earg1) : UnaExp(loc, TOKcall, sizeof(CallExp), e) { - Array *arguments = new Array(); + Expressions *arguments = new Expressions(); arguments->setDim(1); arguments->data[0] = (void *)earg1; @@ -3858,7 +3918,7 @@ CallExp::CallExp(Loc loc, Expression *e, Expression *earg1, Expression *earg2) : UnaExp(loc, TOKcall, sizeof(CallExp), e) { - Array *arguments = new Array(); + Expressions *arguments = new Expressions(); arguments->setDim(2); arguments->data[0] = (void *)earg1; arguments->data[1] = (void *)earg2; @@ -3885,12 +3945,12 @@ if (type) return this; // semantic() already run #if 0 -if (arguments && arguments->dim) -{ - Expression *earg = (Expression *)arguments->data[0]; - earg->print(); - if (earg->type) earg->type->print(); -} + if (arguments && arguments->dim) + { + Expression *earg = (Expression *)arguments->data[0]; + earg->print(); + if (earg->type) earg->type->print(); + } #endif /* Transform: @@ -3927,7 +3987,7 @@ else if (e1ty == Tarray || e1ty == Tsarray || e1ty == Taarray) { if (!arguments) - arguments = new Array(); + arguments = new Expressions(); arguments->shift(dotid->e1); e1 = new IdentifierExp(dotid->loc, dotid->ident); } @@ -4163,6 +4223,17 @@ e->type = t1; e1 = e; } + else if (e1->op == TOKtemplate) + { + TemplateExp *te = (TemplateExp *)e1; + f = te->td->deduce(sc, loc, NULL, arguments); + if (!f) + { type = Type::terror; + return this; + } + e1 = new VarExp(loc, f); + goto Lagain; + } else { error("function expected before (), not %s of type %s", e1->toChars(), e1->type->toChars()); type = Type::terror; @@ -4200,7 +4271,7 @@ type = tf->next; if (!arguments) - arguments = new Array(); + arguments = new Expressions(); functionArguments(loc, sc, tf, arguments); assert(type); @@ -4377,6 +4448,7 @@ if (e) return e; + e1->checkNoBool(); e1->checkArithmetic(); type = e1->type; } @@ -4402,6 +4474,7 @@ e = op_overload(sc); if (e) return e; + e1->checkNoBool(); e1->checkArithmetic(); return e1; } @@ -4424,6 +4497,7 @@ if (e) return e; + e1->checkNoBool(); e1 = e1->checkIntegral(); type = e1->type; } @@ -4810,7 +4884,7 @@ // e1 [ i1, i2, i3, ... ] -ArrayExp::ArrayExp(Loc loc, Expression *e1, Array *args) +ArrayExp::ArrayExp(Loc loc, Expression *e1, Expressions *args) : UnaExp(loc, TOKarray, sizeof(ArrayExp), e1) { arguments = args; @@ -5084,6 +5158,7 @@ e = this; e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); + e1->checkNoBool(); if (e1->type->ty == Tpointer) e = scaleFactor(); else @@ -5120,6 +5195,7 @@ e = this; e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); + e1->checkNoBool(); if (e1->type->ty == Tpointer) e = scaleFactor(); else @@ -5151,8 +5227,8 @@ #endif //printf("e1->op = %d, '%s'\n", e1->op, Token::toChars(e1->op)); - /* Look for operator overloading of a[]=value. - * Do it before semantic() otherwise the a[] will have been + /* Look for operator overloading of a[i]=value. + * Do it before semantic() otherwise the a[i] will have been * converted to a.opIndex() already. */ if (e1->op == TOKarray) @@ -5177,7 +5253,7 @@ fd = search_function(ad, Id::indexass); if (fd) { Expression *e = new DotIdExp(loc, ae->e1, Id::indexass); - Array *a = ae->arguments->copy(); + Expressions *a = ae->arguments->copy(); a->insert(0, e2); e = new CallExp(loc, e, a); @@ -5201,6 +5277,48 @@ } } } + /* Look for operator overloading of a[i..j]=value. + * Do it before semantic() otherwise the a[i..j] will have been + * converted to a.opSlice() already. + */ + if (e1->op == TOKslice) + { Type *t1; + SliceExp *ae = (SliceExp *)e1; + AggregateDeclaration *ad; + Identifier *id = Id::index; + FuncDeclaration *fd; + + ae->e1 = ae->e1->semantic(sc); + t1 = ae->e1->type->toBasetype(); + if (t1->ty == Tstruct) + { + ad = ((TypeStruct *)t1)->sym; + goto L2; + } + else if (t1->ty == Tclass) + { + ad = ((TypeClass *)t1)->sym; + L2: + // Rewrite (a[i..j] = value) to (a.opIndexAssign(value, i, j)) + fd = search_function(ad, Id::sliceass); + if (fd) + { Expression *e = new DotIdExp(loc, ae->e1, Id::sliceass); + Expressions *a = new Expressions(); + + a->push(e2); + if (ae->lwr) + { a->push(ae->lwr); + assert(ae->upr); + a->push(ae->upr); + } + else + assert(!ae->upr); + e = new CallExp(loc, e, a); + e = e->semantic(sc); + return e; + } + } + } BinExp::semantic(sc); e2 = resolveProperties(sc, e2); @@ -5307,6 +5425,7 @@ else { e1->checkScalar(); + e1->checkNoBool(); if (tb1->ty == Tpointer && tb2->isintegral()) e = scaleFactor(); else if (tb1->ty == Tbit || tb1->ty == Tbool) @@ -5392,6 +5511,7 @@ e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); + e1->checkNoBool(); if (e1->type->ty == Tpointer && e2->type->isintegral()) e = scaleFactor(); else @@ -5485,6 +5605,7 @@ e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); + e1->checkNoBool(); type = e1->type; typeCombine(); e1->checkArithmetic(); @@ -5540,6 +5661,7 @@ e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); + e1->checkNoBool(); type = e1->type; typeCombine(); e1->checkArithmetic(); @@ -5610,6 +5732,7 @@ e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); + e1->checkNoBool(); type = e1->type; typeCombine(); e1->checkIntegral(); @@ -5637,6 +5760,7 @@ e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); + e1->checkNoBool(); type = e1->type; typeCombine(); e1->checkIntegral(); @@ -5664,6 +5788,7 @@ e1 = e1->modifiableLvalue(sc, NULL); e1->checkScalar(); + e1->checkNoBool(); type = e1->type; typeCombine(); e1->checkIntegral(); @@ -6195,9 +6320,18 @@ e = op_overload(sc); if (e) return e; - typeCombine(); - e1->checkIntegral(); - e2->checkIntegral(); + if (e1->type->toBasetype()->ty == Tbool && + e2->type->toBasetype()->ty == Tbool) + { + type = e1->type; + e = this; + } + else + { + typeCombine(); + e1->checkIntegral(); + e2->checkIntegral(); + } } return this; } @@ -6217,9 +6351,18 @@ e = op_overload(sc); if (e) return e; - typeCombine(); - e1->checkIntegral(); - e2->checkIntegral(); + if (e1->type->toBasetype()->ty == Tbool && + e2->type->toBasetype()->ty == Tbool) + { + type = e1->type; + e = this; + } + else + { + typeCombine(); + e1->checkIntegral(); + e2->checkIntegral(); + } } return this; } @@ -6239,9 +6382,18 @@ e = op_overload(sc); if (e) return e; - typeCombine(); - e1->checkIntegral(); - e2->checkIntegral(); + if (e1->type->toBasetype()->ty == Tbool && + e2->type->toBasetype()->ty == Tbool) + { + type = e1->type; + e = this; + } + else + { + typeCombine(); + e1->checkIntegral(); + e2->checkIntegral(); + } } return this; } diff -uNr dmd-0.148/dmd/src/dmd/expression.h dmd-0.149/dmd/src/dmd/expression.h --- dmd-0.148/dmd/src/dmd/expression.h 2006-02-19 01:32:18.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/expression.h 2006-03-06 20:54:38.000000000 +0100 @@ -1,5 +1,5 @@ -// Copyright (c) 1999-2005 by Digital Mars +// Copyright (c) 1999-2006 by Digital Mars // All Rights Reserved // written by Walter Bright // www.digitalmars.com @@ -33,6 +33,7 @@ struct Declaration; struct AggregateDeclaration; struct TemplateInstance; +struct TemplateDeclaration; struct ClassDeclaration; struct HdrGenState; struct BinExp; @@ -41,6 +42,8 @@ struct IRState; struct dt_t; +typedef Array Expressions; + #ifdef IN_GCC union tree_node; typedef union tree_node elem; #else @@ -53,6 +56,7 @@ void accessCheck(Loc loc, Scope *sc, Expression *e, Declaration *d); FuncDeclaration *search_function(AggregateDeclaration *ad, Identifier *funcid); void inferApplyArgTypes(Array *arguments, Type *taggr); +void argExpTypesToCBuffer(OutBuffer *buf, Expressions *arguments, HdrGenState *hgs); struct Expression : Object { @@ -75,7 +79,7 @@ void rvalue(); static Expression *combine(Expression *e1, Expression *e2); - static Array *arraySyntaxCopy(Array *exps); + static Expressions *arraySyntaxCopy(Expressions *exps); virtual integer_t toInteger(); virtual uinteger_t toUInteger(); @@ -91,6 +95,7 @@ virtual Expression *castTo(Type *t); virtual void checkEscape(); void checkScalar(); + void checkNoBool(); Expression *checkIntegral(); void checkArithmetic(); void checkDeprecated(Scope *sc, Dsymbol *s); @@ -317,15 +322,23 @@ void toCBuffer(OutBuffer *buf, HdrGenState *hgs); }; +struct TemplateExp : Expression +{ + TemplateDeclaration *td; + + TemplateExp(Loc loc, TemplateDeclaration *td); + void toCBuffer(OutBuffer *buf, HdrGenState *hgs); +}; + struct NewExp : Expression { Type *newtype; - Array *newargs; // Array of Expression's to call new operator - Array *arguments; // Array of Expression's + Expressions *newargs; // Array of Expression's to call new operator + Expressions *arguments; // Array of Expression's CtorDeclaration *member; // constructor function NewDeclaration *allocator; // allocator function - NewExp(Loc loc, Array *newargs, Type *newtype, Array *arguments); + NewExp(Loc loc, Expressions *newargs, Type *newtype, Expressions *arguments); Expression *syntaxCopy(); Expression *semantic(Scope *sc); elem *toElem(IRState *irs); @@ -339,11 +352,11 @@ struct NewAnonClassExp : Expression { - Array *newargs; // Array of Expression's to call new operator - Array *arguments; // Array of Expression's to call class constructor + Expressions *newargs; // Array of Expression's to call new operator + Expressions *arguments; // Array of Expression's to call class constructor ClassDeclaration *cd; // class being instantiated - NewAnonClassExp(Loc loc, Array *newargs, ClassDeclaration *cd, Array *arguments); + NewAnonClassExp(Loc loc, Expressions *newargs, ClassDeclaration *cd, Expressions *arguments); Expression *syntaxCopy(); Expression *semantic(Scope *sc); void checkSideEffect(int flag); @@ -594,9 +607,9 @@ struct CallExp : UnaExp { - Array *arguments; // Array of Expression's + Expressions *arguments; // Array of Expression's - CallExp(Loc loc, Expression *e, Array *arguments); + CallExp(Loc loc, Expression *e, Expressions *arguments); CallExp(Loc loc, Expression *e); CallExp(Loc loc, Expression *e, Expression *earg1); CallExp(Loc loc, Expression *e, Expression *earg1, Expression *earg2); @@ -748,9 +761,9 @@ struct ArrayExp : UnaExp { - Array *arguments; // Array of Expression's + Expressions *arguments; // Array of Expression's - ArrayExp(Loc loc, Expression *e1, Array *arguments); + ArrayExp(Loc loc, Expression *e1, Expressions *arguments); Expression *syntaxCopy(); Expression *semantic(Scope *sc); Expression *toLvalue(Expression *e); diff -uNr dmd-0.148/dmd/src/dmd/func.c dmd-0.149/dmd/src/dmd/func.c --- dmd-0.148/dmd/src/dmd/func.c 2006-02-20 20:06:28.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/func.c 2006-03-01 11:09:14.000000000 +0100 @@ -1142,21 +1142,10 @@ OutBuffer buf; if (arguments) - { int i; - OutBuffer argbuf; + { HdrGenState hgs; - for (i = 0; i < arguments->dim; i++) - { Expression *arg; - - arg = (Expression *)arguments->data[i]; - argbuf.reset(); - assert(arg->type); - arg->type->toCBuffer2(&argbuf, NULL, &hgs); - if (i) - buf.writeByte(','); - buf.write(&argbuf); - } + argExpTypesToCBuffer(&buf, arguments, &hgs); } if (m.last == MATCHnomatch) diff -uNr dmd-0.148/dmd/src/dmd/idgen.c dmd-0.149/dmd/src/dmd/idgen.c --- dmd-0.148/dmd/src/dmd/idgen.c 2006-02-14 23:08:20.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/idgen.c 2006-03-06 17:11:24.000000000 +0100 @@ -55,7 +55,6 @@ { "classinfo" }, { "typeinfo" }, { "Exception" }, - { "_Match" }, { "withSym", "__withSym" }, { "result", "__result" }, { "returnLabel", "__returnLabel" }, @@ -103,6 +102,10 @@ { "Windows" }, { "Pascal" }, + { "exit" }, + { "success" }, + { "failure" }, + { "keys" }, { "values" }, { "rehash" }, @@ -165,6 +168,7 @@ { "index", "opIndex" }, { "indexass", "opIndexAssign" }, { "slice", "opSlice" }, + { "sliceass", "opSliceAssign" }, { "call", "opCall" }, { "cast", "opCast" }, { "match", "opMatch" }, diff -uNr dmd-0.148/dmd/src/dmd/lexer.c dmd-0.149/dmd/src/dmd/lexer.c --- dmd-0.148/dmd/src/dmd/lexer.c 2006-02-22 23:42:12.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/lexer.c 2006-03-03 22:16:46.000000000 +0100 @@ -2475,6 +2475,7 @@ { "with", TOKwith }, { "asm", TOKasm }, { "foreach", TOKforeach }, + { "scope", TOKscope }, { "on_scope_exit", TOKon_scope_exit }, { "on_scope_failure", TOKon_scope_failure }, { "on_scope_success", TOKon_scope_success }, diff -uNr dmd-0.148/dmd/src/dmd/lexer.h dmd-0.149/dmd/src/dmd/lexer.h --- dmd-0.148/dmd/src/dmd/lexer.h 2006-02-20 20:34:46.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/lexer.h 2006-03-03 22:16:20.000000000 +0100 @@ -134,6 +134,7 @@ TOKcase, TOKdefault, TOKbreak, TOKcontinue, TOKwith, TOKsynchronized, TOKreturn, TOKgoto, TOKtry, TOKcatch, TOKfinally, TOKasm, TOKforeach, + TOKscope, TOKon_scope_exit, TOKon_scope_failure, TOKon_scope_success, // Contracts diff -uNr dmd-0.148/dmd/src/dmd/mars.c dmd-0.149/dmd/src/dmd/mars.c --- dmd-0.148/dmd/src/dmd/mars.c 2006-02-23 00:00:58.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/mars.c 2006-02-27 21:27:46.000000000 +0100 @@ -53,7 +53,7 @@ copyright = "Copyright (c) 1999-2006 by Digital Mars"; written = "written by Walter Bright"; - version = "v0.148"; + version = "v0.149"; global.structalign = 8; memset(¶ms, 0, sizeof(Param)); diff -uNr dmd-0.148/dmd/src/dmd/mtype.c dmd-0.149/dmd/src/dmd/mtype.c --- dmd-0.148/dmd/src/dmd/mtype.c 2006-02-25 17:38:40.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/mtype.c 2006-03-05 01:07:40.000000000 +0100 @@ -772,8 +772,8 @@ flags |= TFLAGSintegral | TFLAGSunsigned; break; - case Tbool: d = Token::toChars(TOKbool); - c = "bool"; + case Tbool: d = "bool"; + c = d; flags |= TFLAGSintegral | TFLAGSunsigned; break; @@ -1334,7 +1334,7 @@ return MATCHnomatch; if (ty == Tvoid /*|| to->ty == Tvoid*/) return MATCHnomatch; - if (to->ty == Tbit) + if (to->ty == Tbit || to->ty == Tbool) return MATCHnomatch; TypeBasic *tob = (TypeBasic *)to; if (flags & TFLAGSintegral) diff -uNr dmd-0.148/dmd/src/dmd/mtype.h dmd-0.149/dmd/src/dmd/mtype.h --- dmd-0.148/dmd/src/dmd/mtype.h 2006-02-22 23:42:42.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/mtype.h 2006-03-03 01:33:26.000000000 +0100 @@ -224,7 +224,7 @@ virtual int isZeroInit(); // if initializer is 0 virtual dt_t **toDt(dt_t **pdt); Identifier *getTypeInfoIdent(int internal); - virtual MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + virtual MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); virtual void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); Expression *getInternalTypeInfo(Scope *sc); Expression *getTypeInfo(Scope *sc); @@ -301,7 +301,7 @@ int implicitConvTo(Type *to); Expression *defaultInit(); dt_t **toDt(dt_t **pdt); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); TypeInfoDeclaration *getTypeInfoDeclaration(); type *toCtype(); @@ -343,7 +343,7 @@ void toPrettyBracket(OutBuffer *buf, HdrGenState *hgs); Expression *dotExp(Scope *sc, Expression *e, Identifier *ident); Expression *defaultInit(); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); int checkBoolean(); TypeInfoDeclaration *getTypeInfoDeclaration(); @@ -398,7 +398,7 @@ Type *semantic(Loc loc, Scope *sc); void toDecoBuffer(OutBuffer *buf); void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); TypeInfoDeclaration *getTypeInfoDeclaration(); int callMatch(Array *toargs); @@ -449,7 +449,7 @@ void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); Dsymbol *toDsymbol(Scope *sc); Type *semantic(Loc loc, Scope *sc); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); }; /* Similar to TypeIdentifier, but with a TemplateInstance as the root @@ -465,7 +465,7 @@ void toCBuffer2(OutBuffer *buf, Identifier *ident, HdrGenState *hgs); void resolve(Loc loc, Scope *sc, Expression **pe, Type **pt, Dsymbol **ps); Type *semantic(Loc loc, Scope *sc); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); }; struct TypeTypeof : TypeQualified @@ -500,7 +500,7 @@ int isZeroInit(); int checkBoolean(); dt_t **toDt(dt_t **pdt); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); TypeInfoDeclaration *getTypeInfoDeclaration(); type *toCtype(); @@ -529,7 +529,7 @@ Type *toBasetype(); Expression *defaultInit(); int isZeroInit(); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); TypeInfoDeclaration *getTypeInfoDeclaration(); type *toCtype(); @@ -564,7 +564,7 @@ Expression *defaultInit(); int isZeroInit(); dt_t **toDt(dt_t **pdt); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); TypeInfoDeclaration *getTypeInfoDeclaration(); type *toCtype(); @@ -589,7 +589,7 @@ int implicitConvTo(Type *to); Expression *defaultInit(); int isZeroInit(); - MATCH deduceType(Type *tparam, Array *parameters, Array *atypes); + MATCH deduceType(Scope *sc, Type *tparam, Array *parameters, Array *atypes); int isauto(); int checkBoolean(); TypeInfoDeclaration *getTypeInfoDeclaration(); diff -uNr dmd-0.148/dmd/src/dmd/parse.c dmd-0.149/dmd/src/dmd/parse.c --- dmd-0.148/dmd/src/dmd/parse.c 2006-02-24 01:15:58.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/parse.c 2006-03-05 10:55:42.000000000 +0100 @@ -184,7 +184,7 @@ case TOKtypeof: case TOKdot: Ldeclaration: - a = parseDeclaration(); + a = parseDeclarations(); decldefs->append(a); continue; @@ -939,6 +939,7 @@ return arguments; } + /************************************* */ @@ -1925,7 +1926,7 @@ * Return array of Declaration *'s. */ -Array *Parser::parseDeclaration() +Array *Parser::parseDeclarations() { enum STC storage_class; enum STC stc; @@ -1938,7 +1939,7 @@ unsigned char *comment = token.blockComment; enum LINK link = linkage; - //printf("parseDeclaration()\n"); + //printf("parseDeclarations()\n"); switch (token.value) { case TOKtypedef: @@ -2477,7 +2478,7 @@ Ldeclaration: { Array *a; - a = parseDeclaration(); + a = parseDeclarations(); if (a->dim > 1) { Array *as = new Array(); @@ -2686,8 +2687,42 @@ nextToken(); check(TOKlparen); + if (token.value == TOKauto) + { + nextToken(); + if (token.value == TOKidentifier) + { + Token *t = peek(&token); + if (t->value == TOKassign) + { + arg = new Argument(In, NULL, token.ident, NULL); + nextToken(); + nextToken(); + } + else + { error("= expected following auto identifier"); + goto Lerror; + } + } + else + { error("identifier expected following auto"); + goto Lerror; + } + } + else if (isDeclaration(&token, 2, TOKassign, NULL)) + { + Type *tb; + Type *at; + Identifier *ai; + + tb = parseBasicType(); + at = parseDeclarator(tb, &ai); + check(TOKassign); + arg = new Argument(In, at, ai, NULL); + } + // Check for " ident;" - if (token.value == TOKidentifier) + else if (token.value == TOKidentifier) { Token *t = peek(&token); if (t->value == TOKcomma || t->value == TOKsemicolon) @@ -2695,6 +2730,8 @@ arg = new Argument(In, NULL, token.ident, NULL); nextToken(); nextToken(); + if (!global.params.useDeprecated) + error("if (v; e) is deprecated, use if (auto v = e)"); } } @@ -2712,10 +2749,39 @@ break; } + case TOKscope: + nextToken(); + check(TOKlparen); + if (token.value != TOKidentifier) + { error("scope identifier expected"); + goto Lerror; + } + else + { TOK t = TOKon_scope_exit; + Identifier *id = token.ident; + + if (id == Id::exit) + t = TOKon_scope_exit; + else if (id == Id::failure) + t = TOKon_scope_failure; + else if (id == Id::success) + t = TOKon_scope_success; + else + error("valid scope identifiers are exit, failure, or success, not %s", id->toChars()); + nextToken(); + check(TOKrparen); + Statement *st = parseStatement(PScurlyscope); + s = new OnScopeStatement(loc, t, st); + break; + } + case TOKon_scope_exit: case TOKon_scope_failure: case TOKon_scope_success: - { TOK t = token.value; + { + TOK t = token.value; + if (!global.params.useDeprecated) + error("%s is deprecated, use scope", token.toChars()); nextToken(); Statement *st = parseStatement(PScurlyscope); s = new OnScopeStatement(loc, t, st); diff -uNr dmd-0.148/dmd/src/dmd/parse.h dmd-0.149/dmd/src/dmd/parse.h --- dmd-0.148/dmd/src/dmd/parse.h 2005-10-20 22:54:56.000000000 +0200 +++ dmd-0.149/dmd/src/dmd/parse.h 2006-03-04 16:15:26.000000000 +0100 @@ -79,7 +79,7 @@ Type *parseBasicType(); Type *parseBasicType2(Type *t); Type *parseDeclarator(Type *t, Identifier **pident); - Array *parseDeclaration(); + Array *parseDeclarations(); void parseContracts(FuncDeclaration *f); Statement *parseStatement(int flags); Initializer *parseInitializer(); diff -uNr dmd-0.148/dmd/src/dmd/statement.c dmd-0.149/dmd/src/dmd/statement.c --- dmd-0.148/dmd/src/dmd/statement.c 2006-02-22 12:13:50.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/statement.c 2006-03-07 11:02:26.000000000 +0100 @@ -142,16 +142,16 @@ * a Statement. * Output: * *sentry code executed upon entry to the scope - * *sexit code executed upon exit from the scope + * *sexception code executed upon exit from the scope via exception * *sfinally code executed in finally block */ -void Statement::scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally) +void Statement::scopeCode(Statement **sentry, Statement **sexception, Statement **sfinally) { //printf("Statement::scopeCode()\n"); //print(); *sentry = NULL; - *sexit = NULL; + *sexception = NULL; *sfinally = NULL; } @@ -229,13 +229,13 @@ return ds; } -void DeclarationStatement::scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally) +void DeclarationStatement::scopeCode(Statement **sentry, Statement **sexception, Statement **sfinally) { //printf("DeclarationStatement::scopeCode()\n"); //print(); *sentry = NULL; - *sexit = NULL; + *sexception = NULL; *sfinally = NULL; if (exp) @@ -266,7 +266,7 @@ /******************************** CompoundStatement ***************************/ -CompoundStatement::CompoundStatement(Loc loc, Array *s) +CompoundStatement::CompoundStatement(Loc loc, Statements *s) : Statement(loc) { statements = s; @@ -275,7 +275,7 @@ CompoundStatement::CompoundStatement(Loc loc, Statement *s1, Statement *s2) : Statement(loc) { - statements = new Array(); + statements = new Statements(); statements->reserve(2); statements->push(s1); statements->push(s2); @@ -283,9 +283,9 @@ Statement *CompoundStatement::syntaxCopy() { - Array *a = new Array(); + Statements *a = new Statements(); a->setDim(statements->dim); - for (int i = 0; i < statements->dim; i++) + for (size_t i = 0; i < statements->dim; i++) { Statement *s = (Statement *)statements->data[i]; if (s) s = s->syntaxCopy(); @@ -304,12 +304,12 @@ /* Start by flattening it */ - for (int i = 0; i < statements->dim; i++) + for (size_t i = 0; i < statements->dim; i++) { L1: s = (Statement *) statements->data[i]; if (s) - { Array *a = s->flatten(); + { Statements *a = s->flatten(); if (a) { @@ -322,7 +322,7 @@ } } - for (int i = 0; i < statements->dim; i++) + for (size_t i = 0; i < statements->dim; i++) { s = (Statement *) statements->data[i]; if (s) @@ -332,30 +332,36 @@ if (s) { Statement *sentry; - Statement *sexit; + Statement *sexception; Statement *sfinally; - s->scopeCode(&sentry, &sexit, &sfinally); + s->scopeCode(&sentry, &sexception, &sfinally); if (sentry) { sentry = sentry->semantic(sc); statements->data[i] = sentry; } - if (sexit && !sfinally) + if (sexception) { if (i + 1 == statements->dim) { - statements->push(sexit); + statements->push(sexception); + if (sfinally) + // Assume sexception does not throw + statements->push(sfinally); } else { /* Rewrite: * s; s1; s2; * As: - * s; { s1; s2; } sexit; + * s; + * try { s1; s2; } + * catch (Object __o) + * { sexception; throw __o; } */ Statement *body; - Array *a = new Array(); + Statements *a = new Statements(); for (int j = i + 1; j < statements->dim; j++) { @@ -363,14 +369,29 @@ } body = new CompoundStatement(0, a); body = new ScopeStatement(0, body); - s = new CompoundStatement(0, body, sexit); + + char name[3 + sizeof(int) * 3 + 1]; + static int num; + sprintf(name, "__o%d", ++num); + Identifier *id = Lexer::idPool(name); + + Statement *handler = new ThrowStatement(0, new IdentifierExp(0, id)); + handler = new CompoundStatement(0, sexception, handler); + + Array *catches = new Array(); + Catch *ctch = new Catch(0, NULL, id, handler); + catches->push(ctch); + s = new TryCatchStatement(0, body, catches); + + if (sfinally) + s = new TryFinallyStatement(0, s, sfinally); s = s->semantic(sc); statements->data[i + 1] = s; statements->setDim(i + 2); break; } } - else if (!sexit && sfinally) + else if (sfinally) { if (i + 1 == statements->dim) { @@ -398,38 +419,6 @@ break; } } - else if (sexit && sfinally) - { - if (i + 1 == statements->dim) - { /* Assume sexit cannot throw an exception - */ - statements->push(sexit); - statements->push(sfinally); - } - else - { - /* Rewrite: - * s; s1; s2; - * As: - * s; try { { s1; s2; } sexit; } finally { sfinally; } - */ - Statement *body; - Array *a = new Array(); - - for (int j = i + 1; j < statements->dim; j++) - { - a->push(statements->data[j]); - } - body = new CompoundStatement(0, a); - body = new ScopeStatement(0, body); - body = new CompoundStatement(0, body, sexit); - s = new TryFinallyStatement(0, body, sfinally); - s = s->semantic(sc); - statements->data[i + 1] = s; - statements->setDim(i + 2); - break; - } - } } } } @@ -545,10 +534,10 @@ if (statement) { Statement *sentry; - Statement *sexit; + Statement *sexception; Statement *sfinally; - statement->scopeCode(&sentry, &sexit, &sfinally); + statement->scopeCode(&sentry, &sexception, &sfinally); if (sfinally) { //printf("adding sfinally\n"); @@ -585,7 +574,6 @@ { condition = c; body = b; - match = NULL; } Statement *WhileStatement::syntaxCopy() @@ -691,9 +679,7 @@ condition = condition->semantic(sc); condition = resolveProperties(sc, condition); - // Only check boolean if it's not _Match -// if (!condition->type->equals(StructDeclaration::match->type)) - condition = condition->checkToBoolean(); + condition = condition->checkToBoolean(); return this; } @@ -1284,7 +1270,8 @@ sym->parent = sc->scopesym; scd = sc->push(sym); - match = new VarDeclaration(loc, condition->type, arg->ident, NULL); + Type *t = arg->type ? arg->type : condition->type; + match = new VarDeclaration(loc, t, arg->ident, NULL); match->noauto = 1; match->semantic(scd); if (!scd->insert(match)) @@ -2715,12 +2702,12 @@ return (tok != TOKon_scope_success); } -void OnScopeStatement::scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally) +void OnScopeStatement::scopeCode(Statement **sentry, Statement **sexception, Statement **sfinally) { //printf("OnScopeStatement::scopeCode()\n"); //print(); *sentry = NULL; - *sexit = NULL; + *sexception = NULL; *sfinally = NULL; switch (tok) { @@ -2729,10 +2716,14 @@ break; case TOKon_scope_failure: + *sexception = statement; + break; + + case TOKon_scope_success: { /* Create: * sentry: int x = 0; - * sexit: x = 1; + * sexception: x = 1; * sfinally: if (!x) statement; */ char name[5 + sizeof(int) * 3 + 1]; @@ -2746,7 +2737,7 @@ Expression *e = new IntegerExp(1); e = new AssignExp(0, new VarExp(0, v), e); - *sexit = new ExpStatement(0, e); + *sexception = new ExpStatement(0, e); e = new VarExp(0, v); e = new NotExp(0, e); @@ -2755,10 +2746,6 @@ break; } - case TOKon_scope_success: - *sexit = statement; - break; - default: assert(0); } diff -uNr dmd-0.148/dmd/src/dmd/statement.h dmd-0.149/dmd/src/dmd/statement.h --- dmd-0.148/dmd/src/dmd/statement.h 2006-02-22 11:33:18.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/statement.h 2006-03-07 00:09:28.000000000 +0100 @@ -42,6 +42,8 @@ struct TryCatchStatement; struct HdrGenState; +typedef Array Statements; + // Back end struct IRState; struct Blockx; @@ -81,7 +83,7 @@ virtual int fallOffEnd(); virtual int comeFrom(); virtual void scopeCode(Statement **sentry, Statement **sexit, Statement **sfinally); - virtual Array *flatten(); + virtual Statements *flatten(); virtual int inlineCost(InlineCostState *ics); virtual Expression *doInline(InlineDoState *ids); @@ -129,16 +131,16 @@ struct CompoundStatement : Statement { - Array *statements; + Statements *statements; - CompoundStatement(Loc loc, Array *s); + CompoundStatement(Loc loc, Statements *s); CompoundStatement(Loc loc, Statement *s1, Statement *s2); Statement *syntaxCopy(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); Statement *semantic(Scope *sc); int usesEH(); int fallOffEnd(); - Array *flatten(); + Statements *flatten(); ReturnStatement *isReturnStatement(); int inlineCost(InlineCostState *ics); @@ -155,7 +157,7 @@ struct BlockStatement : CompoundStatement { - BlockStatement(Loc loc, Array *s); + BlockStatement(Loc loc, Statements *s); BlockStatement(Loc loc, Statement *s1, Statement *s2); Statement *syntaxCopy(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); @@ -186,8 +188,6 @@ Expression *condition; Statement *body; - VarDeclaration *match; // for MatchExpression results - WhileStatement(Loc loc, Expression *c, Statement *b); Statement *syntaxCopy(); Statement *semantic(Scope *sc); @@ -604,7 +604,7 @@ VolatileStatement(Loc loc, Statement *statement); Statement *syntaxCopy(); Statement *semantic(Scope *sc); - Array *flatten(); + Statements *flatten(); int fallOffEnd(); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); @@ -640,7 +640,7 @@ LabelStatement(Loc loc, Identifier *ident, Statement *statement); Statement *syntaxCopy(); Statement *semantic(Scope *sc); - Array *flatten(); + Statements *flatten(); int usesEH(); int fallOffEnd(); int comeFrom(); diff -uNr dmd-0.148/dmd/src/dmd/staticassert.c dmd-0.149/dmd/src/dmd/staticassert.c --- dmd-0.148/dmd/src/dmd/staticassert.c 2006-02-08 19:16:42.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/staticassert.c 2006-02-27 22:32:16.000000000 +0100 @@ -33,8 +33,9 @@ return sa; } -void StaticAssert::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) +int StaticAssert::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) { + return 0; // we didn't add anything } void StaticAssert::semantic(Scope *sc) @@ -55,6 +56,7 @@ int StaticAssert::oneMember(Dsymbol **ps) { + //printf("StaticAssert::oneMember())\n"); *ps = NULL; return TRUE; } diff -uNr dmd-0.148/dmd/src/dmd/staticassert.h dmd-0.149/dmd/src/dmd/staticassert.h --- dmd-0.148/dmd/src/dmd/staticassert.h 2006-02-08 19:15:48.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/staticassert.h 2006-02-27 22:26:48.000000000 +0100 @@ -28,7 +28,7 @@ StaticAssert(Loc loc, Expression *exp); Dsymbol *syntaxCopy(Dsymbol *s); - void addMember(Scope *sc, ScopeDsymbol *sd, int memnum); + int addMember(Scope *sc, ScopeDsymbol *sd, int memnum); void semantic(Scope *sc); void semantic2(Scope *sc); void inlineScan(); diff -uNr dmd-0.148/dmd/src/dmd/template.c dmd-0.149/dmd/src/dmd/template.c --- dmd-0.148/dmd/src/dmd/template.c 2006-02-15 01:56:30.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/template.c 2006-03-04 00:25:38.000000000 +0100 @@ -266,7 +266,7 @@ assert(dim >= ti->tiargs->dim); // Set up scope for parameters - assert(scope); + assert((size_t)scope > 0x10000); ScopeDsymbol *paramsym = new ScopeDsymbol(); paramsym->parent = scope->parent; Scope *paramscope = scope->push(paramsym); @@ -419,6 +419,308 @@ return 0; } + +/************************************************* + * Match function arguments against a specific template function. + * Input: + * targsi Expression/Type initial list of template arguments + * fargs arguments to function + * Output: + * dedargs Expression/Type deduced template arguments + */ + +MATCH TemplateDeclaration::deduceMatch(Array *targsi, Array *fargs, Array *dedargs) +{ + size_t i; + size_t nfparams; + size_t nfargs; + size_t nargsi; + MATCH match = MATCHexact; + FuncDeclaration *fd = onemember->toAlias()->isFuncDeclaration(); + TypeFunction *fdtype; + Array dedtypes; // for T:T*, the dedargs is the T*, dedtypes is the T + + assert((size_t)scope > 0x10000); + + dedargs->setDim(parameters->dim); + dedargs->zero(); + + dedtypes.setDim(parameters->dim); + dedtypes.zero(); + + // Set up scope for parameters + ScopeDsymbol *paramsym = new ScopeDsymbol(); + paramsym->parent = scope->parent; + Scope *paramscope = scope->push(paramsym); + + nargsi = 0; + if (targsi) + { // Set initial template arguments + + nargsi = targsi->dim; + if (nargsi > parameters->dim) + goto Lnomatch; + + memcpy(dedargs->data, targsi->data, nargsi * sizeof(*dedargs->data)); + + for (i = 0; i < nargsi; i++) + { Object *oarg = (Object *)dedargs->data[i]; + TemplateParameter *tp = (TemplateParameter *)parameters->data[i]; + MATCH m; + Declaration *sparam; + + m = tp->matchArg(paramscope, oarg, i, parameters, &dedtypes, &sparam); + if (m == MATCHnomatch) + goto Lnomatch; + if (m < match) + match = m; + + sparam->semantic(paramscope); + if (!paramscope->insert(sparam)) + goto Lnomatch; + } + } + + assert(fd->type->ty == Tfunction); + fdtype = (TypeFunction *)fd->type; + + nfparams = fdtype->arguments->dim; // number of function parameters + nfargs = fargs->dim; // number of function arguments + + if (nfparams == nfargs) + ; + else if (nfargs > nfparams) + { + if (fdtype->varargs == 0) + goto Lnomatch; // too many args, no match + match = MATCHconvert; // match ... with a conversion + } + + // Loop through the function parameters + for (i = 0; i < nfparams; i++) + { + Argument *fparam = (Argument *)fdtype->arguments->data[i]; + Expression *farg; + MATCH m; + + if (i >= nfargs) // if not enough arguments + { + if (fparam->defaultArg) + { /* Default arguments do not participate in template argument + * deduction. + */ + goto Lmatch; + } + } + else + { farg = (Expression *)fargs->data[i]; + m = farg->type->deduceType(scope, fparam->type, parameters, &dedtypes); + //printf("m = %d\n", m); + if (m) + { if (m < match) + match = m; // pick worst match + continue; + } + } + if (!(fdtype->varargs == 2 && i + 1 == nfparams)) + goto Lnomatch; + + /* Check for match with function parameter T... + */ + Type *t = fparam->type; + switch (t->ty) + { + // Perhaps we can do better with this, see TypeFunction::callMatch() + case Tsarray: + case Tarray: + case Tclass: + case Tident: + goto Lmatch; + + default: + goto Lnomatch; + } + } + +Lmatch: + + for (i = nargsi; i < dedargs->dim; i++) + { + TemplateParameter *tp = (TemplateParameter *)parameters->data[i]; + Object *oarg = (Object *)dedargs->data[i]; + if (!oarg) + { Object *o = (Object *)dedtypes.data[i]; + if (o) + { + if (tp->specialization()) + error("specialization not allowed for deduced parameter %s", tp->ident->toChars()); + } + else + { o = tp->defaultArg(paramscope); + if (!o) + goto Lnomatch; + } + declareParameter(paramscope, tp, o); + dedargs->data[i] = (void *)o; + } + } + + paramscope->pop(); + return match; + +Lnomatch: + paramscope->pop(); + return MATCHnomatch; +} + +/************************************************** + * Declare template parameter tp with value o. + */ + +void TemplateDeclaration::declareParameter(Scope *sc, TemplateParameter *tp, Object *o) +{ + //printf("TemplateDeclaration::declareParameter('%s')\n", tp->ident->toChars()); + + Type *targ = isType(o); + Expression *ea = isExpression(o); + Dsymbol *sa = isDsymbol(o); + Dsymbol *s; + + if (targ) + { + s = new AliasDeclaration(0, tp->ident, targ); + } + else if (sa) + { + //printf("Alias %s %s;\n", sa->ident->toChars(), tp->ident->toChars()); + s = new AliasDeclaration(0, tp->ident, sa); + } + else if (ea) + { + // tdtypes.data[i] always matches ea here + Initializer *init = new ExpInitializer(loc, ea); + TemplateValueParameter *tvp = tp->isTemplateValueParameter(); + assert(tvp); + + VarDeclaration *v = new VarDeclaration(0, tvp->valType, tp->ident, init); + v->storage_class = STCconst; + s = v; + } + else + assert(0); + if (!sc->insert(s)) + error("declaration %s is already defined", tp->ident->toChars()); + s->semantic(sc); +} + +/************************************************* + * Given function arguments, figure out which template function + * to expand, and return that function. + * If no match, give error message and return NULL. + * Input: + * targsi initial list of template arguments + * fargs arguments to function + */ + +FuncDeclaration *TemplateDeclaration::deduce(Scope *sc, Loc loc, Array *targsi, Array *fargs) +{ + MATCH m_best = MATCHnomatch; + TemplateDeclaration *td_ambig = NULL; + TemplateDeclaration *td_best = NULL; + Array *tdargs = new Array(); + TemplateInstance *ti; + FuncDeclaration *fd; + + for (TemplateDeclaration *td = this; td; td = td->overnext) + { + if (!td->scope) + { + error("forward reference to template"); + goto Lerror; + } + if (!td->onemember || !td->onemember->toAlias()->isFuncDeclaration()) + { + error("is not a function template"); + goto Lerror; + } + + MATCH m; + Array dedargs; + + m = td->deduceMatch(targsi, fargs, &dedargs); + if (!m) // if no match + continue; + + if (m < m_best) + goto Ltd_best; + if (m > m_best) + goto Ltd; + + { + // Disambiguate by picking the most specialized TemplateDeclaration + int c1 = td->leastAsSpecialized(td_best); + int c2 = td_best->leastAsSpecialized(td); + //printf("c1 = %d, c2 = %d\n", c1, c2); + + if (c1 && !c2) + goto Ltd; + else if (!c1 && c2) + goto Ltd_best; + else + goto Lambig; + } + + Lambig: // td_best and td are ambiguous + td_ambig = td; + continue; + + Ltd_best: // td_best is the best match so far + td_ambig = NULL; + continue; + + Ltd: // td is the new best match + td_ambig = NULL; + assert((size_t)td->scope > 0x10000); + td_best = td; + m_best = m; + tdargs->setDim(dedargs.dim); + memcpy(tdargs->data, dedargs.data, tdargs->dim * sizeof(void *)); + continue; + } + if (!td_best) + { + error(loc, "does not match any template declaration"); + goto Lerror; + } + if (td_ambig) + { + error(loc, "%s matches more than one template declaration, %s and %s", + toChars(), td_best->toChars(), td_ambig->toChars()); + } + + /* The best match is td_best with arguments tdargs. + * Now instantiate the template. + */ + assert((size_t)td_best->scope > 0x10000); + ti = new TemplateInstance(loc, td_best, tdargs); + ti->semantic(sc); + fd = ti->toAlias()->isFuncDeclaration(); + if (!fd) + goto Lerror; + return fd; + + Lerror: + { + OutBuffer buf; + HdrGenState hgs; + + argExpTypesToCBuffer(&buf, fargs, &hgs); + error(loc, "cannot deduce template function from argument types (%s)", + buf.toChars()); + return NULL; + } +} + void TemplateDeclaration::toCBuffer(OutBuffer *buf, HdrGenState *hgs) { int i; @@ -477,12 +779,21 @@ /* ======================== Type ============================================ */ /* These form the heart of template argument deduction. - * Given 'this' being the argument to the template instance, + * Given 'this' being the type argument to the template instance, * it is matched against the template declaration parameter specialization * 'tparam' to determine the type to be used for the parameter. + * Example: + * template Foo(T:T*) // template declaration + * Foo!(int*) // template instantiation + * Input: + * this = int* + * tparam = T + * parameters = [ T:T* ] // Array of TemplateParameter's + * Output: + * dedtypes = [ int ] // Array of Expression/Type's */ -MATCH Type::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH Type::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { //printf("Type::deduceType()\n"); //printf("\tthis = %d, ", ty); print(); @@ -490,6 +801,7 @@ if (!tparam) goto Lnomatch; + Lagain: if (this == tparam) goto Lexact; @@ -499,7 +811,17 @@ //printf("\ttident = '%s'\n", tident->toChars()); if (tident->idents.dim > 0) - goto Lnomatch; + { + Llookup: + if (!sc) + goto Lnomatch; + /* BUG: what if tparam is a template instance, that + * has as an argument another Tident? + */ + tparam = tparam->semantic(0, sc); + assert(tparam->ty != Tident); + goto Lagain; + } // Determine which parameter tparam is Identifier *id = tident->ident; @@ -507,7 +829,7 @@ for (i = 0; 1; i++) { if (i == parameters->dim) - goto Lnomatch; + goto Llookup; TemplateParameter *tp = (TemplateParameter *)parameters->data[i]; if (tp->ident->equals(id)) @@ -530,7 +852,7 @@ goto Lnomatch; if (next) - return next->deduceType(tparam->next, parameters, dedtypes); + return next->deduceType(sc, tparam->next, parameters, dedtypes); Lexact: return MATCHexact; @@ -539,31 +861,78 @@ return MATCHnomatch; } -MATCH TypeSArray::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeSArray::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { + //printf("TypeSArray::deduceType()\n"); + //printf("\tthis = %d, ", ty); print(); + //printf("\ttparam = %d, ", tparam->ty); tparam->print(); + // Extra check that array dimensions must match - if (tparam && tparam->ty == Tsarray) + if (tparam) { - TypeSArray *tp = (TypeSArray *)tparam; - if (dim->toInteger() != tp->dim->toInteger()) - return MATCHnomatch; + if (tparam->ty == Tsarray) + { + TypeSArray *tp = (TypeSArray *)tparam; + if (dim->toInteger() != tp->dim->toInteger()) + return MATCHnomatch; + } + else if (tparam->ty == Taarray) + { + TypeAArray *tp = (TypeAArray *)tparam; + if (tp->index->ty == Tident) + { TypeIdentifier *tident = (TypeIdentifier *)tp->index; + + if (tident->idents.dim == 0) + { Identifier *id = tident->ident; + + for (size_t i = 0; i < parameters->dim; i++) + { + TemplateParameter *tp = (TemplateParameter *)parameters->data[i]; + + if (tp->ident->equals(id)) + { // Found the corresponding template parameter + TemplateValueParameter *tvp = tp->isTemplateValueParameter(); + if (!tvp || !tvp->valType->isintegral()) + goto Lnomatch; + + if (dedtypes->data[i]) + { + if (!dim->equals((Object *)dedtypes->data[i])) + goto Lnomatch; + } + else + { dedtypes->data[i] = (void *)dim; + } + return next->deduceType(sc, tparam->next, parameters, dedtypes); + } + } + } + } + } } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); + + Lnomatch: + return MATCHnomatch; } -MATCH TypeAArray::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeAArray::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { + //printf("TypeAArray::deduceType()\n"); + //printf("\tthis = %d, ", ty); print(); + //printf("\ttparam = %d, ", tparam->ty); tparam->print(); + // Extra check that index type must match if (tparam && tparam->ty == Taarray) { TypeAArray *tp = (TypeAArray *)tparam; - if (!index->deduceType(tp->index, parameters, dedtypes)) + if (!index->deduceType(sc, tp->index, parameters, dedtypes)) return MATCHnomatch; } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); } -MATCH TypeFunction::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeFunction::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { // Extra check that function characteristics must match if (tparam && tparam->ty == Tfunction) @@ -578,14 +947,14 @@ Argument *a = (Argument *)arguments->data[i]; Argument *ap = (Argument *)tp->arguments->data[i]; if (a->inout != ap->inout || - !a->type->deduceType(ap->type, parameters, dedtypes)) + !a->type->deduceType(sc, ap->type, parameters, dedtypes)) return MATCHnomatch; } } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); } -MATCH TypeIdentifier::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeIdentifier::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { // Extra check if (tparam && tparam->ty == Tident) @@ -601,10 +970,10 @@ return MATCHnomatch; } } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); } -MATCH TypeInstance::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeInstance::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { // Extra check if (tparam && tparam->ty == Tinstance) @@ -625,15 +994,19 @@ Type *t1 = (Type *)tempinst->tiargs->data[i]; Type *t2 = (Type *)tp->tempinst->tiargs->data[i]; - if (!t1->deduceType(t2, parameters, dedtypes)) + if (!t1->deduceType(sc, t2, parameters, dedtypes)) return MATCHnomatch; } } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); } -MATCH TypeStruct::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeStruct::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { + //printf("TypeStruct::deduceType()\n"); + //printf("\tthis->parent = %s, ", sym->parent->toChars()); print(); + //printf("\ttparam = %d, ", tparam->ty); tparam->print(); + // Extra check if (tparam && tparam->ty == Tstruct) { @@ -642,10 +1015,10 @@ if (sym != tp->sym) return MATCHnomatch; } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); } -MATCH TypeEnum::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeEnum::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { // Extra check if (tparam && tparam->ty == Tenum) @@ -655,10 +1028,10 @@ if (sym != tp->sym) return MATCHnomatch; } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); } -MATCH TypeTypedef::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeTypedef::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { // Extra check if (tparam && tparam->ty == Ttypedef) @@ -668,10 +1041,10 @@ if (sym != tp->sym) return MATCHnomatch; } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); } -MATCH TypeClass::deduceType(Type *tparam, Array *parameters, Array *dedtypes) +MATCH TypeClass::deduceType(Scope *sc, Type *tparam, Array *parameters, Array *dedtypes) { //printf("TypeClass::deduceType()\n"); @@ -680,15 +1053,10 @@ { TypeClass *tp = (TypeClass *)tparam; -#if 1 //printf("\t%d\n", (MATCH) implicitConvTo(tp)); return (MATCH) implicitConvTo(tp); -#else - if (sym != tp->sym) - return MATCHnomatch; -#endif } - return Type::deduceType(tparam, parameters, dedtypes); + return Type::deduceType(sc, tparam, parameters, dedtypes); } /* ======================== TemplateParameter =============================== */ @@ -798,7 +1166,7 @@ if (specType) { //printf("\tcalling deduceType(), specType is %s\n", specType->toChars()); - MATCH m2 = ta->deduceType(specType, parameters, dedtypes); + MATCH m2 = ta->deduceType(sc, specType, parameters, dedtypes); if (m2 == MATCHnomatch) { //printf("\tfailed deduceType\n"); goto Lnomatch; @@ -880,6 +1248,12 @@ } +Object *TemplateTypeParameter::specialization() +{ + return specType; +} + + Object *TemplateTypeParameter::defaultArg(Scope *sc) { Type *t; @@ -1053,6 +1427,12 @@ } +Object *TemplateAliasParameter::specialization() +{ + return specAliasT; +} + + Object *TemplateAliasParameter::defaultArg(Scope *sc) { Dsymbol *s = NULL; @@ -1265,6 +1645,12 @@ } +Object *TemplateValueParameter::specialization() +{ + return specValue; +} + + Object *TemplateValueParameter::defaultArg(Scope *sc) { Expression *e; @@ -1296,6 +1682,29 @@ this->semanticdone = 0; this->withsym = NULL; this->nest = 0; + this->havetempdecl = 0; +} + + +TemplateInstance::TemplateInstance(Loc loc, TemplateDeclaration *td, Array *tiargs) + : ScopeDsymbol(NULL) +{ +#if LOG + printf("TemplateInstance(this = %p, tempdecl = '%s')\n", this, td->toChars()); +#endif + this->loc = loc; + this->idents.push(td->ident); + this->tiargs = tiargs; + this->tempdecl = td; + this->inst = NULL; + this->argsym = NULL; + this->aliasdecl = NULL; + this->semanticdone = 0; + this->withsym = NULL; + this->nest = 0; + this->havetempdecl = 1; + + assert((size_t)tempdecl->scope > 0x10000); } @@ -1364,13 +1773,23 @@ #if LOG printf("\tdo semantic\n"); #endif - // Run semantic on each argument, place results in tiargs[] - semanticTiargs(sc); + if (havetempdecl) + { + assert((size_t)tempdecl->scope > 0x10000); + // Deduce tdtypes + tdtypes.setDim(tempdecl->parameters->dim); + tempdecl->matchWithInstance(this, &tdtypes, 0); + } + else + { + // Run semantic on each argument, place results in tiargs[] + semanticTiargs(sc); - tempdecl = findTemplateDeclaration(sc); - if (!tempdecl || global.errors) - { inst = this; - return; // error recovery + tempdecl = findTemplateDeclaration(sc); + if (!tempdecl || global.errors) + { inst = this; + return; // error recovery + } } /* See if there is an existing TemplateInstantiation that already @@ -1520,15 +1939,13 @@ { Dsymbol *s = (Dsymbol *)members->data[i]; #if LOG - printf("\tadding member '%s' %p to '%s'\n", s->toChars(), s, this->toChars()); + printf("\t[%d] adding member '%s' %p to '%s', memnum = %d\n", i, s->toChars(), s, this->toChars(), memnum); #endif - s->addMember(scope, this, memnum); - - /* If symbol s is not the first significant one - */ - if (!memnum && !(s->oneMember(&s) && !s)) - memnum = 1; + memnum |= s->addMember(scope, this, memnum); } +#if LOG + printf("adding members done\n"); +#endif /* See if there is only one member of template instance, and that * member has the same name as the template instance. @@ -1894,39 +2311,8 @@ TemplateParameter *tp = (TemplateParameter *)tempdecl->parameters->data[i]; //Object *o = (Object *)tiargs->data[i]; Object *o = (Object *)tdtypes.data[i]; - Type *targ = isType(o); - Expression *ea = isExpression(o); - Dsymbol *sa = isDsymbol(o); - Dsymbol *s; - if (targ) - { - Type *tded = isType((Object *)tdtypes.data[i]); - - assert(tded); - s = new AliasDeclaration(0, tp->ident, tded); - } - else if (sa) - { - //printf("Alias %s %s;\n", sa->ident->toChars(), tp->ident->toChars()); - s = new AliasDeclaration(0, tp->ident, sa); - } - else if (ea) - { - // tdtypes.data[i] always matches ea here - Initializer *init = new ExpInitializer(loc, ea); - TemplateValueParameter *tvp = tp->isTemplateValueParameter(); - assert(tvp); - - VarDeclaration *v = new VarDeclaration(0, tvp->valType, tp->ident, init); - v->storage_class = STCconst; - s = v; - } - else - assert(0); - if (!scope->insert(s)) - error("declaration %s is already defined", tp->ident->toChars()); - s->semantic(scope); + tempdecl->declareParameter(scope, tp, o); } } diff -uNr dmd-0.148/dmd/src/dmd/template.h dmd-0.149/dmd/src/dmd/template.h --- dmd-0.148/dmd/src/dmd/template.h 2006-02-22 00:43:02.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/template.h 2006-03-04 00:25:46.000000000 +0100 @@ -28,6 +28,7 @@ struct Scope; struct Expression; struct AliasDeclaration; +struct FuncDeclaration; struct HdrGenState; enum MATCH; @@ -54,6 +55,10 @@ MATCH matchWithInstance(TemplateInstance *ti, Array *atypes, int flag); int leastAsSpecialized(TemplateDeclaration *td2); + MATCH deduceMatch(Array *targsi, Array *fargs, Array *dedargs); + FuncDeclaration *deduce(Scope *sc, Loc loc, Array *targsi, Array *fargs); + void declareParameter(Scope *sc, TemplateParameter *tp, Object *o); + TemplateDeclaration *isTemplateDeclaration() { return this; } }; @@ -82,6 +87,7 @@ virtual void semantic(Scope *) = 0; virtual void print(Object *oarg, Object *oded) = 0; virtual void toCBuffer(OutBuffer *buf, HdrGenState *hgs) = 0; + virtual Object *specialization() = 0; virtual Object *defaultArg(Scope *sc) = 0; /* If TemplateParameter's match as far as overloading goes. @@ -112,6 +118,7 @@ void semantic(Scope *); void print(Object *oarg, Object *oded); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); + Object *specialization(); Object *defaultArg(Scope *sc); int overloadMatch(TemplateParameter *); MATCH matchArg(Scope *sc, Object *oarg, int i, Array *parameters, Array *dedtypes, Declaration **psparam); @@ -137,6 +144,7 @@ void semantic(Scope *); void print(Object *oarg, Object *oded); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); + Object *specialization(); Object *defaultArg(Scope *sc); int overloadMatch(TemplateParameter *); MATCH matchArg(Scope *sc, Object *oarg, int i, Array *parameters, Array *dedtypes, Declaration **psparam); @@ -163,6 +171,7 @@ void semantic(Scope *); void print(Object *oarg, Object *oded); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); + Object *specialization(); Object *defaultArg(Scope *sc); int overloadMatch(TemplateParameter *); MATCH matchArg(Scope *sc, Object *oarg, int i, Array *parameters, Array *dedtypes, Declaration **psparam); @@ -172,20 +181,26 @@ struct TemplateInstance : ScopeDsymbol { /* Given: - * instance foo.bar.abc(int, char, 10*10) + * template abc(T:T*, S, int V) + * instance foo.bar.abc(int*, char, 10*10) */ Array idents; // Array of Identifiers [foo, bar, abc] - Array *tiargs; // Array of Types/Expressions of template instance arguments [int, char, 10*10] + Array *tiargs; // Array of Types/Expressions of template + // instance arguments [int*, char, 10*10] + + Array tdtypes; // Array of Types/Expressions corresponding + // to TemplateDeclaration.parameters + // [int, char, 100] TemplateDeclaration *tempdecl; // referenced by foo.bar.abc TemplateInstance *inst; // refer to existing instance - Array tdtypes; // types corresponding to TemplateDeclaration.parameters ScopeDsymbol *argsym; // argument symbol table AliasDeclaration *aliasdecl; // !=NULL if instance is an alias for its // sole member WithScopeSymbol *withsym; // if a member of a with statement int semanticdone; // has semantic() been done? int nest; // for recursion detection + int havetempdecl; // 1 if used second constructor #ifdef IN_GCC /* On some targets, it is necessary to know whether a symbol will be emitted in the output or not before the symbol @@ -194,6 +209,7 @@ #endif TemplateInstance(Loc loc, Identifier *temp_id); + TemplateInstance(Loc loc, TemplateDeclaration *tempdecl, Array *tiargs); Dsymbol *syntaxCopy(Dsymbol *); void addIdent(Identifier *ident); void semantic(Scope *sc); diff -uNr dmd-0.148/dmd/src/dmd/version.c dmd-0.149/dmd/src/dmd/version.c --- dmd-0.148/dmd/src/dmd/version.c 2006-01-21 13:50:20.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/version.c 2006-02-27 22:28:06.000000000 +0100 @@ -46,7 +46,7 @@ return ds; } -void DebugSymbol::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) +int DebugSymbol::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) { //printf("DebugSymbol::addMember('%s') %s\n", sd->toChars(), toChars()); Module *m; @@ -74,6 +74,7 @@ else m->debuglevel = level; } + return 0; } void DebugSymbol::semantic(Scope *sc) @@ -125,7 +126,7 @@ return ds; } -void VersionSymbol::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) +int VersionSymbol::addMember(Scope *sc, ScopeDsymbol *sd, int memnum) { //printf("VersionSymbol::addMember('%s') %s\n", sd->toChars(), toChars()); Module *m; @@ -154,6 +155,7 @@ else m->versionlevel = level; } + return 0; } void VersionSymbol::semantic(Scope *sc) diff -uNr dmd-0.148/dmd/src/dmd/version.h dmd-0.149/dmd/src/dmd/version.h --- dmd-0.148/dmd/src/dmd/version.h 2006-01-21 13:45:04.000000000 +0100 +++ dmd-0.149/dmd/src/dmd/version.h 2006-02-27 22:26:28.000000000 +0100 @@ -27,7 +27,7 @@ DebugSymbol(Loc loc, unsigned level); Dsymbol *syntaxCopy(Dsymbol *); - void addMember(Scope *sc, ScopeDsymbol *s, int memnum); + int addMember(Scope *sc, ScopeDsymbol *s, int memnum); void semantic(Scope *sc); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); char *kind(); @@ -41,7 +41,7 @@ VersionSymbol(Loc loc, unsigned level); Dsymbol *syntaxCopy(Dsymbol *); - void addMember(Scope *sc, ScopeDsymbol *s, int memnum); + int addMember(Scope *sc, ScopeDsymbol *s, int memnum); void semantic(Scope *sc); void toCBuffer(OutBuffer *buf, HdrGenState *hgs); char *kind(); diff -uNr dmd-0.148/dmd/src/phobos/internal/gc/gcbits.d dmd-0.149/dmd/src/phobos/internal/gc/gcbits.d --- dmd-0.148/dmd/src/phobos/internal/gc/gcbits.d 2006-02-25 17:39:20.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/internal/gc/gcbits.d 2006-03-07 14:58:12.000000000 +0100 @@ -55,8 +55,8 @@ } body { - return (cast(bit *)(data + 1))[i]; - //return data[1 + (i >> BITS_SHIFT)] & (1 << (i & BITS_MASK)); + //return (cast(bit *)(data + 1))[i]; + return data[1 + (i >> BITS_SHIFT)] & (1 << (i & BITS_MASK)); } void set(uint i) @@ -66,8 +66,8 @@ } body { - (cast(bit *)(data + 1))[i] = 1; - //data[1 + (i >> BITS_SHIFT)] |= (1 << (i & BITS_MASK)); + //(cast(bit *)(data + 1))[i] = 1; + data[1 + (i >> BITS_SHIFT)] |= (1 << (i & BITS_MASK)); } void clear(uint i) @@ -77,8 +77,8 @@ } body { - (cast(bit *)(data + 1))[i] = 0; - //data[1 + (i >> BITS_SHIFT)] &= ~(1 << (i & BITS_MASK)); + //(cast(bit *)(data + 1))[i] = 0; + data[1 + (i >> BITS_SHIFT)] &= ~(1 << (i & BITS_MASK)); } uint testClear(uint i) @@ -102,13 +102,13 @@ else { uint result; - result = (cast(bit *)(data + 1))[i]; - (cast(bit *)(data + 1))[i] = 0; + //result = (cast(bit *)(data + 1))[i]; + //(cast(bit *)(data + 1))[i] = 0; - //uint *p = &data[1 + (i >> BITS_SHIFT)]; - //uint mask = (1 << (i & BITS_MASK)); - //result = *p & mask; - //*p &= ~mask; + uint *p = &data[1 + (i >> BITS_SHIFT)]; + uint mask = (1 << (i & BITS_MASK)); + result = *p & mask; + *p &= ~mask; return result; } } diff -uNr dmd-0.148/dmd/src/phobos/internal/object.d dmd-0.149/dmd/src/phobos/internal/object.d --- dmd-0.148/dmd/src/phobos/internal/object.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/internal/object.d 2006-03-07 14:58:12.000000000 +0100 @@ -5,7 +5,7 @@ * * This module is implicitly imported. * Macros: - * WIKI = Object + * WIKI = Phobos/Object */ /* diff -uNr dmd-0.148/dmd/src/phobos/linux.mak dmd-0.149/dmd/src/phobos/linux.mak --- dmd-0.148/dmd/src/phobos/linux.mak 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/linux.mak 2006-03-07 14:58:10.000000000 +0100 @@ -103,7 +103,7 @@ std/boxer.d std/cstream.d std/demangle.d std/cover.d std/bitarray.d SRC_STD_C= std/c/process.d std/c/stdlib.d std/c/time.d std/c/stdio.d \ - std/c/math.d std/c/stdarg.d std/c/stddef.d + std/c/math.d std/c/stdarg.d std/c/stddef.d std/c/fenv.d SRC_TI= \ std/typeinfo/ti_wchar.d std/typeinfo/ti_uint.d \ diff -uNr dmd-0.148/dmd/src/phobos/std/base64.d dmd-0.149/dmd/src/phobos/std/base64.d --- dmd-0.148/dmd/src/phobos/std/base64.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/base64.d 2006-03-07 14:58:10.000000000 +0100 @@ -2,7 +2,7 @@ * Encodes/decodes MIME base64 data. * * Macros: - * WIKI=StdBase64 + * WIKI=Phobos/StdBase64 * References: * Wikipedia Base64$(BR) * RFC 2045$(BR) diff -uNr dmd-0.148/dmd/src/phobos/std/c/fenv.d dmd-0.149/dmd/src/phobos/std/c/fenv.d --- dmd-0.148/dmd/src/phobos/std/c/fenv.d 1970-01-01 01:00:00.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/c/fenv.d 2006-03-07 14:58:10.000000000 +0100 @@ -0,0 +1,112 @@ + +/** + * C's <fenv.h> + * Authors: Walter Bright, Digital Mars, www.digitalmars.com + * License: Public Domain + * Macros: + * WIKI=Phobos/StdCFenv + */ + +module std.c.fenv; + +extern (C): + +/// Entire floating point environment + +struct fenv_t +{ + version (Windows) + { + ushort status; + ushort control; + ushort round; + ushort reserved[2]; + } + else version (linux) + { + ushort __control_word; + ushort __unused1; + ushort __status_word; + ushort __unused2; + ushort __tags; + ushort __unused3; + uint __eip; + ushort __cs_selector; + ushort __opcode; + uint __data_offset; + ushort __data_selector; + ushort __unused5; + } + else + { + static assert(0); + } +} + +alias int fexcept_t; /// Floating point status flags + +/// The various floating point exceptions +enum +{ + FE_INVALID = 1, + FE_DENORMAL = 2, + FE_DIVBYZERO = 4, + FE_OVERFLOW = 8, + FE_UNDERFLOW = 0x10, + FE_INEXACT = 0x20, + FE_ALL_EXCEPT = 0x3F, /// Mask of all the exceptions +} + +/// Rounding modes +enum +{ + FE_TONEAREST = 0, + FE_UPWARD = 0x800, + FE_DOWNWARD = 0x400, + FE_TOWARDZERO = 0xC00, +} + +version (Windows) +{ + extern fenv_t _FE_DFL_ENV; + + /// Default floating point environment + fenv_t* FE_DFL_ENV = &_FE_DFL_ENV; +} +else version (linux +{ + /// Default floating point environment + fenv_t* FE_DFL_ENV = cast(fenv_t*)(-1); +} +else +{ + static assert(0); +} + +/// Floating point precision +enum +{ + FE_FLTPREC = 0, + FE_DBLPREC = 0x200, + FE_LDBLPREC = 0x300, +} + +int fetestexcept(int excepts); +int feraiseexcept(int excepts); +int feclearexcept(int excepts); +//int fegetexcept(fexcept_t *flagp,int excepts); +//int fesetexcept(fexcept_t *flagp,int excepts); +int fegetround(); +int fesetround(int round); +int fegetprec(); +int fesetprec(int prec); +int fegetenv(fenv_t *envp); +int fesetenv(fenv_t *envp); +//void feprocentry(fenv_t *envp); +//void feprocexit(const fenv_t *envp); + +int fegetexceptflag(fexcept_t *flagp,int excepts); +int fesetexceptflag(fexcept_t *flagp,int excepts); +int feholdexcept(fenv_t *envp); +int feupdateenv(fenv_t *envp); + diff -uNr dmd-0.148/dmd/src/phobos/std/compiler.d dmd-0.149/dmd/src/phobos/std/compiler.d --- dmd-0.148/dmd/src/phobos/std/compiler.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/compiler.d 2006-03-07 14:58:10.000000000 +0100 @@ -1,7 +1,7 @@ /** * Macros: - * WIKI = StdCompiler + * WIKI = Phobos/StdCompiler */ /** diff -uNr dmd-0.148/dmd/src/phobos/std/cover.d dmd-0.149/dmd/src/phobos/std/cover.d --- dmd-0.148/dmd/src/phobos/std/cover.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/cover.d 2006-03-07 14:58:10.000000000 +0100 @@ -29,7 +29,7 @@ * $(LI inline asm statements are not counted) * ) * Macros: - * WIKI = StdCover + * WIKI = Phobos/StdCover */ module std.cover; diff -uNr dmd-0.148/dmd/src/phobos/std/date.d dmd-0.149/dmd/src/phobos/std/date.d --- dmd-0.148/dmd/src/phobos/std/date.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/date.d 2006-03-07 14:58:10.000000000 +0100 @@ -4,7 +4,7 @@ * around a central type, d_time, from which other formats are converted to and * from. * Macros: - * WIKI = StdDate + * WIKI = Phobos/StdDate */ // Copyright (c) 1999-2005 by Digital Mars diff -uNr dmd-0.148/dmd/src/phobos/std/demangle.d dmd-0.149/dmd/src/phobos/std/demangle.d --- dmd-0.148/dmd/src/phobos/std/demangle.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/demangle.d 2006-03-07 14:58:10.000000000 +0100 @@ -1,7 +1,7 @@ /**** * Demangle D mangled names. * Macros: - * WIKI = StdDemangle + * WIKI = Phobos/StdDemangle */ /* Author: diff -uNr dmd-0.148/dmd/src/phobos/std/file.d dmd-0.149/dmd/src/phobos/std/file.d --- dmd-0.148/dmd/src/phobos/std/file.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/file.d 2006-03-07 14:58:10.000000000 +0100 @@ -1,6 +1,6 @@ /** * Macros: - * WIKI = StdFile + * WIKI = Phobos/StdFile */ /* diff -uNr dmd-0.148/dmd/src/phobos/std/format.d dmd-0.149/dmd/src/phobos/std/format.d --- dmd-0.148/dmd/src/phobos/std/format.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/format.d 2006-03-07 14:58:10.000000000 +0100 @@ -3,7 +3,7 @@ * It's comparable to C99's vsprintf(). * * Macros: - * WIKI = StdFormat + * WIKI = Phobos/StdFormat */ /* @@ -38,8 +38,6 @@ private import std.c.stdlib; private import std.string; -alias bool bit; - version (Windows) { version (DigitalMars) diff -uNr dmd-0.148/dmd/src/phobos/std/math.d dmd-0.149/dmd/src/phobos/std/math.d --- dmd-0.148/dmd/src/phobos/std/math.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/math.d 2006-03-07 14:58:10.000000000 +0100 @@ -2,7 +2,7 @@ /** * Macros: - * WIKI = StdMath + * WIKI = Phobos/StdMath * * TABLE_SV = * diff -uNr dmd-0.148/dmd/src/phobos/std/md5.d dmd-0.149/dmd/src/phobos/std/md5.d --- dmd-0.148/dmd/src/phobos/std/md5.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/md5.d 2006-03-07 14:58:10.000000000 +0100 @@ -19,7 +19,7 @@ * $(LINK2 http://en.wikipedia.org/wiki/Md5, Wikipedia on MD5) * * Macros: - * WIKI = StdMd5 + * WIKI = Phobos/StdMd5 */ /++++++++++++++++++++++++++++++++ @@ -55,7 +55,7 @@ else { context.start(); - while ((len = fread(buffer, 1, buffer.size, file)) != 0) + while ((len = fread(buffer, 1, buffer.sizeof, file)) != 0) context.update(buffer[0 .. len]); context.finish(digest); fclose(file); diff -uNr dmd-0.148/dmd/src/phobos/std/outbuffer.d dmd-0.149/dmd/src/phobos/std/outbuffer.d --- dmd-0.148/dmd/src/phobos/std/outbuffer.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/outbuffer.d 2006-03-07 14:58:10.000000000 +0100 @@ -4,7 +4,7 @@ * Boilerplate: * $(std_boilerplate.html) * Macros: - * WIKI = StdOutbuffer + * WIKI = Phobos/StdOutbuffer * Copyright: * Copyright (c) 2001-2005 by Digital Mars * All Rights Reserved diff -uNr dmd-0.148/dmd/src/phobos/std/path.d dmd-0.149/dmd/src/phobos/std/path.d --- dmd-0.148/dmd/src/phobos/std/path.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/path.d 2006-03-07 14:58:10.000000000 +0100 @@ -1,7 +1,7 @@ /** * Macros: - * WIKI = StdPath + * WIKI = Phobos/StdPath * Copyright: * Placed into public domain. * www.digitalmars.com diff -uNr dmd-0.148/dmd/src/phobos/std/random.d dmd-0.149/dmd/src/phobos/std/random.d --- dmd-0.148/dmd/src/phobos/std/random.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/random.d 2006-03-07 14:58:10.000000000 +0100 @@ -1,6 +1,6 @@ /** * Macros: - * WIKI = StdRandom + * WIKI = Phobos/StdRandom */ // random.d diff -uNr dmd-0.148/dmd/src/phobos/std/stream.d dmd-0.149/dmd/src/phobos/std/stream.d --- dmd-0.148/dmd/src/phobos/std/stream.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/stream.d 2006-03-07 14:58:10.000000000 +0100 @@ -1,6 +1,6 @@ /** * Macros: - * WIKI = StdStream + * WIKI = Phobos/StdStream */ /* diff -uNr dmd-0.148/dmd/src/phobos/std/string.d dmd-0.149/dmd/src/phobos/std/string.d --- dmd-0.148/dmd/src/phobos/std/string.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/string.d 2006-03-07 14:58:10.000000000 +0100 @@ -11,7 +11,7 @@ * are done, the returned string is a copy. * * Macros: - * WIKI = StdString + * WIKI = Phobos/StdString * Copyright: * Public Domain */ diff -uNr dmd-0.148/dmd/src/phobos/std/uri.d dmd-0.149/dmd/src/phobos/std/uri.d --- dmd-0.148/dmd/src/phobos/std/uri.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/uri.d 2006-03-07 14:58:10.000000000 +0100 @@ -33,7 +33,7 @@ * $(LINK2 http://www.ietf.org/rfc/rfc3986.txt, RFC 3986)
* $(LINK2 http://en.wikipedia.org/wiki/Uniform_resource_identifier, Wikipedia) * Macros: - * WIKI = StdUri + * WIKI = Phobos/StdUri */ module std.uri; diff -uNr dmd-0.148/dmd/src/phobos/std/utf.d dmd-0.149/dmd/src/phobos/std/utf.d --- dmd-0.148/dmd/src/phobos/std/utf.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/utf.d 2006-03-07 14:58:10.000000000 +0100 @@ -37,7 +37,7 @@ * $(LINK http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8)
* $(LINK http://anubis.dkuug.dk/JTC1/SC2/WG2/docs/n1335) * Macros: - * WIKI = StdUtf + * WIKI = Phobos/StdUtf */ module std.utf; diff -uNr dmd-0.148/dmd/src/phobos/std/windows/charset.d dmd-0.149/dmd/src/phobos/std/windows/charset.d --- dmd-0.148/dmd/src/phobos/std/windows/charset.d 2006-02-25 17:39:20.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/windows/charset.d 2006-03-07 14:58:12.000000000 +0100 @@ -3,7 +3,7 @@ /** * Support UTF-8 on Windows 95, 98 and ME systems. * Macros: - * WIKI = StdWindowsCharset + * WIKI = Phobos/StdWindowsCharset */ module std.windows.charset; diff -uNr dmd-0.148/dmd/src/phobos/std/zip.d dmd-0.149/dmd/src/phobos/std/zip.d --- dmd-0.148/dmd/src/phobos/std/zip.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/zip.d 2006-03-07 14:58:10.000000000 +0100 @@ -12,7 +12,7 @@ * ) * * Macros: - * WIKI = StdZip + * WIKI = Phobos/StdZip */ module std.zip; diff -uNr dmd-0.148/dmd/src/phobos/std/zlib.d dmd-0.149/dmd/src/phobos/std/zlib.d --- dmd-0.148/dmd/src/phobos/std/zlib.d 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/std/zlib.d 2006-03-07 14:58:10.000000000 +0100 @@ -5,7 +5,7 @@ * $(LINK2 http://en.wikipedia.org/wiki/Zlib, Wikipedia) * * Macros: - * WIKI = StdZlib + * WIKI = Phobos/StdZlib */ diff -uNr dmd-0.148/dmd/src/phobos/win32.mak dmd-0.149/dmd/src/phobos/win32.mak --- dmd-0.148/dmd/src/phobos/win32.mak 2006-02-25 17:39:18.000000000 +0100 +++ dmd-0.149/dmd/src/phobos/win32.mak 2006-03-07 14:58:10.000000000 +0100 @@ -73,7 +73,7 @@ socket.obj socketstream.obj loader.obj stdarg.obj format.obj stdio.obj \ perf.obj openrj.obj uni.obj winsock.obj oldsyserror.obj \ errno.obj boxer.obj cstream.obj charset.obj \ - realtest.obj gamma.obj demangle.obj cover.obj \ + realtest.obj gamma.obj demangle.obj cover.obj bitarray.obj \ ti_Aa.obj ti_Ag.obj ti_C.obj ti_int.obj ti_char.obj \ ti_wchar.obj ti_uint.obj ti_short.obj ti_ushort.obj \ ti_byte.obj ti_ubyte.obj ti_long.obj ti_ulong.obj ti_ptr.obj \ @@ -85,7 +85,9 @@ ti_Aint.obj ti_Auint.obj ti_Along.obj ti_Aulong.obj ti_Awchar.obj \ ti_Afloat.obj ti_Adouble.obj ti_Areal.obj \ ti_Acfloat.obj ti_Acdouble.obj ti_Acreal.obj \ - ti_dchar.obj ti_Adchar.obj ti_bit.obj ti_Abit.obj ti_void.obj + ti_dchar.obj ti_Adchar.obj ti_void.obj + +# ti_bit.obj ti_Abit.obj DOCS= $(DOC)\std_path.html $(DOC)\std_math.html $(DOC)\std_outbuffer.html \ $(DOC)\std_stream.html $(DOC)\std_string.html $(DOC)\std_base64.html \ @@ -97,6 +99,7 @@ $(DOC)\std_utf.html \ $(DOC)\std_cover.html \ $(DOC)\std_regexp.html \ + $(DOC)\std_bitarray.html \ $(DOC)\std_stdio.html \ $(DOC)\std_windows_charset.html @@ -111,17 +114,17 @@ std\regexp.d std\random.d std\stream.d std\process.d std\recls.d \ std\socket.d std\socketstream.d std\loader.d std\stdarg.d std\format.d \ std\stdio.d std\perf.d std\openrj.d std\uni.d std\boxer.d \ - std\cstream.d std\demangle.d std\cover.d + std\cstream.d std\demangle.d std\cover.d std\bitarray.d SRC_STD_C= std\c\process.d std\c\stdlib.d std\c\time.d std\c\stdio.d \ - std\c\math.d std\c\stdarg.d std\c\stddef.d + std\c\math.d std\c\stdarg.d std\c\stddef.d std\c\fenv.d SRC_TI= \ std\typeinfo\ti_wchar.d std\typeinfo\ti_uint.d \ std\typeinfo\ti_short.d std\typeinfo\ti_ushort.d \ std\typeinfo\ti_byte.d std\typeinfo\ti_ubyte.d \ std\typeinfo\ti_long.d std\typeinfo\ti_ulong.d \ - std\typeinfo\ti_ptr.d std\typeinfo\ti_bit.d \ + std\typeinfo\ti_ptr.d \ std\typeinfo\ti_float.d std\typeinfo\ti_double.d \ std\typeinfo\ti_real.d std\typeinfo\ti_delegate.d \ std\typeinfo\ti_creal.d std\typeinfo\ti_ireal.d \ @@ -139,7 +142,9 @@ std\typeinfo\ti_Acfloat.d std\typeinfo\ti_Acdouble.d \ std\typeinfo\ti_Acreal.d \ std\typeinfo\ti_Awchar.d std\typeinfo\ti_dchar.d \ - std\typeinfo\ti_Abit.d std\typeinfo\ti_void.d + std\typeinfo\ti_void.d + +# std\typeinfo\ti_bit.d std\typeinfo\ti_Abit.d SRC_INT= \ internal\switch.d internal\complex.c internal\critical.c \ @@ -459,6 +464,9 @@ base64.obj : std\base64.d $(DMD) -c $(DFLAGS) -inline std\base64.d +bitarray.obj : std\bitarray.d + $(DMD) -c $(DFLAGS) -inline std\bitarray.d + boxer.obj : std\boxer.d $(DMD) -c $(DFLAGS) std\boxer.d @@ -768,6 +776,9 @@ $(DOC)\std_base64.html : std.ddoc std\base64.d $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_base64.html std.ddoc std\base64.d +$(DOC)\std_bitarray.html : std.ddoc std\bitarray.d + $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_bitarray.html std.ddoc std\bitarray.d + $(DOC)\std_compiler.html : std.ddoc std\compiler.d $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_compiler.html std.ddoc std\compiler.d
Special Values