diff -uNr dmd-0.132/dmd/src/dmd/aggregate.h dmd-0.133/dmd/src/dmd/aggregate.h --- dmd-0.132/dmd/src/dmd/aggregate.h 2005-09-19 02:26:56.000000000 +0200 +++ dmd-0.133/dmd/src/dmd/aggregate.h 2005-09-24 01:40:06.000000000 +0200 @@ -37,6 +37,7 @@ { Type *type; unsigned storage_class; + enum PROT protection; Type *handle; // 'this' type unsigned structsize; // size of struct unsigned alignsize; // size of struct for alignment purposes @@ -75,6 +76,8 @@ int hasPrivateAccess(Dsymbol *smember); // does smember have private access to members of this class? void accessCheck(Loc loc, Scope *sc, Dsymbol *smember); + enum PROT prot(); + // Back end Symbol *stag; // tag symbol for debug data Symbol *sinit; diff -uNr dmd-0.132/dmd/src/dmd/attrib.c dmd-0.133/dmd/src/dmd/attrib.c --- dmd-0.132/dmd/src/dmd/attrib.c 2005-09-19 14:44:34.000000000 +0200 +++ dmd-0.133/dmd/src/dmd/attrib.c 2005-09-24 01:31:22.000000000 +0200 @@ -784,7 +784,7 @@ { Dsymbol *s; s = (Dsymbol *)d->data[i]; - printf("ConditionalDeclaration::addComment %s\n", s->toChars()); + //printf("ConditionalDeclaration::addComment %s\n", s->toChars()); s->addComment(comment); } } diff -uNr dmd-0.132/dmd/src/dmd/class.c dmd-0.133/dmd/src/dmd/class.c --- dmd-0.132/dmd/src/dmd/class.c 2005-08-01 19:25:20.000000000 +0200 +++ dmd-0.133/dmd/src/dmd/class.c 2005-09-24 01:45:12.000000000 +0200 @@ -313,6 +313,7 @@ vtbl.push(this); // leave room for classinfo as first member } + protection = sc->protection; storage_class |= sc->stc; if (sizeok == 0) diff -uNr dmd-0.132/dmd/src/dmd/doc.c dmd-0.133/dmd/src/dmd/doc.c --- dmd-0.132/dmd/src/dmd/doc.c 2005-09-19 17:45:24.000000000 +0200 +++ dmd-0.133/dmd/src/dmd/doc.c 2005-09-24 15:28:12.000000000 +0200 @@ -51,17 +51,16 @@ Array sections; // Section*[] Section *summary; - Section *boilerplate; Section *copyright; Section *macros; DocComment(); static DocComment *parse(Scope *sc, Dsymbol *s, unsigned char *comment); + static void parseMacros(Macro **pmacrotable, unsigned char *m, unsigned mlen); void parseSections(unsigned char *comment); void writeSections(Scope *sc, Dsymbol *s, OutBuffer *buf); - void doMacros(Macro **pmacrotable); }; @@ -75,9 +74,6 @@ void highlightCode(Scope *sc, Dsymbol *s, OutBuffer *buf, unsigned offset); Argument *isFunctionParameter(Dsymbol *s, unsigned char *p, unsigned len); -static char dtbigbig_s[] = "
"; -static char dtbigbig_e[] = "
\n"; - static unsigned char default_boilerplate[] = "\ \n\ \n\ @@ -95,15 +91,104 @@ \n\ "; +static unsigned char ddoc_default[] = "\ +DDOC = \n\ + \n\ + $(TITLE)\n\ + \n\ +

$(TITLE)

\n\ + $(BODY)\n\ + \n\ +\n\ +B = $0\n\ +I = $0\n\ +U = $0\n\ +P =

$0

\n\ +DL =
$0
\n\ +DT =
$0
\n\ +DD =
$0
\n\ +TABLE = $0
\n\ +TR = $0\n\ +TH = $0\n\ +TD = $0\n\ +OL =
    $0
\n\ +UL = \n\ +LI =
  • $0
  • \n\ +BIG = $0\n\ +SMALL = $0\n\ +BR =
    \n\ +\n\ +RED = $0\n\ +BLUE = $0\n\ +GREEN = $0\n\ +YELLOW =$0\n\ +BLACK = $0\n\ +WHITE = $0\n\ +\n\ +D_CODE =
    $0
    \n\ +\n\ +DDOC_DECL = $(DT $(BIG $0))\n\ +DDOC_DECL_DD = $(DD $0)\n\ +DDOC_SECTIONS = $0\n\ +DDOC_SUMMARY = $0\n\ +DDOC_DESCRIPTION = $0\n\ +DDOC_SECTION_H = $(P $(B $0))\n\ +DDOC_SECTION = $0\n\ +DDOC_MEMBERS = $(DL $0)\n\ +DDOC_PARAMS = $(P $(TABLE $0))\n\ +DDOC_PARAM_ROW = $(TR $0)\n\ +DDOC_PARAM_ID = $(TD $0)\n\ +DDOC_PARAM_DESC = $(TD $0)\n\ +\n\ +DDOC_PSYMBOL = $(U $0)\n\ +DDOC_KEYWORD = $(B $0)\n\ +DDOC_PARAM = $(I $0)\n\ +"; + +static char ddoc_decl_s[] = "$(DDOC_DECL "; +static char ddoc_decl_e[] = ")\n"; + +static char ddoc_decl_dd_s[] = "$(DDOC_DECL_DD "; +static char ddoc_decl_dd_e[] = ")\n"; + + /**************************************************** */ void Module::gendocfile() { + static OutBuffer mbuf; + static int mbuf_done; + OutBuffer buf; //printf("Module::gendocfile()\n"); + if (!mbuf_done) // if not already read the ddoc files + { mbuf_done = 1; + + // Use our internal default + mbuf.write(ddoc_default, sizeof(ddoc_default) - 1); + + // Override with DDOCFILE specified in the sc.ini file + char *p = getenv("DDOCFILE"); + if (p) + global.params.ddocfiles->shift(p); + + // Override with the ddoc macro files from the command line + for (int i = 0; i < global.params.ddocfiles->dim; i++) + { + FileName f((char *)global.params.ddocfiles->data[i], 0); + File file(&f); + file.readv(); + // BUG: convert file contents to UTF-8 before use + + //printf("file: '%.*s'\n", file.len, file.buffer); + mbuf.write(file.buffer, file.len); + } + } + DocComment::parseMacros(¯otable, mbuf.data, mbuf.offset); + Scope *sc = Scope::createGlobal(this); // create root scope sc->docbuf = &buf; @@ -116,21 +201,12 @@ } if (dc->macros) - dc->doMacros(¯otable); + DocComment::parseMacros(¯otable, dc->macros->body, dc->macros->bodylen); buf.printf("\n", srcfile->toChars()); dc->writeSections(sc, this, sc->docbuf); - - buf.writestring("
    \n"); - for (int i = 0; i < members->dim; i++) - { - Dsymbol *s; - - s = (Dsymbol *)members->data[i]; - s->emitComment(sc); - } - buf.writestring("
    \n"); + emitMemberComments(sc); // Generate predefined macros @@ -150,12 +226,28 @@ OutBuffer buf2; - if (dc->boilerplate) - buf2.write(dc->boilerplate->body, dc->boilerplate->bodylen); - else - buf2.write(default_boilerplate, sizeof(default_boilerplate) - 1); + buf2.writestring("$(DDOC)\n"); unsigned end = buf2.offset; - macrotable->expand(&buf2, 0, &end); + macrotable->expand(&buf2, 0, &end, NULL, 0); + +#if 1 + /* Remove all the escape sequences from buf2 + */ + { unsigned i = 0; + unsigned char *p = buf2.data; + for (unsigned j = 0; j < buf2.offset; j++) + { + if (p[j] == 0xFF && j + 1 < buf2.offset) + { + j++; + continue; + } + p[i] = p[j]; + i++; + } + buf2.setsize(i); + } +#endif // Transfer image to file docfile->setbuffer(buf2.data, buf2.offset); @@ -175,7 +267,7 @@ unsigned o; OutBuffer b; - b.writestring("
    "); + b.writestring("$(BR)"); o = b.offset; toDocBuffer(&b); highlightCode(sc, this, &b, o); @@ -190,7 +282,7 @@ if (members) { - buf->writestring("
    \n"); + buf->writestring("$(DDOC_MEMBERS \n"); sc = sc->push(this); for (int i = 0; i < members->dim; i++) { @@ -198,7 +290,7 @@ s->emitComment(sc); } sc->pop(); - buf->writestring("
    \n"); + buf->writestring(")\n"); } } @@ -247,25 +339,23 @@ return; } - buf->writestring(dtbigbig_s); + buf->writestring(ddoc_decl_s); o = buf->offset; toDocBuffer(buf); highlightCode(sc, this, buf, o); sc->lastoffset = buf->offset; - buf->writestring(dtbigbig_e); + buf->writestring(ddoc_decl_e); - buf->printf("
    \n"); - dc->writeSections(sc, this, buf); - buf->printf("
    \n"); + buf->writestring(ddoc_decl_dd_s); + dc->writeSections(sc, this, buf); + buf->writestring(ddoc_decl_dd_e); } void AggregateDeclaration::emitComment(Scope *sc) { //printf("AggregateDeclaration::emitComment() '%s'\n", toChars()); -#if 0 - if (protection == PROTprivate) + if (prot() == PROTprivate) return; -#endif if (!comment) return; @@ -278,33 +368,28 @@ return; } - buf->writestring(dtbigbig_s); + buf->writestring(ddoc_decl_s); toDocBuffer(buf); sc->lastoffset = buf->offset; - buf->writestring(dtbigbig_e); - - buf->printf("
    \n"); - - dc->writeSections(sc, this, buf); - emitMemberComments(sc); + buf->writestring(ddoc_decl_e); - buf->printf("
    \n"); - - buf->printf("
    \n"); + buf->writestring(ddoc_decl_dd_s); + dc->writeSections(sc, this, buf); + emitMemberComments(sc); + buf->writestring(ddoc_decl_dd_e); } void TemplateDeclaration::emitComment(Scope *sc) { //printf("TemplateDeclaration::emitComment() '%s'\n", toChars()); -#if 0 - if (protection == PROTprivate) + if (prot() == PROTprivate) return; -#endif if (!comment) return; OutBuffer *buf = sc->docbuf; DocComment *dc = DocComment::parse(sc, this, comment); + unsigned o; if (!dc) { @@ -315,29 +400,28 @@ ScopeDsymbol *ss = this; if (onemember) - ss = onemember->isAggregateDeclaration(); - - buf->writestring(dtbigbig_s); - ss->toDocBuffer(buf); - sc->lastoffset = buf->offset; - buf->writestring(dtbigbig_e); - - buf->printf("
    \n"); - - dc->writeSections(sc, this, buf); - ss->emitMemberComments(sc); + { ss = onemember->isAggregateDeclaration(); + if (!ss) + ss = this; + } - buf->printf("
    \n"); + buf->writestring(ddoc_decl_s); + o = buf->offset; + ss->toDocBuffer(buf); + highlightCode(sc, this, buf, o); + sc->lastoffset = buf->offset; + buf->writestring(ddoc_decl_e); - buf->printf("
    \n"); + buf->writestring(ddoc_decl_dd_s); + dc->writeSections(sc, this, buf); + emitMemberComments(sc); + buf->writestring(ddoc_decl_dd_e); } void EnumDeclaration::emitComment(Scope *sc) { -#if 0 - if (protection == PROTprivate) + if (prot() == PROTprivate) return; -#endif if (!comment) return; @@ -350,23 +434,22 @@ return; } - buf->writestring(dtbigbig_s); + buf->writestring(ddoc_decl_s); toDocBuffer(buf); sc->lastoffset = buf->offset; - buf->writestring(dtbigbig_e); - - buf->printf("
    \n"); - - dc->writeSections(sc, this, buf); - emitMemberComments(sc); - - buf->printf("
    \n"); + buf->writestring(ddoc_decl_e); + buf->writestring(ddoc_decl_dd_s); + dc->writeSections(sc, this, buf); + emitMemberComments(sc); + buf->writestring(ddoc_decl_dd_e); } void EnumMember::emitComment(Scope *sc) { //printf("EnumMember::emitComment(%p '%s'), comment = '%s'\n", this, toChars(), comment); + if (prot() == PROTprivate) + return; if (!comment) return; @@ -380,16 +463,16 @@ return; } - buf->writestring(dtbigbig_s); + buf->writestring(ddoc_decl_s); o = buf->offset; toDocBuffer(buf); highlightCode(sc, this, buf, o); sc->lastoffset = buf->offset; - buf->writestring(dtbigbig_e); + buf->writestring(ddoc_decl_e); - buf->printf("
    \n"); - dc->writeSections(sc, this, buf); - buf->printf("
    \n"); + buf->writestring(ddoc_decl_dd_s); + dc->writeSections(sc, this, buf); + buf->writestring(ddoc_decl_dd_e); } /******************************* toDocBuffer **********************************/ @@ -473,7 +556,7 @@ #if 0 emitProtection(buf, protection); #endif - buf->printf("%s %s", kind(), toChars()); + buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars()); buf->writestring(";\n"); } } @@ -495,7 +578,7 @@ highlightCode(NULL, this, buf, o); } else - buf->printf("%s %s", kind(), toChars()); + buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars()); int any = 0; for (int i = 0; i < baseclasses.dim; i++) { BaseClass *bc = (BaseClass *)baseclasses.data[i]; @@ -530,7 +613,7 @@ { if (ident) { - buf->printf("%s %s", kind(), toChars()); + buf->printf("%s $(DDOC_PSYMBOL %s)", kind(), toChars()); buf->writestring(";\n"); } } @@ -566,12 +649,6 @@ for (int i = 0; i < dc->sections.dim; i++) { Section *s = (Section *)dc->sections.data[i]; - if (icmp("boilerplate", s->name, s->namelen) == 0) - { - dc->boilerplate = s; - s->nooutput = 1; - } - if (icmp("copyright", s->name, s->namelen) == 0) { dc->copyright = s; @@ -691,22 +768,46 @@ void DocComment::writeSections(Scope *sc, Dsymbol *s, OutBuffer *buf) { - if (sections.dim) - { - for (int i = 0; i < sections.dim; i++) - { Section *sec = (Section *)sections.data[i]; + //printf("DocComment::writeSections()\n"); + if (sections.dim) + { + buf->writestring("$(DDOC_SECTIONS \n"); + for (int i = 0; i < sections.dim; i++) + { Section *sec = (Section *)sections.data[i]; - if (sec->nooutput) - continue; - if (sec->namelen) - { - buf->printf("

    %.*s:

    ", sec->namelen, sec->name); + if (sec->nooutput) + continue; + //printf("Section: '%.*s' = '%.*s'\n", sec->namelen, sec->name, sec->bodylen, sec->body); + if (sec->namelen) + { + // Replace _ characters with spaces + buf->writestring("$(DDOC_SECTION_H "); + for (unsigned u = 0; u < sec->namelen; u++) + { unsigned char c = sec->name[u]; + buf->writeByte((c == '_') ? ' ' : c); } + buf->writestring(":)"); + buf->writestring("$(DDOC_SECTION "); + sec->write(sc, s, buf); + buf->writestring(")\n"); + } + else if (i == 0) + { + buf->writestring("$(DDOC_SUMMARY "); + sec->write(sc, s, buf); + buf->writestring(")\n"); + } + else + { + buf->writestring("$(DDOC_DESCRIPTION "); sec->write(sc, s, buf); + buf->writestring(")\n"); } } - else - buf->writestring("

    \n"); + buf->writestring(")\n"); + } + else + buf->writestring("$(BR)$(BR)\n"); } /*************************************************** @@ -714,11 +815,9 @@ void Section::write(Scope *sc, Dsymbol *s, OutBuffer *buf) { - buf->writestring("

    "); unsigned o = buf->offset; buf->write(body, bodylen); highlightText(sc, s, buf, o); - buf->writestring("

    \n"); } /*************************************************** @@ -742,7 +841,7 @@ unsigned o; Argument *arg; - buf->writestring("

    \n"); + buf->writestring("$(DDOC_PARAMS \n"); while (p < pend) { // Skip to start of macro @@ -785,6 +884,34 @@ } p++; + if (namelen) + { // Output existing param + + L1: + //printf("param '%.*s' = '%.*s'\n", namelen, namestart, textlen, textstart); + + buf->writestring("$(DDOC_PARAM_ROW "); + buf->writestring("$(DDOC_PARAM_ID "); + o = buf->offset; + arg = isFunctionParameter(s, namestart, namelen); + if (arg && arg->type && arg->ident) + arg->type->toCBuffer(buf, arg->ident); + else + buf->write(namestart, namelen); + highlightCode(sc, s, buf, o); + buf->writestring(")\n"); + + buf->writestring("$(DDOC_PARAM_DESC "); + o = buf->offset; + buf->write(textstart, textlen); + highlightText(sc, s, buf, o); + buf->writestring(")"); + buf->writestring(")\n"); + namelen = 0; + if (p >= pend) + break; + } + namestart = tempstart; namelen = templen; @@ -796,25 +923,6 @@ while (*p != '\n') p++; textlen = p - textstart; - - //printf("param '%.*s' = '%.*s'\n", namelen, namestart, textlen, textstart); - - buf->writestring("\n"); - - buf->writestring("\n"); - p++; Lcont: @@ -825,7 +933,9 @@ while (*p++ != '\n') ; } - buf->writestring("
    "); - o = buf->offset; - arg = isFunctionParameter(s, namestart, namelen); - if (arg && arg->type && arg->ident) - arg->type->toCBuffer(buf, arg->ident); - else - buf->write(namestart, namelen); - highlightCode(sc, s, buf, o); - buf->writestring(""); - o = buf->offset; - buf->write(textstart, textlen); - highlightText(sc, s, buf, o); - buf->writestring("

    \n"); + if (namelen) + goto L1; // write out last one + buf->writestring(")\n"); } /************************************************ @@ -836,10 +946,10 @@ * name2 = value2 */ -void DocComment::doMacros(Macro **pmacrotable) +void DocComment::parseMacros(Macro **pmacrotable, unsigned char *m, unsigned mlen) { - unsigned char *p = macros->body; - unsigned len = macros->bodylen; + unsigned char *p = m; + unsigned len = mlen; unsigned char *pend = p + len; unsigned char *tempstart; @@ -893,6 +1003,16 @@ } p++; + if (namelen) + { // Output existing macro + L1: + //printf("macro '%.*s' = '%.*s'\n", namelen, namestart, textlen, textstart); + Macro::define(pmacrotable, namestart, namelen, textstart, textlen); + namelen = 0; + if (p >= pend) + break; + } + namestart = tempstart; namelen = templen; @@ -905,9 +1025,6 @@ p++; textlen = p - textstart; - //printf("macro '%.*s' = '%.*s'\n", namelen, namestart, textlen, textstart); - Macro::define(pmacrotable, namestart, namelen, textstart, textlen); - p++; //printf("p = %p, pend = %p\n", p, pend); @@ -919,6 +1036,8 @@ while (*p++ != '\n') ; } + if (namelen) + goto L1; // write out last one } /****************************************** @@ -1076,6 +1195,10 @@ int inCode = 0; int inComment = 0; // in comment unsigned iCodeStart; // start of code section + + buf->insert(offset, "$(P ", 4); + offset += 4; + unsigned iLineStart = offset; for (unsigned i = offset; i < buf->offset; i++) @@ -1090,8 +1213,8 @@ case '\n': if (i == iLineStart) // if "\n\n" - { buf->insert(i, "

    \n

    ", 8); - i += 8; // point at last '>' + { buf->insert(i, ")\n$(P ", 6); + i += 6; // point at last '>' } leadingBlank = 1; iLineStart = i + 1; @@ -1205,11 +1328,11 @@ buf->remove(iCodeStart, i - iCodeStart); buf->insert(iCodeStart, codebuf.data, codebuf.offset); i = iCodeStart + codebuf.offset; - buf->insert(i, "\n", 7); + buf->insert(i, ")\n", 2); i += 5; // place i on > } else - { static char pre[] = "

    \n";
    +		    {	static char pre[] = "$(D_CODE \n";
     
     			inCode = 1;
     			buf->insert(i, pre, sizeof(pre) - 1);
    @@ -1234,12 +1357,14 @@
     			}
     			else
     			{
    -			    if (cmp(sid, buf->data + i, j - i) == 0 ||
    -				isKeyword(buf->data + i, j - i))
    +			    if (cmp(sid, buf->data + i, j - i) == 0)
    +			    {
    +				i = buf->bracket(i, "$(DDOC_PSYMBOL ", j, ")") - 1;
    +				break;
    +			    }
    +			    else if (isKeyword(buf->data + i, j - i))
     			    {
    -				buf->insert(i, "", 3);
    -				buf->insert(j + 3, "", 4);
    -				i = j + 7 - 1;
    +				i = buf->bracket(i, "$(DDOC_KEYWORD ", j, ")") - 1;
     				break;
     			    }
     			    else
    @@ -1247,9 +1372,7 @@
     				if (f && isFunctionParameter(f, buf->data + i, j - i))
     				{
     				    //printf("highlighting arg '%s', i = %d, j = %d\n", arg->ident->toChars(), i, j);
    -				    buf->insert(i, "", 3);
    -				    buf->insert(j + 3, "", 4);
    -				    i = j + 7 - 1;
    +				    i = buf->bracket(i, "$(DDOC_PARAM ", j, ")") - 1;
     				    break;
     				}
     			    }
    @@ -1262,6 +1385,7 @@
         }
       Ldone:
         ;
    +    buf->writestring(")\n");
     }
     
     /**************************************************
    @@ -1305,9 +1429,7 @@
     		    {
     			if (cmp(sid, buf->data + i, j - i) == 0)
     			{
    -			    buf->insert(i, "", 3);
    -			    buf->insert(j + 3, "", 4);
    -			    i = j + 7 - 1;
    +			    i = buf->bracket(i, "$(DDOC_PSYMBOL ", j, ")") - 1;
     			    break;
     			}
     			else if (f)
    @@ -1315,9 +1437,7 @@
     			    if (isFunctionParameter(f, buf->data + i, j - i))
     			    {
     				//printf("highlighting arg '%s', i = %d, j = %d\n", arg->ident->toChars(), i, j);
    -				buf->insert(i, "", 3);
    -				buf->insert(j + 3, "", 4);
    -				i = j + 7 - 1;
    +				i = buf->bracket(i, "$(DDOC_PARAM ", j, ")") - 1;
     				break;
     			    }
     			}
    diff -uNr dmd-0.132/dmd/src/dmd/dsymbol.c dmd-0.133/dmd/src/dmd/dsymbol.c
    --- dmd-0.132/dmd/src/dmd/dsymbol.c	2005-09-15 01:19:54.000000000 +0200
    +++ dmd-0.133/dmd/src/dmd/dsymbol.c	2005-09-21 22:04:24.000000000 +0200
    @@ -425,11 +425,17 @@
     
     void Dsymbol::addComment(unsigned char *comment)
     {
    -    //if (comment)
    -	//printf("adding comment '%s' to symbol %p '%s'\n", comment, this, toChars());
    +//    if (comment)
    +//	printf("adding comment '%s' to symbol %p '%s'\n", comment, this, toChars());
     
         if (!this->comment)
     	this->comment = comment;
    +#if 1
    +    else if (comment && strcmp((char *)comment, (char *)this->comment))
    +    {	// Concatenate the two
    +	this->comment = Lexer::combineComments(this->comment, comment);
    +    }
    +#endif
     }
     
     
    diff -uNr dmd-0.132/dmd/src/dmd/lexer.c dmd-0.133/dmd/src/dmd/lexer.c
    --- dmd-0.132/dmd/src/dmd/lexer.c	2005-09-15 17:06:58.000000000 +0200
    +++ dmd-0.133/dmd/src/dmd/lexer.c	2005-09-22 19:08:32.000000000 +0200
    @@ -2119,6 +2119,17 @@
     	    break;
         }
     
    +    /* Remove trailing row of ****'s or ++++'s
    +     */
    +    if (ct != '/')
    +    {
    +	for (; q < qend; qend--)
    +	{
    +	    if (qend[-1] != ct)
    +		break;
    +	}
    +    }
    +
         for (; q < qend; q++)
         {
     	unsigned char c = *q;
    diff -uNr dmd-0.132/dmd/src/dmd/mars.c dmd-0.133/dmd/src/dmd/mars.c
    --- dmd-0.132/dmd/src/dmd/mars.c	2005-09-13 03:26:32.000000000 +0200
    +++ dmd-0.133/dmd/src/dmd/mars.c	2005-09-21 17:22:58.000000000 +0200
    @@ -39,6 +39,7 @@
         mars_ext = "d";
         sym_ext  = "d";
         doc_ext  = "html";
    +    ddoc_ext = "ddoc";
     
     #if _WIN32
         obj_ext  = "obj";
    @@ -50,7 +51,7 @@
     
         copyright = "Copyright (c) 1999-2005 by Digital Mars";
         written = "written by Walter Bright";
    -    version = "v0.132";
    +    version = "v0.133";
         global.structalign = 8;
     
         memset(¶ms, 0, sizeof(Param));
    @@ -142,6 +143,7 @@
       -inline        do function inlining\n\
       -Llinkerflag   pass linkerflag to link\n\
       -O             optimize\n\
    +  -o-            do not write object file\n\
       -odobjdir      write object files to directory objdir\n\
       -offilename	 name output file to filename\n\
       -op            do not strip paths from source file\n\
    @@ -188,10 +190,12 @@
         global.params.useArrayBounds = 1;
         global.params.useSwitchError = 1;
         global.params.useInline = 0;
    +    global.params.obj = 1;
     
         global.params.linkswitches = new Array();
         global.params.libfiles = new Array();
         global.params.objfiles = new Array();
    +    global.params.ddocfiles = new Array();
     
         // Predefine version identifiers
         VersionCondition::addPredefinedGlobalIdent("DigitalMars");
    @@ -252,16 +256,22 @@
     	    {
     		switch (p[2])
     		{
    +		    case '-':
    +			global.params.obj = 0;
    +			break;
    +
     		    case 'd':
     			if (!p[3])
     			    goto Lnoarg;
     			global.params.objdir = p + 3;
     			break;
    +
     		    case 'f':
     			if (!p[3])
     			    goto Lnoarg;
     			global.params.objname = p + 3;
     			break;
    +
     		    case 'p':
     			if (p[3])
     			    goto Lerror;
    @@ -414,6 +424,9 @@
         if (global.params.useUnitTests)
     	global.params.useAssert = 1;
     
    +    if (!global.params.obj)
    +	global.params.link = 0;
    +
         if (global.params.link)
         {
     	global.params.exefile = global.params.objname;
    @@ -471,9 +484,9 @@
     	if (ext)
     	{
     #if TARGET_LINUX
    -	    if (strcmp(ext, "o") == 0)
    +	    if (strcmp(ext, global.obj_ext) == 0)
     #else
    -	    if (stricmp(ext, "obj") == 0)
    +	    if (stricmp(ext, global.obj_ext) == 0)
     #endif
     	    {
     		global.params.objfiles->push(files.data[i]);
    @@ -490,6 +503,12 @@
     		continue;
     	    }
     
    +	    if (strcmp(ext, global.ddoc_ext) == 0)
    +	    {
    +		global.params.ddocfiles->push(files.data[i]);
    +		continue;
    +	    }
    +
     #if !TARGET_LINUX
     	    if (stricmp(ext, "res") == 0)
     	    {
    @@ -510,7 +529,7 @@
     	    }
     #endif
     
    -	    if (stricmp(ext, "d") == 0 ||
    +	    if (stricmp(ext, global.mars_ext) == 0 ||
     		stricmp(ext, "htm") == 0 ||
     		stricmp(ext, "html") == 0)
     	    {
    @@ -613,7 +632,8 @@
     	m = (Module *)modules.data[i];
     	if (global.params.verbose)
     	    printf("code      %s\n", m->toChars());
    -	m->genobjfile();
    +	if (global.params.obj)
    +	    m->genobjfile();
     	if (global.errors)
     	    m->deleteObjFile();
     	else
    diff -uNr dmd-0.132/dmd/src/dmd/mars.h dmd-0.133/dmd/src/dmd/mars.h
    --- dmd-0.132/dmd/src/dmd/mars.h	2005-09-11 02:11:08.000000000 +0200
    +++ dmd-0.133/dmd/src/dmd/mars.h	2005-09-21 15:05:40.000000000 +0200
    @@ -1,5 +1,5 @@
     
    -// Copyright (c) 1999-2004 by Digital Mars
    +// Copyright (c) 1999-2005 by Digital Mars
     // All Rights Reserved
     // written by Walter Bright
     // www.digitalmars.com
    @@ -19,6 +19,7 @@
     // Put command line switches in here
     struct Param
     {
    +    char obj;		// write object file
         char link;		// perform link
         char trace;		// insert profiling hooks
         char quiet;		// suppress non-error messages
    @@ -50,6 +51,7 @@
         char doDocComments;	// process embedded documentation comments
         char *docdir;	// write documentation file to docdir directory
         char *docname;	// write documentation file to docname
    +    Array *ddocfiles;	// macro include files for Ddoc
     
         unsigned debuglevel;	// debug level
         Array *debugids;		// debug identifiers
    @@ -81,7 +83,8 @@
         char *mars_ext;
         char *sym_ext;
         char *obj_ext;
    -    char *doc_ext;
    +    char *doc_ext;	// for Ddoc generated files
    +    char *ddoc_ext;	// for Ddoc macro include files
         char *copyright;
         char *written;
         Array *path;	// Array of char*'s which form the import lookup path
    diff -uNr dmd-0.132/dmd/src/dmd/module.c dmd-0.133/dmd/src/dmd/module.c
    --- dmd-0.132/dmd/src/dmd/module.c	2005-09-14 19:40:42.000000000 +0200
    +++ dmd-0.133/dmd/src/dmd/module.c	2005-09-21 02:16:36.000000000 +0200
    @@ -135,7 +135,8 @@
     
     void Module::deleteObjFile()
     {
    -    objfile->remove();
    +    if (global.params.obj)
    +	objfile->remove();
         if (docfile)
     	docfile->remove();
     }
    diff -uNr dmd-0.132/dmd/src/dmd/root.c dmd-0.133/dmd/src/dmd/root.c
    --- dmd-0.132/dmd/src/dmd/root.c	2005-09-13 19:44:52.000000000 +0200
    +++ dmd-0.133/dmd/src/dmd/root.c	2005-09-23 01:26:46.000000000 +0200
    @@ -1638,6 +1638,21 @@
         offset += 2;
     }
     
    +/******************
    + * Insert left at i, and right at j.
    + * Return index just past right.
    + */
    +
    +unsigned OutBuffer::bracket(unsigned i, char *left, unsigned j, char *right)
    +{
    +    size_t leftlen = strlen(left);
    +    size_t rightlen = strlen(right);
    +    reserve(leftlen + rightlen);
    +    insert(i, left, leftlen);
    +    insert(j + leftlen, right, rightlen);
    +    return j + leftlen + rightlen;
    +}
    +
     void OutBuffer::spread(unsigned offset, unsigned nbytes)
     {
         reserve(nbytes);
    diff -uNr dmd-0.132/dmd/src/dmd/root.h dmd-0.133/dmd/src/dmd/root.h
    --- dmd-0.132/dmd/src/dmd/root.h	2005-09-13 19:28:14.000000000 +0200
    +++ dmd-0.133/dmd/src/dmd/root.h	2005-09-23 01:26:46.000000000 +0200
    @@ -284,6 +284,7 @@
         void printf(const unsigned short *format, ...);
     #endif
         void bracket(char left, char right);
    +    unsigned OutBuffer::bracket(unsigned i, char *left, unsigned j, char *right);
         void spread(unsigned offset, unsigned nbytes);
         void insert(unsigned offset, const void *data, unsigned nbytes);
         void remove(unsigned offset, unsigned nbytes);
    diff -uNr dmd-0.132/dmd/src/dmd/struct.c dmd-0.133/dmd/src/dmd/struct.c
    --- dmd-0.132/dmd/src/dmd/struct.c	2005-08-01 19:25:20.000000000 +0200
    +++ dmd-0.133/dmd/src/dmd/struct.c	2005-09-24 01:45:12.000000000 +0200
    @@ -27,6 +27,7 @@
         this->loc = loc;
     
         storage_class = 0;
    +    protection = PROTpublic;
         type = NULL;
         handle = NULL;
         structsize = 0;		// size of struct
    @@ -43,6 +44,11 @@
         scope = NULL;
     }
     
    +enum PROT AggregateDeclaration::prot()
    +{
    +    return protection;
    +}
    +
     void AggregateDeclaration::semantic2(Scope *sc)
     {   int i;
     
    @@ -234,6 +240,7 @@
         parent = sc->parent;
         handle = type->pointerTo();
         structalign = sc->structalign;
    +    protection = sc->protection;
         assert(!isAnonymous());
         if (sc->stc & STCabstract)
     	error("structs, unions cannot be abstract");
    diff -uNr dmd-0.132/dmd/src/phobos/internal/object.d dmd-0.133/dmd/src/phobos/internal/object.d
    --- dmd-0.132/dmd/src/phobos/internal/object.d	2005-09-19 17:54:38.000000000 +0200
    +++ dmd-0.133/dmd/src/phobos/internal/object.d	2005-09-24 17:25:30.000000000 +0200
    @@ -123,12 +123,11 @@
         uint getHash(void *p) { return cast(uint)p; }
         int equals(void *p1, void *p2) { return p1 == p2; }
         int compare(void *p1, void *p2) { return 0; }
    -    int tsize() { return 0; }
    +    size_t tsize() { return 0; }
         void swap(void *p1, void *p2)
         {
    -	int i;
    -	int n = tsize();
    -	for (i = 0; i < n; i++)
    +	size_t n = tsize();
    +	for (size_t i = 0; i < n; i++)
     	{   byte t;
     
     	    t = (cast(byte *)p1)[i];
    @@ -144,7 +143,7 @@
         uint getHash(void *p) { return base.getHash(p); }
         int equals(void *p1, void *p2) { return base.equals(p1, p2); }
         int compare(void *p1, void *p2) { return base.compare(p1, p2); }
    -    int tsize() { return base.tsize(); }
    +    size_t tsize() { return base.tsize(); }
         void swap(void *p1, void *p2) { return base.swap(p1, p2); }
     
         TypeInfo base;
    @@ -174,7 +173,7 @@
             return *cast(void* *)p1 - *cast(void* *)p2;
         }
     
    -    int tsize()
    +    size_t tsize()
         {
     	return (void*).sizeof;
         }
    @@ -235,7 +234,7 @@
             return cast(int)a1.length - cast(int)a2.length;
         }
     
    -    int tsize()
    +    size_t tsize()
         {
     	return (void[]).sizeof;
         }
    @@ -290,7 +289,7 @@
             return 0;
         }
     
    -    int tsize()
    +    size_t tsize()
         {
     	return len * next.tsize();
         }
    @@ -329,7 +328,7 @@
     
         // BUG: need to add the rest of the functions
     
    -    int tsize()
    +    size_t tsize()
         {
     	return (void[]).sizeof;
         }
    @@ -347,7 +346,7 @@
     
         // BUG: need to add the rest of the functions
     
    -    int tsize()
    +    size_t tsize()
         {
     	return 0;	// no size for functions
         }
    @@ -364,7 +363,7 @@
     
         // BUG: need to add the rest of the functions
     
    -    int tsize()
    +    size_t tsize()
         {	alias int delegate() dg;
     	return dg.sizeof;
         }
    @@ -412,7 +411,7 @@
     	return c;
         }
     
    -    int tsize()
    +    size_t tsize()
         {
     	return Object.sizeof;
         }
    @@ -483,13 +482,13 @@
     	return c;
         }
     
    -    int tsize()
    +    size_t tsize()
         {
     	return xsize;
         }
     
         char[] name;
    -    uint xsize;
    +    size_t xsize;
     
         uint function(void*) xtoHash;
         int function(void*,void*) xopEquals;
    diff -uNr dmd-0.132/dmd/src/phobos/object.d dmd-0.133/dmd/src/phobos/object.d
    --- dmd-0.132/dmd/src/phobos/object.d	2005-09-19 17:54:38.000000000 +0200
    +++ dmd-0.133/dmd/src/phobos/object.d	2005-09-24 17:25:30.000000000 +0200
    @@ -59,7 +59,7 @@
         uint getHash(void *p);
         int equals(void *p1, void *p2);
         int compare(void *p1, void *p2);
    -    int tsize();
    +    size_t tsize();
         void swap(void *p1, void *p2);
     }
     
    @@ -113,7 +113,7 @@
     class TypeInfo_Struct : TypeInfo
     {
         char[] name;
    -    uint xsize;
    +    size_t xsize;
     
         uint function(void*) xtoHash;
         int function(void*,void*) xopEquals;
    diff -uNr dmd-0.132/dmd/src/phobos/std/c/math.d dmd-0.133/dmd/src/phobos/std/c/math.d
    --- dmd-0.132/dmd/src/phobos/std/c/math.d	2005-09-19 17:54:38.000000000 +0200
    +++ dmd-0.133/dmd/src/phobos/std/c/math.d	2005-09-24 17:25:30.000000000 +0200
    @@ -1,7 +1,11 @@
     
    -/* Copyright (C) 2003 by Digital Mars.
    - * All Rights Reserved
    - * www.digitalmars.com
    +/**
    + * Standard C math.h
    + *
    + * Copyright: Public Domain
    + */
    +
    +/* www.digitalmars.com
      */
     
     module std.c.math;
    @@ -11,64 +15,267 @@
     alias float float_t;
     alias double double_t;
     
    -real   acosl(real);
    -real   asinl(real);
    -real   atanl(real);
    -real   atan2l(real, real);
    -real   cosl(real);
    -real   sinl(real);
    -real   tanl(real);
    +const double HUGE_VAL  = double.infinity;
    +const double HUGE_VALF = float.infinity;
    +const double HUGE_VALL = real.infinity;
    +
    +const float INFINITY = float.infinity;
    +const float NAN = float.nan;
    +
    +enum
    +{
    +    FP_NANS,	// extension
    +    FP_NANQ,	// extension
    +    FP_INFINITE,
    +    FP_NAN = FP_NANQ,
    +    FP_NORMAL = 3,
    +    FP_SUBNORMAL = 4,
    +    FP_ZERO = 5,
    +    FP_EMPTY = 6,	// extension
    +    FP_UNSUPPORTED = 7, // extension
    +}
    +
    +enum
    +{
    +    FP_FAST_FMA  = 0,
    +    FP_FAST_FMAF = 0,
    +    FP_FAST_FMAL = 0,
    +}
    +
    +const int FP_ILOGB0   = int.min;
    +const int FP_ILOGBNAN = int.min;
    +
    +const int MATH_ERRNO     = 1;
    +const int MATH_ERREXCEPT = 2;
    +const int math_errhandling   = MATH_ERRNO | MATH_ERREXCEPT;
    +
    +double acos(double x);
    +float  acosf(float x);
    +real   acosl(real x);
    +
    +double asin(double x);
    +float  asinf(float x);
    +real   asinl(real x);
    +
    +double atan(double x);
    +float  atanf(float x);
    +real   atanl(real x);
    +
    +double atan2(double y, double x);
    +float  atan2f(float y, float x);
    +real   atan2l(real y, real x);
    +
    +double cos(double x);
    +float  cosf(float x);
    +real   cosl(real x);
    +
    +double sin(double x);
    +float  sinf(float x);
    +real   sinl(real x);
    +
    +double tan(double x);
    +float  tanf(float x);
    +real   tanl(real x);
    +
    +double acosh(double x);
    +float  acoshf(float x);
     real   acoshl(real x);
    +
    +double asinh(double x);
    +float  asinhf(float x);
     real   asinhl(real x);
    +
    +double atanh(double x);
    +float  atanhf(float x);
     real   atanhl(real x);
    -real   coshl(real);
    -real   sinhl(real);
    -real   tanhl(real);
    -real   expl(real);
    -real   exp2l(real);
    -real   expm1l(real);
    -real   frexpl(real,int *);
    -int    ilogbl(real);
    -real   ldexpl(real, int);
    -real   logl(real);
    -real   log10l(real);
    -real   log1pl(real);
    -real   log2l(real);
    -real   logbl(real);
    -real   modfl(real, real *);
    -real   scalbnl(real, int);
    -real   scalblnl(real, int);
    -real   cbrtl(real);
    -real   fabsl(real);
    -real   hypotl(real, real);
    -real   powl(real, real);
    -real   sqrtl(real);
    +
    +double cosh(double x);
    +float  coshf(float x);
    +real   coshl(real x);
    +
    +double sinh(double x);
    +float  sinhf(float x);
    +real   sinhl(real x);
    +
    +double tanh(double x);
    +float  tanhf(float x);
    +real   tanhl(real x);
    +
    +double exp(double x);
    +float  expf(float x);
    +real   expl(real x);
    +
    +double exp2(double x);
    +float  exp2f(float x);
    +real   exp2l(real x);
    +
    +double expm1(double x);
    +float  expm1f(float x);
    +real   expm1l(real x);
    +
    +double frexp(double value, int *exp);
    +float  frexpf(float value, int *exp);
    +real   frexpl(real value, int *exp);
    +
    +int    ilogb(double x);
    +int    ilogbf(float x);
    +int    ilogbl(real x);
    +
    +double ldexp(double x, int exp);
    +float  ldexpf(float x, int exp);
    +real   ldexpl(real x, int exp);
    +
    +double log(double x);
    +float  logf(float x);
    +real   logl(real x);
    +
    +double log10(double x);
    +float  log10f(float x);
    +real   log10l(real x);
    +
    +double log1p(double x);
    +float  log1pf(float x);
    +real   log1pl(real x);
    +
    +double log2(double x);
    +float  log2f(float x);
    +real   log2l(real x);
    +
    +double logb(double x);
    +float  logbf(float x);
    +real   logbl(real x);
    +
    +double modf(double value, double *iptr);
    +float  modff(float value, float *iptr);
    +real   modfl(real value, real *iptr);
    +
    +double scalbn(double x, int n);
    +float  scalbnf(float x, int n);
    +real   scalbnl(real x, int n);
    +
    +double scalbln(double x, int n);
    +float  scalblnf(float x, int n);
    +real   scalblnl(real x, int n);
    +
    +double cbrt(double x);
    +float  cbrtf(float x);
    +real   cbrtl(real x);
    +
    +double fabs(double x);
    +float  fabsf(float x);
    +real   fabsl(real x);
    +
    +double hypot(double x, double y);
    +float  hypotf(float x, float y);
    +real   hypotl(real x, real y);
    +
    +double pow(double x, double y);
    +float  powf(float x, float y);
    +real   powl(real x, real y);
    +
    +double sqrt(double x);
    +float  sqrtf(float x);
    +real   sqrtl(real x);
    +
    +double erf(double x);
    +float  erff(float x);
     real   erfl(real x);
    +
    +double erfc(double x);
    +float  erfcf(float x);
     real   erfcl(real x);
    +
    +double lgamma(double x);
    +float  lgammaf(float x);
     real   lgammal(real x);
    +
    +double tgamma(double x);
    +float  tgammaf(float x);
     real   tgammal(real x);
    -real   ceill(real);
    -real   floorl(real);
    -real   nearbyintl(real);
    -real   rintl(real);
    +
    +double ceil(double x);
    +float  ceilf(float x);
    +real   ceill(real x);
    +
    +double floor(double x);
    +float  floorf(float x);
    +real   floorl(real x);
    +
    +double nearbyint(double x);
    +float  nearbyintf(float x);
    +real   nearbyintl(real x);
    +
    +double rint(double x);
    +float  rintf(float x);
    +real   rintl(real x);
    +
    +int    lrint(double x);
    +int    lrintf(float x);
     int    lrintl(real x);
    +
    +long   llrint(double x);
    +long   llrintf(float x);
     long   llrintl(real x);
    -real   roundl(real);
    +
    +double round(double x);
    +float  roundf(float x);
    +real   roundl(real x);
    +
    +int    lround(double x);
    +int    lroundf(float x);
     int    lroundl(real x);
    +
    +long   llround(double x);
    +long   llroundf(float x);
     long   llroundl(real x);
    -real   truncl(real);
    -real   fmodl(real, real);
    -real   remainderl(real, real);
    -real   remquol(real, real, int *);
    -real   copysignl(real, real);
    -real   nanl(char *);
    -real   nextafterl(real, real);
    -real   nexttowardl(real, real);
    -real   fdiml(real, real);
    -real   fmaxl(real, real);
    -real   fminl(real, real);
    -real   fmal(real, real, real);
     
    +double trunc(double x);
    +float  truncf(float x);
    +real   truncl(real x);
    +
    +double fmod(double x, double y);
    +float  fmodf(float x, float y);
    +real   fmodl(real x, real y);
    +
    +double remainder(double x, double y);
    +float  remainderf(float x, float y);
    +real   remainderl(real x, real y);
    +
    +double remquo(double x, double y, int *quo);
    +float  remquof(float x, float y, int *quo);
    +real   remquol(real x, real y, int *quo);
    +
    +double copysign(double x, double y);
    +float  copysignf(float x, float y);
    +real   copysignl(real x, real y);
    +
    +double nan(char *tagp);
    +float  nanf(char *tagp);
    +real   nanl(char *tagp);
    +
    +double nextafter(double x, double y);
    +float  nextafterf(float x, float y);
    +real   nextafterl(real x, real y);
    +
    +double nexttoward(double x, real y);
    +float  nexttowardf(float x, real y);
    +real   nexttowardl(real x, real y);
    +
    +double fdim(double x, double y);
    +float  fdimf(float x, float y);
    +real   fdiml(real x, real y);
    +
    +double fmax(double x, double y);
    +float  fmaxf(float x, float y);
    +real   fmaxl(real x, real y);
    +
    +double fmin(double x, double y);
    +float  fminf(float x, float y);
    +real   fminl(real x, real y);
    +
    +double fma(double x, double y, double z);
    +float  fmaf(float x, float y, float z);
    +real   fmal(real x, real y, real z);
     
     int isgreater(real x, real y)		{ return !(x !>  y); }
     int isgreaterequal(real x, real y)	{ return !(x !>= y); }
    diff -uNr dmd-0.132/dmd/src/phobos/std/math.d dmd-0.133/dmd/src/phobos/std/math.d
    --- dmd-0.132/dmd/src/phobos/std/math.d	2005-09-19 17:54:38.000000000 +0200
    +++ dmd-0.133/dmd/src/phobos/std/math.d	2005-09-24 17:25:30.000000000 +0200
    @@ -1,10 +1,14 @@
     // math.d
     
     /**
    - * Boilerplate:
    - *	$(std_boilerplate.html)
      * Macros:
      *	WIKI = StdMath
    + *
    + *	TABLE_SV = 
    + *		
    + *		$0
    Special Values
    + * + * NAN = NAN */ /* @@ -44,8 +48,17 @@ //debug=math; // uncomment to turn on debugging printf's private import std.c.stdio; +private import std.string; private import std.c.math; +class NotImplemented : Error +{ + this(char[] msg) + { + super(msg ~ "not implemented"); + } +} + const real E = 2.7182818284590452354L; /** e */ const real LOG2T = 0x1.a934f0979a3715fcp+1; /** log210 */ // 3.32193 fldl2t const real LOG2E = 0x1.71547652b82fe178p+0; /** log2e */ // 1.4427 fldl2e @@ -80,12 +93,11 @@ /*********************************** * Returns cosine of x. x is in radians. * - * - * - *
    Special Values
    x cos(x) invalid? - *
    NAN NAN yes - *
    ±∞ NAN yes - *
    + * $(TABLE_SV + * $(TR $(TH x) $(TH cos(x)) $(TH invalid?) ) + * $(TR $(TD $(NAN)) $(TD $(NAN)) $(TD yes) ) + * $(TR $(TD ±∞) $(TD $(NAN)) $(TD yes) ) + * ) */ real cos(real x); /* intrinsic */ @@ -93,13 +105,12 @@ /*********************************** * Returns sine of x. x is in radians. * - * - * + * $(TABLE_SV *
    Special Values
    x sin(x) invalid? - *
    NAN NAN yes + *
    $(NAN) $(NAN) yes *
    ±0.0 ±0.0 no - *
    ±∞ NAN yes - *
    + * ±∞ $(NAN) yes + * ) */ real sin(real x); /* intrinsic */ @@ -108,13 +119,12 @@ /**************************************************************************** * Returns tangent of x. x is in radians. * - * - * + * $(TABLE_SV *
    Special Values
    x tan(x) invalid? - *
    NAN NAN yes + *
    $(NAN) $(NAN) yes *
    ±0.0 ±0.0 no - *
    ±∞ NAN yes - *
    + * ±∞ $(NAN) yes + * ) */ real tan(real x) @@ -206,45 +216,129 @@ } } - +/*************** + * Calculates the arc cosine of x, + * returning a value ranging from -π/2 to π/2. + * + * $(TABLE_SV + * x acos(x) invalid? + * >1.0 $(NAN) yes + * <-1.0 $(NAN) yes + * $(NAN) $(NAN) yes + * ) + */ real acos(real x) { return std.c.math.acosl(x); } +/*************** + * Calculates the arc sine of x, + * returning a value ranging from -π/2 to π/2. + * + * $(TABLE_SV + * x asin(x) invalid? + * ±0.0 ±0.0 no + * >1.0 $(NAN) yes + * <-1.0 $(NAN) yes + * ) + */ real asin(real x) { return std.c.math.asinl(x); } + +/*************** + * Calculates the arc tangent of x, + * returning a value ranging from -π/2 to π/2. + * + * $(TABLE_SV + * x atan(x) invalid? + * ±0.0 ±0.0 no + * ±∞ $(NAN) yes + * ) + */ real atan(real x) { return std.c.math.atanl(x); } + +/*************** + * Calculates the arc tangent of y / x, + * returning a value ranging from -π/2 to π/2. + * + * $(TABLE_SV + * x y atan(x, y) + * $(NAN) anything $(NAN) + * anything $(NAN) $(NAN) + * ±0.0 > 0.0 ±0.0 + * ±0.0 ±0.0 ±0.0 + * ±0.0 < 0.0 ±π + * ±0.0 -0.0 ±π + * > 0.0 ±0.0 π/2 + * < 0.0 ±0.0 π/2 + * > 0.0 ∞ ±0.0 + * ±∞ anything ±π/2 + * > 0.0 -∞ ±π + * ±∞ ∞ ±π/4 + * ±∞ -∞ ±3π/4 + * ) + */ real atan2(real x, real y) { return std.c.math.atan2l(x,y); } + +/*********************************** + * Calculates the hyperbolic cosine of x. + * + * $(TABLE_SV + * x cosh(x) invalid? + * ±∞ ±0.0 no + * ) + */ real cosh(real x) { return std.c.math.coshl(x); } + +/*********************************** + * Calculates the hyperbolic sine of x. + * + * $(TABLE_SV + * x sinh(x) invalid? + * ±0.0 ±0.0 no + * ±∞ ±∞ no + * ) + */ real sinh(real x) { return std.c.math.sinhl(x); } + +/*********************************** + * Calculates the hyperbolic tangent of x. + * + * $(TABLE_SV + * x tanh(x) invalid? + * ±0.0 ±0.0 no + * ±∞ ±1.0 no + * ) + */ real tanh(real x) { return std.c.math.tanhl(x); } //real acosh(real x) { return std.c.math.acoshl(x); } //real asinh(real x) { return std.c.math.asinhl(x); } //real atanh(real x) { return std.c.math.atanhl(x); } -real fabs(real x); /* intrinsic */ -real rint(real x); /* intrinsic */ +/***************************************** + * Returns x rounded to a long value using the current rounding mode. + * If the integer value of x is + * greater than long.max, the result is + * indeterminate. + */ long rndtol(real x); /* intrinsic */ -/******************************************* - * Compute n * 2exp - * References: frexp - */ -real ldexp(real n, int exp); /* intrinsic */ +/***************************************** + * Returns x rounded to a long value using the FE_TONEAREST rounding mode. + * If the integer value of x is + * greater than long.max, the result is + * indeterminate. + */ +extern (C) real rndtonl(real x); /*************************************** * Compute square root of x. * - * - * - * - * - * - * - *
    Special Values
    x sqrt(x) invalid? - *
    -0.0 -0.0 no - *
    <0.0 NAN yes - *
    +∞ +∞ no - *
    + * $(TABLE_SV + * x sqrt(x) invalid? + * -0.0 -0.0 no + * <0.0 $(NAN) yes + * +∞ +∞ no + * ) */ float sqrt(float x); /* intrinsic */ @@ -291,13 +385,26 @@ return c; } -/*************************** - * Cube root. +/********************** + * Calculates ex. + * + * $(TABLE_SV + * x exp(x) + * +∞ +∞ + * -∞ +0.0 + * ) */ - -real cbrt(real x) { return std.c.math.cbrtl(x); } - real exp(real x) { return std.c.math.expl(x); } + +/********************** + * Calculates 2x. + * + * $(TABLE_SV + * x exp2(x) + * +∞ +∞ + * -∞ +0.0 + * ) + */ real exp2(real x) { return std.c.math.exp2l(x); } /****************************************** @@ -307,88 +414,548 @@ * For very small x, expm1(x) is more accurate * than exp(x)-1. * - * - * + * $(TABLE_SV *
    Special Values
    x ex-1 *
    ±0.0 ±0.0 *
    +∞ +∞ *
    -∞ -1.0 - *
    + * ) */ real expm1(real x) { return std.c.math.expm1l(x); } -int ilogb(real x) { return std.c.math.ilogbl(x); } + +/********************************************************************* + * Separate floating point value into significand and exponent. + * + * Returns: + *
    Calculate and return x and exp such that + * value =x*2exp and + * .5 <= |x| < 1.0
    + * x has same sign as value. + * + * $(TABLE_SV + * value returns exp + * ±0.0 ±0.0 0 + * +∞ +∞ int.max + * -∞ -∞ int.min + * ±$(NAN) ±$(NAN) int.min + * ) + */ + + +real frexp(real value, out int exp) +{ + ushort* vu = cast(ushort*)&value; + long* vl = cast(long*)&value; + uint ex; + + // If exponent is non-zero + ex = vu[4] & 0x7FFF; + if (ex) + { + if (ex == 0x7FFF) + { // infinity or NaN + if (*vl & 0x7FFFFFFFFFFFFFFF) // if NaN + { *vl |= 0xC000000000000000; // convert $(NAN)S to $(NAN)Q + exp = int.min; + } + else if (vu[4] & 0x8000) + { // negative infinity + exp = int.min; + } + else + { // positive infinity + exp = int.max; + } + } + else + { + exp = ex - 0x3FFE; + vu[4] = (0x8000 & vu[4]) | 0x3FFE; + } + } + else if (!*vl) + { + // value is +-0.0 + exp = 0; + } + else + { // denormal + int i = -0x3FFD; + + do + { + i--; + *vl <<= 1; + } while (*vl > 0); + exp = i; + vu[4] = (0x8000 & vu[4]) | 0x3FFE; + } + return value; +} + + +unittest +{ + static real vals[][3] = // x,frexp,exp + [ + [0.0, 0.0, 0], + [-0.0, -0.0, 0], + [1.0, .5, 1], + [-1.0, -.5, 1], + [2.0, .5, 2], + [155.67e20, 0x1.A5F1C2EB3FE4Fp-1, 74], // normal + [1.0e-320, 0.98829225, -1063], + [real.min, .5, -16381], + [real.min/2.0L, .5, -16382], // denormal + + [real.infinity,real.infinity,int.max], + [-real.infinity,-real.infinity,int.min], + [real.nan,real.nan,int.min], + [-real.nan,-real.nan,int.min], + + // Don't really support signalling nan's in D + //[real.nans,real.nan,int.min], + //[-real.nans,-real.nan,int.min], + ]; + int i; + + for (i = 0; i < vals.length; i++) + { + real x = vals[i][0]; + real e = vals[i][1]; + int exp = cast(int)vals[i][2]; + int eptr; + real v = frexp(x, eptr); + + //printf("frexp(%Lg) = %.8Lg, should be %.8Lg, eptr = %d, should be %d\n", x, v, e, eptr, exp); + assert(mfeq(e, v, .0000001)); + assert(exp == eptr); + } +} + + +/****************************************** + * Extracts the exponent of x as a signed integral value. + * + * If x is not a special value, the result is the same as + * cast(int)logb(x). + * + * $(TABLE_SV + * x ilogb(x) Range error? + * 0 FP_ILOGB0 yes + * ±∞ +∞ no + * $(NAN) FP_ILOGBNAN no + * ) + */ +int ilogb(real x) { return std.c.math.ilogbl(x); } + +alias std.c.math.FP_ILOGB0 FP_ILOGB0; +alias std.c.math.FP_ILOGBNAN FP_ILOGBNAN; + + +/******************************************* + * Compute n * 2exp + * References: frexp + */ + +real ldexp(real n, int exp); /* intrinsic */ /************************************** * Calculate the natural logarithm of x. * - * - * - * - * - * - * - *
    Special Values
    x log(x) divide by 0? invalid? - *
    ±0.0 -∞ yes no - *
    < 0.0 NAN no yes - *
    +∞ +∞ no no - *
    + * $(TABLE_SV + * x log(x) divide by 0? invalid? + * ±0.0 -∞ yes no + * < 0.0 $(NAN) no yes + * +∞ +∞ no no + * ) + */ + +real log(real x) { return std.c.math.logl(x); } + +/************************************** + * Calculate the base-10 logarithm of x. + * + * $(TABLE_SV + * x log10(x) divide by 0? invalid? + * ±0.0 -∞ yes no + * < 0.0 $(NAN) no yes + * +∞ +∞ no no + * ) + */ + +real log10(real x) { return std.c.math.log10l(x); } + +/****************************************** + * Calculates the natural logarithm of 1 + x. + * + * For very small x, log1p(x) will be more accurate than + * log(1 + x). + * + * $(TABLE_SV + * x log1p(x) divide by 0? invalid? + * ±0.0 ±0.0 no no + * -1.0 -∞ yes no + * <-1.0 $(NAN) no yes + * +∞ -∞ no no + * ) + */ + +real log1p(real x) { return std.c.math.log1pl(x); } + +/*************************************** + * Calculates the base-2 logarithm of x: + * log2x + * + * $(TABLE_SV + * x log2(x) divide by 0? invalid? + * ±0.0 -∞ yes no + * < 0.0 $(NAN) no yes + * +∞ +∞ no no + * ) + */ +real log2(real x) { return std.c.math.log2l(x); } + +/***************************************** + * Extracts the exponent of x as a signed integral value. + * + * If x is subnormal, it is treated as if it were normalized. + * For a positive, finite x: + * + *
    + *	1 <= x * FLT_RADIX-logb(x) < FLT_RADIX 
    + *	
    + * + * $(TABLE_SV + * x logb(x) Divide by 0? + * ±∞ +∞ no + * ±0.0 -∞ yes + * ) + */ +real logb(real x) { return std.c.math.logbl(x); } + +/************************************ + * Calculates the remainder from the calculation x/y. + * Returns: + * The value of x - i * y, where i is the number of times that y can + * be completely subtracted from x. The result has the same sign as x. + * + * $(TABLE_SV + * x y modf(x, y) invalid? + * ±0.0 not 0.0 ±0.0 no + * ±∞ anything $(NAN) yes + * anything ±0.0 $(NAN) yes + * !=±∞ ±∞ x no + * ) + */ +real modf(real x, inout real y) { return std.c.math.modfl(x,&y); } + +/************************************* + * Efficiently calculates x * 2n. + * + * scalbn handles underflow and overflow in + * the same fashion as the basic arithmetic operators. + * + * $(TABLE_SV + * x scalb(x) + * ±∞ ±∞ + * ±0.0 ±0.0 + * ) + */ +real scalbn(real x, int n) +{ + version (linux) + return std.c.math.scalbnl(x, n); + else + throw new NotImplemented("scalbn"); +} + +/*************** + * Calculates the cube root x. + * + * $(TABLE_SV + * x cbrt(x) invalid? + * ±0.0 ±0.0 no + * $(NAN) $(NAN) yes + * ±∞ ±∞ no + * ) + */ +real cbrt(real x) { return std.c.math.cbrtl(x); } + + +/******************************* + * Returns |x| + * + * $(TABLE_SV + * x fabs(x) + * ±0.0 +0.0 + * ±∞ +∞ + * ) + */ +real fabs(real x); /* intrinsic */ + + +/*********************************************************************** + * Calculates the length of the + * hypotenuse of a right-angled triangle with sides of length x and y. + * The hypotenuse is the value of the square root of + * the sums of the squares of x and y: + * + * sqrt(x² + y²) + * + * Note that hypot(x, y), hypot(y, x) and + * hypot(x, -y) are equivalent. + * + * $(TABLE_SV + * x y hypot(x, y) invalid? + * x ±0.0 |x| no + * ±∞ y +∞ no + * ±∞ $(NAN) +∞ no + * ) + */ + +real hypot(real x, real y) +{ + /* + * This is based on code from: + * Cephes Math Library Release 2.1: January, 1989 + * Copyright 1984, 1987, 1989 by Stephen L. Moshier + * Direct inquiries to 30 Frost Street, Cambridge, MA 02140 + */ + + const int PRECL = 32; + const int MAXEXPL = real.max_exp; //16384; + const int MINEXPL = real.min_exp; //-16384; + + real xx, yy, b, re, im; + int ex, ey, e; + + // Note, hypot(INFINITY, NAN) = INFINITY. + if (isinf(x) || isinf(y)) + return real.infinity; + + if (isnan(x)) + return x; + if (isnan(y)) + return y; + + re = fabs(x); + im = fabs(y); + + if (re == 0.0) + return im; + if (im == 0.0) + return re; + + // Get the exponents of the numbers + xx = frexp(re, ex); + yy = frexp(im, ey); + + // Check if one number is tiny compared to the other + e = ex - ey; + if (e > PRECL) + return re; + if (e < -PRECL) + return im; + + // Find approximate exponent e of the geometric mean. + e = (ex + ey) >> 1; + + // Rescale so mean is about 1 + xx = ldexp(re, -e); + yy = ldexp(im, -e); + + // Hypotenuse of the right triangle + b = sqrt(xx * xx + yy * yy); + + // Compute the exponent of the answer. + yy = frexp(b, ey); + ey = e + ey; + + // Check it for overflow and underflow. + if (ey > MAXEXPL + 2) + { + //return __matherr(_OVERFLOW, INFINITY, x, y, "hypotl"); + return real.infinity; + } + if (ey < MINEXPL - 2) + return 0.0; + + // Undo the scaling + b = ldexp(b, e); + return b; +} + +unittest +{ + static real vals[][3] = // x,y,hypot + [ + [ 0, 0, 0], + [ 0, -0, 0], + [ 3, 4, 5], + [ -300, -400, 500], + [ real.min, real.min, 4.75473e-4932L], + [ real.max/2, real.max/2, 0x1.6a09e667f3bcc908p+16383L /*8.41267e+4931L*/], + [ real.infinity, real.nan, real.infinity], + [ real.nan, real.nan, real.nan], + ]; + int i; + + for (i = 0; i < vals.length; i++) + { + real x = vals[i][0]; + real y = vals[i][1]; + real z = vals[i][2]; + real h = hypot(x, y); + + //printf("hypot(%Lg, %Lg) = %Lg, should be %Lg\n", x, y, h, z); + //if (!mfeq(z, h, .0000001)) + //printf("%La\n", h); + assert(mfeq(z, h, .0000001)); + } +} + +/********************************** + * Returns the error function of x. + * + * error function + */ +real erf(real x) { return std.c.math.erfl(x); } + +/********************************** + * Returns the complementary error function of x, which is 1 - erf(x). + * + * complementary error function + */ +real erfc(real x) { return std.c.math.erfcl(x); } + +/*********************************** + * Calculates ln |Γ(x)| + */ +real lgamma(real x) +{ + version (linux) + return std.c.math.lgammal(x); + else + throw new NotImplemented("lgamma"); +} + +/*********************************** + * Calculates the gamma function Γ(x) */ +real tgamma(real x) +{ + version (linux) + return std.c.math.tgammal(x); + else + throw new NotImplemented("tgamma"); +} + +/************************************** + * Returns the value of x rounded upward to the next integer + * (toward positive infinity). + */ +real ceil(real x) { return std.c.math.ceill(x); } + +/************************************** + * Returns the value of x rounded downward to the next integer + * (toward negative infinity). + */ +real floor(real x) { return std.c.math.floorl(x); } + +/****************************************** + * Rounds x to the nearest integer value, using the current rounding + * mode. + * + * Unlike the rint functions, nearbyint does not raise the + * FE_INEXACT exception. + */ +real nearbyint(real x) { return std.c.math.nearbyintl(x); } + +/********************************** + * Rounds x to the nearest integer value, using the current rounding + * mode. + * If the return value is not equal to x, the FE_INEXACT + * exception is raised. + * nearbyint performs + * the same operation, but does not set the FE_INEXACT exception. + */ +real rint(real x); /* intrinsic */ + +/*************************************** + * Rounds x to the nearest integer value, using the current rounding + * mode. + */ +long lrint(real x) +{ + version (linux) + return std.c.math.llrintl(x); + else + throw new NotImplemented("lrint"); +} -real log(real x) { return std.c.math.logl(x); } +/******************************************* + * Return the value of x rounded to the nearest integer. + * If the fractional part of x is exactly 0.5, the return value is rounded to + * the even integer. + */ +real round(real x) { return std.c.math.roundl(x); } -/************************************** - * Calculate the base-10 logarithm of x. +/********************************************** + * Return the value of x rounded to the nearest integer. * - * - * - * - * - * - * - *
    Special Values
    x log10(x) divide by 0? invalid? - *
    ±0.0 -∞ yes no - *
    < 0.0 NAN no yes - *
    +∞ +∞ no no - *
    + * If the fractional part of x is exactly 0.5, the return value is rounded + * away from zero. */ +long lround(real x) +{ + version (linux) + return std.c.math.llroundl(x); + else + throw new NotImplemented("lround"); +} -real log10(real x) { return std.c.math.log10l(x); } +/**************************************************** + * Returns the integer portion of x, dropping the fractional portion. + * + * This is also know as "chop" rounding. + */ +real trunc(real x) { return std.c.math.truncl(x); } -/****************************************** - * Calculates the natural logarithm of 1 + x. +/**************************************************** + * Calculate the remainder x REM y, following IEC 60559. * - * For very small x, log1p(x) will be more accurate than - * log(1 + x). + * REM is the value of x - y * n, where n is the integer nearest the exact + * value of x / y. + * If |n - x / y| == 0.5, n is even. + * If the result is zero, it has the same sign as x. + * Otherwise, the sign of the result is the sign of x / y. + * Precision mode has no affect on the remainder functions. * - * - * - * - * - * - * - * - *
    Special Values
    x log1p(x) divide by 0? invalid? - *
    ±0.0 ±0.0 no no - *
    -1.0 -∞ yes no - *
    <-1.0 NAN no yes - *
    +∞ -∞ no no - *
    + * remquo returns n in the parameter n. + * + * $(TABLE_SV + * x y remainder(x, y) n invalid? + * ±0.0 not 0.0 ±0.0 0.0 no + * ±∞ anything $(NAN) ? yes + * anything ±0.0 $(NAN) ? yes + * != ±∞ ±∞ x ? no + * ) */ +real remainder(real x, real y) { return std.c.math.remainderl(x, y); } -real log1p(real x) { return std.c.math.log1pl(x); } - -real log2(real x) { return std.c.math.log2l(x); } -real logb(real x) { return std.c.math.logbl(x); } -real modf(real x, inout real y) { return std.c.math.modfl(x,&y); } -real erf(real x) { return std.c.math.erfl(x); } -real erfc(real x) { return std.c.math.erfcl(x); } -real ceil(real x) { return std.c.math.ceill(x); } -real floor(real x) { return std.c.math.floorl(x); } +real remquo(real x, real y, out int n) /// ditto +{ + version (linux) + return std.c.math.remquol(x, y, &n); + else + throw new NotImplemented("remquo"); +} /********************************* - * Is number a nan? + * Returns !=0 if e is a NaN. */ int isnan(real e) @@ -411,7 +978,7 @@ } /********************************* - * Is number finite? + * Returns !=0 if e is finite. */ int isfinite(real e) @@ -430,16 +997,16 @@ /********************************* - * Is number normalized? + * Returns !=0 if x is normalized. */ /* Need one for each format because subnormal floats might * be converted to normal reals. */ -int isnormal(float f) +int isnormal(float x) { - uint *p = cast(uint *)&f; + uint *p = cast(uint *)&x; uint e; e = *p & 0x7F800000; @@ -540,7 +1107,7 @@ } /********************************* - * Is number infinity? + * Return !=0 if e is ±∞. */ int isinf(real e) @@ -563,7 +1130,7 @@ } /********************************* - * Get sign bit. + * Return 1 if sign bit of e is set, 0 if not. */ int signbit(real e) @@ -586,7 +1153,7 @@ } /********************************* - * Copy sign. + * Return a value composed of to with from's sign bit. */ real copysign(real to, real from) @@ -620,246 +1187,58 @@ assert(isnan(e) && signbit(e)); } -/*********************************************************************** - * Calculates the length of the - * hypotenuse of a right-angled triangle with sides of length x and y. - * The hypotenuse is the value of the square root of - * the sums of the squares of x and y: - * - * sqrt(x² + y²) - * - * Note that hypot(x, y), hypot(y, x) and - * hypot(x, -y) are equivalent. - * - * - * - * - * - * - * - *
    Special Values
    x y hypot(x, y) invalid? - *
    x ±0.0 |x| no - *
    ±∞ y +∞ no - *
    ±∞ NAN +∞ no - *
    +/****************************************** + * Creates a quiet NAN with the information from tagp[] embedded in it. */ +real nan(char[] tagp) { return std.c.math.nanl(toStringz(tagp)); } -real hypot(real x, real y) +/****************************************** + * Calculates the next representable value after x in the direction of y. + * + * If y > x, the result will be the next largest floating-point value; + * if y < x, the result will be the next smallest value. + * If x == y, the result is y. + * The FE_INEXACT and FE_OVERFLOW exceptions will be raised if x is finite and + * the function result is infinite. The FE_INEXACT and FE_UNDERFLOW + * exceptions will be raised if the function value is subnormal, and x is + * not equal to y. + */ +real nextafter(real x, real y) { - /* - * This is based on code from: - * Cephes Math Library Release 2.1: January, 1989 - * Copyright 1984, 1987, 1989 by Stephen L. Moshier - * Direct inquiries to 30 Frost Street, Cambridge, MA 02140 - */ - - const int PRECL = 32; - const int MAXEXPL = real.max_exp; //16384; - const int MINEXPL = real.min_exp; //-16384; - - real xx, yy, b, re, im; - int ex, ey, e; - - // Note, hypot(INFINITY,NAN) = INFINITY. - if (isinf(x) || isinf(y)) - return real.infinity; - - if (isnan(x)) - return x; - if (isnan(y)) - return y; - - re = fabs(x); - im = fabs(y); - - if (re == 0.0) - return im; - if (im == 0.0) - return re; - - // Get the exponents of the numbers - xx = frexp(re, ex); - yy = frexp(im, ey); - - // Check if one number is tiny compared to the other - e = ex - ey; - if (e > PRECL) - return re; - if (e < -PRECL) - return im; - - // Find approximate exponent e of the geometric mean. - e = (ex + ey) >> 1; - - // Rescale so mean is about 1 - xx = ldexp(re, -e); - yy = ldexp(im, -e); - - // Hypotenuse of the right triangle - b = sqrt(xx * xx + yy * yy); - - // Compute the exponent of the answer. - yy = frexp(b, ey); - ey = e + ey; - - // Check it for overflow and underflow. - if (ey > MAXEXPL + 2) - { - //return __matherr(_OVERFLOW, INFINITY, x, y, "hypotl"); - return real.infinity; - } - if (ey < MINEXPL - 2) - return 0.0; - - // Undo the scaling - b = ldexp(b, e); - return b; + version (linux) + return std.c.math.nextafterl(x, y); + else + throw new NotImplemented("nextafter"); } -unittest -{ - static real vals[][3] = // x,y,hypot - [ - [ 0, 0, 0], - [ 0, -0, 0], - [ 3, 4, 5], - [ -300, -400, 500], - [ real.min, real.min, 4.75473e-4932L], - [ real.max/2, real.max/2, 0x1.6a09e667f3bcc908p+16383L /*8.41267e+4931L*/], - [ real.infinity, real.nan, real.infinity], - [ real.nan, real.nan, real.nan], - ]; - int i; - - for (i = 0; i < vals.length; i++) - { - real x = vals[i][0]; - real y = vals[i][1]; - real z = vals[i][2]; - real h = hypot(x, y); - - //printf("hypot(%Lg, %Lg) = %Lg, should be %Lg\n", x, y, h, z); - //if (!mfeq(z, h, .0000001)) - //printf("%La\n", h); - assert(mfeq(z, h, .0000001)); - } -} +//real nexttoward(real x, real y) { return std.c.math.nexttowardl(x, y); } -/********************************************************************* - * Separate floating point value into significand and exponent. - * +/******************************************* + * Returns the positive difference between x and y. * Returns: - *
    Calculate and return x and exp such that - * value =x*2exp and - * .5 <= |x| < 1.0
    - * x has same sign as value. - * * - * - * - * - * - * - * - *
    Special values
    value returns exp - *
    ±0.0 ±0.0 0 - *
    +∞ +∞ int.max - *
    -∞ -∞ int.min - *
    ±NAN ±NAN int.min + *
    x, y fdim(x, y) + *
    x > y x - y + *
    x <= y +0.0 *
    */ +real fdim(real x, real y) { return (x > y) ? x - y : +0.0; } +/**************************************** + * Returns the larger of x and y. + */ +real fmax(real x, real y) { return x > y ? x : y; } -real frexp(real value, out int exp) -{ - ushort* vu = cast(ushort*)&value; - long* vl = cast(long*)&value; - uint ex; - - // If exponent is non-zero - ex = vu[4] & 0x7FFF; - if (ex) - { - if (ex == 0x7FFF) - { // infinity or NaN - if (*vl & 0x7FFFFFFFFFFFFFFF) // if NaN - { *vl |= 0xC000000000000000; // convert NANS to NANQ - exp = int.min; - } - else if (vu[4] & 0x8000) - { // negative infinity - exp = int.min; - } - else - { // positive infinity - exp = int.max; - } - } - else - { - exp = ex - 0x3FFE; - vu[4] = (0x8000 & vu[4]) | 0x3FFE; - } - } - else if (!*vl) - { - // value is +-0.0 - exp = 0; - } - else - { // denormal - int i = -0x3FFD; - - do - { - i--; - *vl <<= 1; - } while (*vl > 0); - exp = i; - vu[4] = (0x8000 & vu[4]) | 0x3FFE; - } - return value; -} - - -unittest -{ - static real vals[][3] = // x,frexp,exp - [ - [0.0, 0.0, 0], - [-0.0, -0.0, 0], - [1.0, .5, 1], - [-1.0, -.5, 1], - [2.0, .5, 2], - [155.67e20, 0x1.A5F1C2EB3FE4Fp-1, 74], // normal - [1.0e-320, 0.98829225, -1063], - [real.min, .5, -16381], - [real.min/2.0L, .5, -16382], // denormal - - [real.infinity,real.infinity,int.max], - [-real.infinity,-real.infinity,int.min], - [real.nan,real.nan,int.min], - [-real.nan,-real.nan,int.min], - - // Don't really support signalling nan's in D - //[real.nans,real.nan,int.min], - //[-real.nans,-real.nan,int.min], - ]; - int i; - - for (i = 0; i < vals.length; i++) - { - real x = vals[i][0]; - real e = vals[i][1]; - int exp = cast(int)vals[i][2]; - int eptr; - real v = frexp(x, eptr); +/**************************************** + * Returns the smaller of x and y. + */ +real fmin(real x, real y) { return x < y ? x : y; } - //printf("frexp(%Lg) = %.8Lg, should be %.8Lg, eptr = %d, should be %d\n", x, v, e, eptr, exp); - assert(mfeq(e, v, .0000001)); - assert(exp == eptr); - } -} +/************************************** + * Returns (x * y) + z, rounding only once according to the + * current rounding mode. + */ +real fma(real x, real y, real z) { return (x * y) + z; } /******************************************************************* * Fast integral powers. @@ -909,6 +1288,49 @@ return pow(x, cast(uint)n); } +/********************************************* + * Calculates xy. + * + * $(TABLE_SV + * + * x y pow(x, y) div 0 invalid? + * + * anything ±0.0 1.0 no no + * + * |x| > 1 +∞ +∞ no no + * + * |x| < 1 +∞ +0.0 no no + * + * |x| > 1 -∞ +0.0 no no + * + * |x| < 1 -∞ +∞ no no + * + * +∞ > 0.0 +∞ no no + * + * +∞ < 0.0 +0.0 no no + * + * -∞ odd integer > 0.0 -∞ no no + * + * -∞ > 0.0, not odd integer +∞ no no + * + * -∞ odd integer < 0.0 -0.0 no no + * + * -∞ < 0.0, not odd integer +0.0 no no + * + * ±1.0 ±∞ $(NAN) no yes + * + * < 0.0 finite, nonintegral $(NAN) no yes + * + * ±0.0 odd integer < 0.0 ±∞ yes no + * + * ±0.0 < 0.0, not odd integer +∞ yes no + * + * ±0.0 odd integer > 0.0 ±0.0 no no + * + * ±0.0 > 0.0, not odd integer +0.0 no no + * ) + */ + real pow(real x, real y) { version (linux) // C pow() often does not handle special values correctly @@ -917,7 +1339,7 @@ return real.nan; if (y == 0) - return 1; // even if x is NAN + return 1; // even if x is $(NAN) if (isnan(x) && y != 0) return real.nan; if (isinf(y)) @@ -1046,21 +1468,14 @@ * Returns: the number of mantissa bits which are equal in x and y. * eg, 0x1.F8p+60 and 0x1.F1p+60 are equal to 5 bits of precision. * - * - * - * - * - * - * - * - * - *
    Special values
    x y feqrel(x, y) - *
    x x real.mant_dig - *
    x >= 2*x 0 - *
    x <= x/2 0 - *
    NAN any 0 - *
    any NAN 0 - *
    + * $(TABLE_SV + * x y feqrel(x, y) + * x x real.mant_dig + * x >= 2*x 0 + * x <= x/2 0 + * $(NAN) any 0 + * any $(NAN) 0 + * ) */ int feqrel(real x, real y) diff -uNr dmd-0.132/dmd/src/phobos/std/path.d dmd-0.133/dmd/src/phobos/std/path.d --- dmd-0.132/dmd/src/phobos/std/path.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/path.d 2005-09-24 17:25:30.000000000 +0200 @@ -1,7 +1,5 @@ /** - * Boilerplate: - * $(std_boilerplate.html) * Macros: * WIKI = StdPath * Copyright: diff -uNr dmd-0.132/dmd/src/phobos/std/stream.d dmd-0.133/dmd/src/phobos/std/stream.d --- dmd-0.132/dmd/src/phobos/std/stream.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/stream.d 2005-09-24 17:25:30.000000000 +0200 @@ -1,6 +1,4 @@ /** - * Boilerplate: - * $(std_boilerplate.html) * Macros: * WIKI = StdStream */ diff -uNr dmd-0.132/dmd/src/phobos/std/string.d dmd-0.133/dmd/src/phobos/std/string.d --- dmd-0.132/dmd/src/phobos/std/string.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/string.d 2005-09-24 17:25:30.000000000 +0200 @@ -1,21 +1,25 @@ -/* - * Written by Walter Bright - * Digital Mars - * www.digitalmars.com - * Placed into Public Domain. - */ - -// String handling functions. -// -// To copy or not to copy? -// -// When a function takes a string as a parameter, and returns a string, -// is that string the same as the input string, modified in place, or -// is it a modified copy of the input string? The D array convention is -// "copy-on-write". This means that if no modifications are done, the -// original string (or slices of it) can be returned. If any modifications -// are done, the returned string is a copy. -// + +/** + * String handling functions. + * + * To copy or not to copy? + * When a function takes a string as a parameter, and returns a string, + * is that string the same as the input string, modified in place, or + * is it a modified copy of the input string? The D array convention is + * "copy-on-write". This means that if no modifications are done, the + * original string (or slices of it) can be returned. If any modifications + * are done, the returned string is a copy. + * + * Macros: + * WIKI = StdString + * Copyright: + * Public Domain + */ + +/* Author: + * Walter Bright, Digital Mars, www.digitalmars.com + */ + // The code is not optimized for speed, that will have to wait // until the design is solidified. @@ -55,26 +59,27 @@ int wcscmp(wchar *, wchar *); } -/************** Exceptions ****************/ +/* ************* Exceptions *************** */ +/// Thrown on errors in string functions. class StringException : Exception { - this(char[] msg) + this(char[] msg) /// Constructor { super(msg); } } -/************** Constants ****************/ +/* ************* Constants *************** */ -const char[16] hexdigits = "0123456789ABCDEF"; -const char[10] digits = "0123456789"; -const char[8] octdigits = "01234567"; -const char[26] lowercase = "abcdefghijklmnopqrstuvwxyz"; -const char[26] uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; +const char[16] hexdigits = "0123456789ABCDEF"; /// 0..9A..F +const char[10] digits = "0123456789"; /// 0..9 +const char[8] octdigits = "01234567"; /// 0..7 +const char[26] lowercase = "abcdefghijklmnopqrstuvwxyz"; /// a..z +const char[26] uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; /// A..Z const char[52] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz"; -const char[6] whitespace = " \t\v\r\n\f"; + "abcdefghijklmnopqrstuvwxyz"; /// A..Za..z +const char[6] whitespace = " \t\v\r\n\f"; /// ASCII whitespace /********************************** * Returns !=0 if c is whitespace @@ -86,7 +91,7 @@ } /********************************* - * Convert string to integer / real. + * Convert string to integer. */ long atoi(char[] s) @@ -95,7 +100,7 @@ } /************************************* - * Convert string to float + * Convert string to real. */ real atof(char[] s) @@ -107,16 +112,18 @@ } /********************************** - * Compare two strings. + * Compare two strings. cmp is case sensitive, icmp is case insensitive. * Returns: - * <0 s1 < s2 - * =0 s1 == s2 - * >0 s1 > s2 + * + *
    < 0 s1 < s2 + *
    = 0 s1 == s2 + *
    > 0 s1 > s2 + *
    */ int cmp(char[] s1, char[] s2) { - uint len = s1.length; + size_t len = s1.length; int result; //printf("cmp('%.*s', '%.*s')\n", s1, s2); @@ -129,12 +136,12 @@ } /********************************* - * Same as cmp() but case insensitive. + * ditto */ int icmp(char[] s1, char[] s2) { - uint len = s1.length; + size_t len = s1.length; int result; if (s2.length < len) @@ -145,7 +152,7 @@ } version (linux) { - for (int i = 0; i < len; i++) + for (size_t i = 0; i < len; i++) { if (s1[i] != s2[i]) { @@ -188,52 +195,57 @@ assert(result > 0); } -/********************************* +/* ******************************** * Converts a D array of chars to a C-style 0 terminated string. + * Deprecated: replaced with toStringz(). */ -deprecated char* toCharz(char[] string) +deprecated char* toCharz(char[] s) { - return toStringz(string); + return toStringz(s); } -char* toStringz(char[] string) +/********************************* + * Convert array of chars s[] to a C-style 0 terminated string. + */ + +char* toStringz(char[] s) in { } out (result) { if (result) - { assert(strlen(result) == string.length); - assert(memcmp(result, string, string.length) == 0); + { assert(strlen(result) == s.length); + assert(memcmp(result, s, s.length) == 0); } } body { char[] copy; - if (string.length == 0) + if (s.length == 0) return ""; /+ Unfortunately, this isn't reliable. We could make this work if string literals are put - in read-only memory and we test if string[] is pointing into + in read-only memory and we test if s[] is pointing into that. - /* Peek past end of string[], if it's 0, no conversion necessary. + /* Peek past end of s[], if it's 0, no conversion necessary. * Note that the compiler will put a 0 past the end of static * strings, and the storage allocator will put a 0 past the end * of newly allocated char[]'s. */ - char* p = &string[0] + string.length; + char* p = &s[0] + s.length; if (*p == 0) - return string; + return s; +/ // Need to make a copy - copy = new char[string.length + 1]; - copy[0..string.length] = string; - copy[string.length] = 0; + copy = new char[s.length + 1]; + copy[0..s.length] = s; + copy[s.length] = 0; return copy; } @@ -253,9 +265,12 @@ } /****************************************** - * Find first occurrance of c in string s. - * Return index in s where it is found. - * Return -1 if not found. + * find, ifind _find first occurrance of c in string s. + * rfind, irfind _find last occurrance of c in string s. + * + * find, rfind are case sensitive; ifind, irfind are case insensitive. + * Returns: + * Index in s where c is found, -1 if not found. */ int find(char[] s, dchar c) @@ -298,7 +313,7 @@ /****************************************** - * Case insensitive version of find(). + * ditto */ int ifind(char[] s, dchar c) @@ -358,18 +373,16 @@ /****************************************** - * Find last occurrance of c in string s. - * Return index in s where it is found. - * Return -1 if not found. + * ditto */ int rfind(char[] s, dchar c) { - int i; + size_t i; if (c <= 0x7F) { // Plain old ASCII - for (i = s.length; i-- > 0;) + for (i = s.length; i-- != 0;) { if (s[i] == c) break; @@ -401,7 +414,7 @@ } /****************************************** - * Case insensitive version of rfind(). + * ditto */ int irfind(char[] s, dchar c) @@ -412,7 +425,7 @@ { // Plain old ASCII char c1 = std.ctype.tolower(c); - for (i = s.length; i-- > 0;) + for (i = s.length; i-- != 0;) { char c2 = s[i]; c2 = std.ctype.tolower(c2); @@ -424,7 +437,7 @@ { // c is a universal character dchar c1 = std.uni.toUniLower(c); - for (i = s.length; i-- > 0;) + for (i = s.length; i-- != 0;) { char cx = s[i]; if (cx <= 0x7F) @@ -469,10 +482,13 @@ } -/************************************* - * Find first occurrance of sub[] in string s[]. - * Return index in s[] where it is found. - * Return -1 if not found. +/****************************************** + * find, ifind _find first occurrance of sub[] in string s[]. + * rfind, irfind _find last occurrance of sub[] in string s[]. + * + * find, rfind are case sensitive; ifind, irfind are case insensitive. + * Returns: + * Index in s where c is found, -1 if not found. */ int find(char[] s, char[] sub) @@ -489,7 +505,7 @@ } body { - int sublength = sub.length; + size_t sublength = sub.length; if (sublength == 0) return 0; @@ -503,13 +519,13 @@ } else { - int imax = s.length - sublength + 1; + size_t imax = s.length - sublength + 1; // Remainder of sub[] char *q = &sub[1]; sublength--; - for (int i = 0; i < imax; i++) + for (size_t i = 0; i < imax; i++) { char *p = memchr(&s[i], c, imax - i); if (!p) @@ -543,8 +559,8 @@ assert(i == 6); } -/************************************* - * Case insensitive version of find(). +/****************************************** + * ditto */ int ifind(char[] s, char[] sub) @@ -561,7 +577,7 @@ } body { - int sublength = sub.length; + size_t sublength = sub.length; int i; if (sublength == 0) @@ -577,7 +593,7 @@ } else if (c <= 0x7F) { - int imax = s.length - sublength + 1; + size_t imax = s.length - sublength + 1; // Remainder of sub[] char[] subn = sub[1 .. sublength]; @@ -595,7 +611,7 @@ } else { - int imax = s.length - sublength; + size_t imax = s.length - sublength; for (i = 0; i < imax; i++) { @@ -649,10 +665,8 @@ assert(i == -1); } -/************************************* - * Find last occurrance of sub in string s. - * Return index in s where it is found. - * Return -1 if not found. +/****************************************** + * ditto */ int rfind(char[] s, char[] sub) @@ -705,8 +719,8 @@ } -/************************************* - * Case insensitive version of rfind(). +/****************************************** + * ditto */ int irfind(char[] s, char[] sub) @@ -791,7 +805,7 @@ /************************************ - * Convert string to lower case. + * Convert string s[] to lower case. */ char[] tolower(char[] s) @@ -846,7 +860,7 @@ } /************************************ - * Convert string to upper case. + * Convert string s[] to upper case. */ char[] toupper(char[] s) @@ -902,7 +916,7 @@ /******************************************** - * Capitalize first character of string, convert rest of string + * Capitalize first character of string s[], convert rest of string s[] * to lower case. */ @@ -967,7 +981,7 @@ /******************************************** - * Capitalize all words in string. + * Capitalize all words in string s[]. * Remove leading and trailing whitespace. * Replace all sequences of whitespace with a single space. */ @@ -1075,13 +1089,13 @@ /******************************************** - * Concatenate all the strings together into one + * Concatenate all the strings in words[] together into one * string; use sep[] as the separator. */ char[] join(char[][] words, char[] sep) { - uint len; + size_t len; uint seplen; uint i; uint j; @@ -1613,7 +1627,7 @@ /******************************************* - * Left justify, right justify, or center string + * Left justify, right justify, or center string s[] * in field width chars wide. */ @@ -1627,6 +1641,7 @@ return r; } +/// ditto char[] rjustify(char[] s, int width) { if (s.length >= width) @@ -1637,6 +1652,7 @@ return r; } +/// ditto char[] center(char[] s, int width) { if (s.length >= width) @@ -1676,7 +1692,7 @@ /***************************************** - * Same as rjustify(), but fill with '0's + * Same as rjustify(), but fill with '0's. */ char[] zfill(char[] s, int width) @@ -1731,8 +1747,9 @@ assert(i == 0); } -//////////////////////////////////////////////////////// -// Return a string that is string[] with slice[] replaced by replacement[]. +/***************************** + * Return a _string that is string[] with slice[] replaced by replacement[]. + */ char[] replaceSlice(char[] string, char[] slice, char[] replacement) in @@ -1774,7 +1791,7 @@ * Insert sub[] into s[] at location index. */ -char[] insert(char[] s, int index, char[] sub) +char[] insert(char[] s, size_t index, char[] sub) in { assert(0 <= index && index <= s.length); @@ -2021,6 +2038,7 @@ return b ? "true" : "false"; } +/// ditto char[] toString(char c) { char[] result = new char[2]; @@ -2043,9 +2061,10 @@ assert(s2 == "foo"); } -char[] toString(ubyte ub) { return toString(cast(uint) ub); } -char[] toString(ushort us) { return toString(cast(uint) us); } +char[] toString(ubyte ub) { return toString(cast(uint) ub); } /// ditto +char[] toString(ushort us) { return toString(cast(uint) us); } /// ditto +/// ditto char[] toString(uint u) { char[uint.sizeof * 3] buffer = void; int ndigits; @@ -2091,6 +2110,7 @@ assert(i == 0); } +/// ditto char[] toString(ulong u) { char[ulong.sizeof * 3] buffer; int ndigits; @@ -2132,9 +2152,10 @@ assert(i == 0); } -char[] toString(byte b) { return toString(cast(int) b); } -char[] toString(short s) { return toString(cast(int) s); } +char[] toString(byte b) { return toString(cast(int) b); } /// ditto +char[] toString(short s) { return toString(cast(int) s); } /// ditto +/// ditto char[] toString(int i) { char[1 + int.sizeof * 3] buffer; char c; @@ -2190,6 +2211,7 @@ assert(i == 0); } +/// ditto char[] toString(long i) { char[1 + long.sizeof * 3] buffer; char c; @@ -2247,8 +2269,10 @@ assert(i == 0); } +/// ditto char[] toString(float f) { return toString(cast(double) f); } +/// ditto char[] toString(double d) { char[20] buffer; @@ -2257,6 +2281,7 @@ return toString(buffer).dup; } +/// ditto char[] toString(real r) { char[20] buffer; @@ -2265,8 +2290,10 @@ return toString(buffer).dup; } +/// ditto char[] toString(ifloat f) { return toString(cast(idouble) f); } +/// ditto char[] toString(idouble d) { char[21] buffer; @@ -2275,6 +2302,7 @@ return toString(buffer).dup; } +/// ditto char[] toString(ireal r) { char[21] buffer; @@ -2283,8 +2311,10 @@ return toString(buffer).dup; } +/// ditto char[] toString(cfloat f) { return toString(cast(cdouble) f); } +/// ditto char[] toString(cdouble d) { char[20 + 1 + 20 + 1] buffer; @@ -2293,6 +2323,7 @@ return toString(buffer).dup; } +/// ditto char[] toString(creal r) { char[20 + 1 + 20 + 1] buffer; @@ -2301,6 +2332,13 @@ return toString(buffer).dup; } +/****************************************** + * Convert value to string in _radix radix. + * + * radix must be a value from 2 to 36. + * value is treated as a signed value only if radix is 10. + * The characters A through Z are used to represent values 10 through 36. + */ char[] toString(long value, uint radix) in { @@ -2313,6 +2351,7 @@ return toString(cast(ulong)value, radix); } +/// ditto char[] toString(ulong value, uint radix) in { @@ -2361,7 +2400,7 @@ } /************************************************* - * Convert to char[]. + * Convert C-style 0 terminated string s to char[] string. */ char[] toString(char *s) @@ -2387,6 +2426,7 @@ /***************************************************** + * Format arguments into a string. */ @@ -2404,6 +2444,11 @@ } +/***************************************************** + * Format arguments into string s which must be large + * enough to hold the result. Throws ArrayBoundsError if it is not. + * Returns: s + */ char[] sformat(char[] s, ...) { size_t i; @@ -2476,6 +2521,21 @@ /*********************************************** * See if character c is in the pattern. + * Patterns: + * + * A pattern is an array of characters much like a character + * class in regular expressions. A sequence of characters + * can be given, such as "abcde". The '-' can represent a range + * of characters, as "a-e" represents the same pattern as "abcde". + * "a-fA-F0-9" represents all the hex characters. + * If the first character of a pattern is '^', then the pattern + * is negated, i.e. "^0-9" means any character except a digit. + * The functions inPattern, countchars, removeschars, + * and squeeze + * use patterns. + * + * Note: In the future, the pattern syntax may be improved + * to be more like regular expression character classes. */ int inPattern(dchar c, char[] pattern) @@ -2653,7 +2713,7 @@ /*************************************************** - * Return string where sequences of a character from pattern + * Return string where sequences of a character in s[] from pattern[] * are replaced with a single instance of that character. * If pattern is null, it defaults to all characters. */ @@ -2723,7 +2783,7 @@ /********************************************** - * Return string that is the 'successor' to s. + * Return string that is the 'successor' to s[]. * If the rightmost character is a-zA-Z0-9, it is incremented within * its case or digits. If it generates a carry, the process is * repeated with the one to its immediate left. @@ -2794,7 +2854,33 @@ /*********************************************** - * Translate characters in from[] to characters in to[]. + * Replaces characters in str[] that are in from[] + * with corresponding characters in to[] and returns the resulting + * string. + * Params: + * modifiers = a string of modifier characters + * Modifiers: + +
    Modifier Description +
    c Complement the list of characters in from[] +
    d Removes matching characters with no corresponding replacement in to[] +
    s Removes adjacent duplicates in the replaced characters +
    + + If modifier d is present, then the number of characters + in to[] may be only 0 or 1. + + If modifier d is not present and to[] is null, + then to[] is taken _to be the same as from[]. + + If modifier d is not present and to[] is shorter + than from[], then to[] is extended by replicating the + last character in to[]. + + Both from[] and to[] may contain ranges using the - + character, for example a-d is synonymous with abcd. + Neither accept a leading ^ as meaning the complement of + the string (use the c modifier for that). */ char[] tr(char[] str, char[] from, char[] to, char[] modifiers = null) @@ -2949,7 +3035,7 @@ } -/************************************************* +/* ************************************************ * Version : v0.3 * Author : David L. 'SpottedTiger' Davis * Date Created : 31.May.05 Compiled and Tested with dmd v0.125 @@ -2960,43 +3046,41 @@ * Licence : Public Domain / Contributed to Digital Mars */ -/+ - ' final bool isNumeric(in char[], in bool = false) - ' --------------------------------------------------------------- - ' [in] char[] s can be formatted in the following ways: - ' - ' Integer Whole Number: - ' (for byte, ubyte, short, ushort, int, uint, long, and ulong) - ' ['+'|'-']digit(s)[U|L|UL] - ' - ' examples: 123, 123UL, 123L, +123U, -123L - ' - ' Floating-Point Number: - ' (for float, double, real, ifloat, idouble, and ireal) - ' ['+'|'-']digit(s)[.][digit(s)][[e-|e+]digit(s)][i|f|L|Li|fi]] - ' or [nan|nani|inf|-inf] - ' - ' examples: +123., -123.01, 123.3e-10f, 123.3e-10fi, 123.3e-10L - ' - ' (for cfloat, cdouble, and creal) - ' ['+'|'-']digit(s)[.][digit(s)][[e-|e+]digit(s)][+] - ' [digit(s)[.][digit(s)][[e-|e+]digit(s)][i|f|L|Li|fi]] - ' or [nan|nani|nan+nani|inf|-inf] - ' - ' examples: nan, -123e-1+456.9e-10Li, +123e+10+456i, 123+456 - ' - ' [in] bool bAllowSep - ' False by default, but when set to true it will accept the - ' separator characters "," and "_" within the string, but these - ' characters should be stripped from the string before using any - ' of the conversion functions like toInt(), toFloat(), and etc - ' else an error will occur. - ' - ' Also please note, that no spaces are allowed within the string - ' anywhere whether it's a leading, trailing, or embedded space(s), - ' thus they too must be stripped from the string before using this - ' function, or any of the conversion functions. - +/ +/** + * [in] char[] s can be formatted in the following ways: + * + * Integer Whole Number: + * (for byte, ubyte, short, ushort, int, uint, long, and ulong) + * ['+'|'-']digit(s)[U|L|UL] + * + * examples: 123, 123UL, 123L, +123U, -123L + * + * Floating-Point Number: + * (for float, double, real, ifloat, idouble, and ireal) + * ['+'|'-']digit(s)[.][digit(s)][[e-|e+]digit(s)][i|f|L|Li|fi]] + * or [nan|nani|inf|-inf] + * + * examples: +123., -123.01, 123.3e-10f, 123.3e-10fi, 123.3e-10L + * + * (for cfloat, cdouble, and creal) + * ['+'|'-']digit(s)[.][digit(s)][[e-|e+]digit(s)][+] + * [digit(s)[.][digit(s)][[e-|e+]digit(s)][i|f|L|Li|fi]] + * or [nan|nani|nan+nani|inf|-inf] + * + * examples: nan, -123e-1+456.9e-10Li, +123e+10+456i, 123+456 + * + * [in] bool bAllowSep + * False by default, but when set to true it will accept the + * separator characters "," and "_" within the string, but these + * characters should be stripped from the string before using any + * of the conversion functions like toInt(), toFloat(), and etc + * else an error will occur. + * + * Also please note, that no spaces are allowed within the string + * anywhere whether it's a leading, trailing, or embedded space(s), + * thus they too must be stripped from the string before using this + * function, or any of the conversion functions. + */ final bool isNumeric(in char[] s, in bool bAllowSep = false) { @@ -3140,13 +3224,13 @@ return true; } -// Allow any object as a parameter +/// Allow any object as a parameter bool isNumeric(...) { return isNumeric(_arguments, _argptr); } -// Check only the first parameter, all others will be ignored. +/// Check only the first parameter, all others will be ignored. bool isNumeric(TypeInfo[] _arguments, va_list _argptr) { char[] s = ""; diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aa.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aa.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aa.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aa.d 2005-09-24 17:25:30.000000000 +0200 @@ -18,7 +18,7 @@ } else { - uint len = s.length; + size_t len = s.length; char *str = s; while (1) @@ -73,7 +73,7 @@ return std.string.cmp(s1, s2); } - int tsize() + size_t tsize() { return (char[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Abit.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Abit.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Abit.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Abit.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { ubyte[] s = *cast(ubyte[]*)p; - uint len = (s.length + 7) / 8; + size_t len = (s.length + 7) / 8; ubyte *str = s; uint hash = 0; @@ -53,13 +53,13 @@ bit[] s1 = *cast(bit[]*)p1; bit[] s2 = *cast(bit[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length != len) return 0;; // Woefully inefficient bit-by-bit comparison - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { if (s1[u] != s2[u]) return 0; @@ -72,13 +72,13 @@ bit[] s1 = *cast(bit[]*)p1; bit[] s2 = *cast(bit[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; // Woefully inefficient bit-by-bit comparison - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -87,7 +87,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (bit[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_AC.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_AC.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_AC.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_AC.d 2005-09-24 17:25:30.000000000 +0200 @@ -75,7 +75,7 @@ return c; } - int tsize() + size_t tsize() { return (Object[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Acdouble.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Acdouble.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Acdouble.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Acdouble.d 2005-09-24 17:25:30.000000000 +0200 @@ -32,7 +32,7 @@ uint getHash(void *p) { cdouble[] s = *cast(cdouble[]*)p; - uint len = s.length; + size_t len = s.length; cdouble *str = s; uint hash = 0; @@ -54,7 +54,7 @@ { cdouble[] s1 = *cast(cdouble[]*)p1; cdouble[] s2 = *cast(cdouble[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (len != s2.length) return 0; @@ -71,7 +71,7 @@ { cdouble[] s1 = *cast(cdouble[]*)p1; cdouble[] s2 = *cast(cdouble[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; @@ -84,7 +84,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (cdouble[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Acfloat.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Acfloat.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Acfloat.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Acfloat.d 2005-09-24 17:25:30.000000000 +0200 @@ -32,7 +32,7 @@ uint getHash(void *p) { cfloat[] s = *cast(cfloat[]*)p; - uint len = s.length; + size_t len = s.length; cfloat *str = s; uint hash = 0; @@ -52,7 +52,7 @@ { cfloat[] s1 = *cast(cfloat[]*)p1; cfloat[] s2 = *cast(cfloat[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (len != s2.length) return 0; @@ -69,7 +69,7 @@ { cfloat[] s1 = *cast(cfloat[]*)p1; cfloat[] s2 = *cast(cfloat[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; @@ -82,7 +82,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (cfloat[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Acreal.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Acreal.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Acreal.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Acreal.d 2005-09-24 17:25:30.000000000 +0200 @@ -32,7 +32,7 @@ uint getHash(void *p) { creal[] s = *cast(creal[]*)p; - uint len = s.length; + size_t len = s.length; creal *str = s; uint hash = 0; @@ -55,7 +55,7 @@ { creal[] s1 = *cast(creal[]*)p1; creal[] s2 = *cast(creal[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (len != s2.length) return 0; @@ -72,7 +72,7 @@ { creal[] s1 = *cast(creal[]*)p1; creal[] s2 = *cast(creal[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; @@ -85,7 +85,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (creal[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Adchar.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Adchar.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Adchar.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Adchar.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { dchar[] s = *cast(dchar[]*)p; - uint len = s.length; + size_t len = s.length; dchar *str = s; uint hash = 0; @@ -37,11 +37,11 @@ { dchar[] s1 = *cast(dchar[]*)p1; dchar[] s2 = *cast(dchar[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -50,7 +50,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (dchar[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Adouble.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Adouble.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Adouble.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Adouble.d 2005-09-24 17:25:30.000000000 +0200 @@ -32,7 +32,7 @@ uint getHash(void *p) { double[] s = *cast(double[]*)p; - uint len = s.length; + size_t len = s.length; double *str = s; uint hash = 0; @@ -52,7 +52,7 @@ { double[] s1 = *cast(double[]*)p1; double[] s2 = *cast(double[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (len != s2.length) return 0; @@ -69,7 +69,7 @@ { double[] s1 = *cast(double[]*)p1; double[] s2 = *cast(double[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; @@ -82,7 +82,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (double[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Afloat.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Afloat.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Afloat.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Afloat.d 2005-09-24 17:25:30.000000000 +0200 @@ -32,7 +32,7 @@ uint getHash(void *p) { float[] s = *cast(float[]*)p; - uint len = s.length; + size_t len = s.length; float *str = s; uint hash = 0; @@ -51,7 +51,7 @@ { float[] s1 = *cast(float[]*)p1; float[] s2 = *cast(float[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (len != s2.length) return 0; @@ -68,7 +68,7 @@ { float[] s1 = *cast(float[]*)p1; float[] s2 = *cast(float[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; @@ -81,7 +81,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (float[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Ag.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Ag.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Ag.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Ag.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { byte[] s = *cast(byte[]*)p; - uint len = s.length; + size_t len = s.length; byte *str = s; uint hash = 0; @@ -61,11 +61,11 @@ { byte[] s1 = *cast(byte[]*)p1; byte[] s2 = *cast(byte[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -74,7 +74,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (byte[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aint.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aint.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aint.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aint.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { int[] s = *cast(int[]*)p; - uint len = s.length; + size_t len = s.length; int *str = s; uint hash = 0; @@ -37,11 +37,11 @@ { int[] s1 = *cast(int[]*)p1; int[] s2 = *cast(int[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -50,7 +50,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (int[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Along.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Along.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Along.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Along.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { long[] s = *cast(long[]*)p; - uint len = s.length; + size_t len = s.length; long *str = s; uint hash = 0; @@ -37,11 +37,11 @@ { long[] s1 = *cast(long[]*)p1; long[] s2 = *cast(long[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -50,7 +50,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (long[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Areal.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Areal.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Areal.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Areal.d 2005-09-24 17:25:30.000000000 +0200 @@ -32,7 +32,7 @@ uint getHash(void *p) { real[] s = *cast(real[]*)p; - uint len = s.length; + size_t len = s.length; real *str = s; uint hash = 0; @@ -53,7 +53,7 @@ { real[] s1 = *cast(real[]*)p1; real[] s2 = *cast(real[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (len != s2.length) return 0; @@ -70,7 +70,7 @@ { real[] s1 = *cast(real[]*)p1; real[] s2 = *cast(real[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; @@ -83,7 +83,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (real[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Ashort.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Ashort.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Ashort.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Ashort.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { short[] s = *cast(short[]*)p; - uint len = s.length; + size_t len = s.length; short *str = s; uint hash = 0; @@ -50,11 +50,11 @@ { short[] s1 = *cast(short[]*)p1; short[] s2 = *cast(short[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -63,7 +63,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (short[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aubyte.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aubyte.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aubyte.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aubyte.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { ubyte[] s = *cast(ubyte[]*)p; - uint len = s.length; + size_t len = s.length; ubyte *str = s; uint hash = 0; @@ -65,7 +65,7 @@ return std.string.cmp(s1, s2); } - int tsize() + size_t tsize() { return (ubyte[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Auint.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Auint.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Auint.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Auint.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { uint[] s = *cast(uint[]*)p; - uint len = s.length; + size_t len = s.length; uint *str = s; uint hash = 0; @@ -37,11 +37,11 @@ { uint[] s1 = *cast(uint[]*)p1; uint[] s2 = *cast(uint[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -50,7 +50,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (uint[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aulong.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aulong.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aulong.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aulong.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { ulong[] s = *cast(ulong[]*)p; - uint len = s.length; + size_t len = s.length; ulong *str = s; uint hash = 0; @@ -37,11 +37,11 @@ { ulong[] s1 = *cast(ulong[]*)p1; ulong[] s2 = *cast(ulong[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -50,7 +50,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (ulong[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aushort.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aushort.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Aushort.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Aushort.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { ushort[] s = *cast(ushort[]*)p; - uint len = s.length; + size_t len = s.length; ushort *str = s; uint hash = 0; @@ -50,11 +50,11 @@ { ushort[] s1 = *cast(ushort[]*)p1; ushort[] s2 = *cast(ushort[]*)p2; - uint len = s1.length; + size_t len = s1.length; if (s2.length < len) len = s2.length; - for (uint u = 0; u < len; u++) + for (size_t u = 0; u < len; u++) { int result = s1[u] - s2[u]; if (result) @@ -63,7 +63,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (ushort[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Awchar.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Awchar.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_Awchar.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_Awchar.d 2005-09-24 17:25:30.000000000 +0200 @@ -9,7 +9,7 @@ uint getHash(void *p) { wchar[] s = *cast(wchar[]*)p; - uint len = s.length; + size_t len = s.length; wchar *str = s; uint hash = 0; @@ -63,7 +63,7 @@ return cast(int)s1.length - cast(int)s2.length; } - int tsize() + size_t tsize() { return (wchar[]).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_bit.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_bit.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_bit.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_bit.d 2005-09-24 17:25:30.000000000 +0200 @@ -24,7 +24,7 @@ return 0; } - int tsize() + size_t tsize() { return bit.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_byte.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_byte.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_byte.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_byte.d 2005-09-24 17:25:30.000000000 +0200 @@ -20,7 +20,7 @@ return *cast(byte *)p1 - *cast(byte *)p2; } - int tsize() + size_t tsize() { return byte.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_C.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_C.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_C.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_C.d 2005-09-24 17:25:30.000000000 +0200 @@ -63,7 +63,7 @@ return c; } - int tsize() + size_t tsize() { return Object.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_cdouble.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_cdouble.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_cdouble.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_cdouble.d 2005-09-24 17:25:30.000000000 +0200 @@ -42,7 +42,7 @@ return _compare(*cast(cdouble *)p1, *cast(cdouble *)p2); } - int tsize() + size_t tsize() { return cdouble.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_cfloat.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_cfloat.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_cfloat.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_cfloat.d 2005-09-24 17:25:30.000000000 +0200 @@ -41,7 +41,7 @@ return _compare(*cast(cfloat *)p1, *cast(cfloat *)p2); } - int tsize() + size_t tsize() { return cfloat.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_char.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_char.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_char.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_char.d 2005-09-24 17:25:30.000000000 +0200 @@ -19,7 +19,7 @@ return *cast(char *)p1 - *cast(char *)p2; } - int tsize() + size_t tsize() { return char.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_creal.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_creal.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_creal.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_creal.d 2005-09-24 17:25:30.000000000 +0200 @@ -43,7 +43,7 @@ return _compare(*cast(creal *)p1, *cast(creal *)p2); } - int tsize() + size_t tsize() { return creal.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_dchar.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_dchar.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_dchar.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_dchar.d 2005-09-24 17:25:30.000000000 +0200 @@ -20,7 +20,7 @@ return *cast(dchar *)p1 - *cast(dchar *)p2; } - int tsize() + size_t tsize() { return dchar.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_delegate.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_delegate.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_delegate.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_delegate.d 2005-09-24 17:25:30.000000000 +0200 @@ -16,7 +16,7 @@ return *cast(dg *)p1 == *cast(dg *)p2; } - int tsize() + size_t tsize() { return dg.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_double.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_double.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_double.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_double.d 2005-09-24 17:25:30.000000000 +0200 @@ -42,7 +42,7 @@ return _compare(*cast(double *)p1, *cast(double *)p2); } - int tsize() + size_t tsize() { return double.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_float.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_float.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_float.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_float.d 2005-09-24 17:25:30.000000000 +0200 @@ -42,7 +42,7 @@ return _compare(*cast(float *)p1, *cast(float *)p2); } - int tsize() + size_t tsize() { return float.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_int.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_int.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_int.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_int.d 2005-09-24 17:25:30.000000000 +0200 @@ -24,7 +24,7 @@ return 0; } - int tsize() + size_t tsize() { return int.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_long.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_long.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_long.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_long.d 2005-09-24 17:25:30.000000000 +0200 @@ -24,7 +24,7 @@ return 0; } - int tsize() + size_t tsize() { return long.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_ptr.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_ptr.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_ptr.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_ptr.d 2005-09-24 17:25:30.000000000 +0200 @@ -18,7 +18,7 @@ return *cast(void* *)p1 - *cast(void* *)p2; } - int tsize() + size_t tsize() { return (void*).sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_real.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_real.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_real.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_real.d 2005-09-24 17:25:30.000000000 +0200 @@ -42,7 +42,7 @@ return _compare(*cast(real *)p1, *cast(real *)p2); } - int tsize() + size_t tsize() { return real.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_short.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_short.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_short.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_short.d 2005-09-24 17:25:30.000000000 +0200 @@ -20,7 +20,7 @@ return *cast(short *)p1 - *cast(short *)p2; } - int tsize() + size_t tsize() { return short.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_ubyte.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_ubyte.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_ubyte.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_ubyte.d 2005-09-24 17:25:30.000000000 +0200 @@ -20,7 +20,7 @@ return *cast(ubyte *)p1 - *cast(ubyte *)p2; } - int tsize() + size_t tsize() { return ubyte.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_uint.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_uint.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_uint.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_uint.d 2005-09-24 17:25:30.000000000 +0200 @@ -24,7 +24,7 @@ return 0; } - int tsize() + size_t tsize() { return uint.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_ulong.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_ulong.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_ulong.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_ulong.d 2005-09-24 17:25:30.000000000 +0200 @@ -24,7 +24,7 @@ return 0; } - int tsize() + size_t tsize() { return ulong.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_ushort.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_ushort.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_ushort.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_ushort.d 2005-09-24 17:25:30.000000000 +0200 @@ -20,7 +20,7 @@ return *cast(ushort *)p1 - *cast(ushort *)p2; } - int tsize() + size_t tsize() { return ushort.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_wchar.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_wchar.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_wchar.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_wchar.d 2005-09-24 17:25:30.000000000 +0200 @@ -19,7 +19,7 @@ return *cast(wchar *)p1 - *cast(wchar *)p2; } - int tsize() + size_t tsize() { return wchar.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std/typeinfo/ti_void.d dmd-0.133/dmd/src/phobos/std/typeinfo/ti_void.d --- dmd-0.132/dmd/src/phobos/std/typeinfo/ti_void.d 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std/typeinfo/ti_void.d 2005-09-24 17:25:30.000000000 +0200 @@ -21,7 +21,7 @@ return *cast(byte *)p1 - *cast(byte *)p2; } - int tsize() + size_t tsize() { return void.sizeof; } diff -uNr dmd-0.132/dmd/src/phobos/std_boilerplate.html dmd-0.133/dmd/src/phobos/std_boilerplate.html --- dmd-0.132/dmd/src/phobos/std_boilerplate.html 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/std_boilerplate.html 1970-01-01 01:00:00.000000000 +0100 @@ -1,137 +0,0 @@ - - - - - - - -Digital Mars - The D Programming Language - $(TITLE) - - - - -www.digitalmars.com - -Home -| Search -| D -| Comments - -
    -Last update $(DATETIME) -
    - - - -
    -
    -
    - - - - - -
    -
    -
    D
    -
    Language
    -
    Phobos
    -
    Comparisons


    - -object
    -
    - -std
    std.base64
    std.boxer
    std.compiler
    std.conv
    std.ctype
    std.date
    std.file
    std.format
    std.gc
    std.intrinsic
    std.math
    std.md5
    std.mmfile
    std.openrj
    std.outbuffer
    std.path
    std.process
    std.random
    std.recls
    std.regexp
    std.socket
    std.socketstream
    std.stdint
    std.stdio
    std.cstream
    std.stream
    std.string
    std.system
    std.thread
    std.uri
    std.utf
    std.zip
    std.zlib
    -
    -std.windows
    -
    -std.linux
    -
    -std.c
    std.c.stdio
    -
    -std.c.windows
    -
    -std.c.linux
    -
    -
    -
    - - -

    $(TITLE)

    - -
    -$(BODY) -
    - - -
    -

    Feedback and Comments

    - - Add feedback and comments regarding this - page. - -
    -Copyright © 1999-$(YEAR) by Digital Mars, All Rights Reserved

    - - - - - - - - - - - diff -uNr dmd-0.132/dmd/src/phobos/std.ddoc dmd-0.133/dmd/src/phobos/std.ddoc --- dmd-0.132/dmd/src/phobos/std.ddoc 1970-01-01 01:00:00.000000000 +0100 +++ dmd-0.133/dmd/src/phobos/std.ddoc 2005-09-24 17:25:30.000000000 +0200 @@ -0,0 +1,134 @@ +DDOC = + + + + + + +Digital Mars - The D Programming Language - $(TITLE) + + + + + +www.digitalmars.com + +Home +| Search +| D +| Comments + +
    +Last update $(DATETIME) +


    + + + +
    +
    +
    + + + + + +
    +
    +
    D
    +
    Language
    +
    Phobos
    +
    Comparisons


    + +object
    +
    + +std
    std.base64
    std.boxer
    std.compiler
    std.conv
    std.ctype
    std.date
    std.file
    std.format
    std.gc
    std.intrinsic
    std.math
    std.md5
    std.mmfile
    std.openrj
    std.outbuffer
    std.path
    std.process
    std.random
    std.recls
    std.regexp
    std.socket
    std.socketstream
    std.stdint
    std.stdio
    std.cstream
    std.stream
    std.string
    std.system
    std.thread
    std.uri
    std.utf
    std.zip
    std.zlib
    +
    +std.windows
    +
    +std.linux
    +
    +std.c
    std.c.stdio
    +
    +std.c.windows
    +
    +std.c.linux
    +
    +
    +
    + + +

    $(TITLE)

    + +
    +$(BODY) +
    + + +
    +

    Feedback and Comments

    + + Add feedback and comments regarding this + page. + +
    +Copyright © 1999-$(YEAR) by Digital Mars, All Rights Reserved

    + + + + + + + + + + + diff -uNr dmd-0.132/dmd/src/phobos/win32.mak dmd-0.133/dmd/src/phobos/win32.mak --- dmd-0.132/dmd/src/phobos/win32.mak 2005-09-19 17:54:38.000000000 +0200 +++ dmd-0.133/dmd/src/phobos/win32.mak 2005-09-24 17:25:30.000000000 +0200 @@ -9,6 +9,8 @@ # Delete unneeded files created by build process # make unittest # Build phobos.lib, build and run unit tests +# make html +# Build documentation # Notes: # This relies on LIB.EXE 8.00 or later, and MAKE.EXE 5.01 or later. @@ -84,7 +86,7 @@ ti_dchar.obj ti_Adchar.obj ti_bit.obj ti_Abit.obj ti_void.obj DOCS= $(DOC)\std_path.html $(DOC)\std_math.html $(DOC)\std_outbuffer.html \ - $(DOC)\std_stream.html + $(DOC)\std_stream.html $(DOC)\std_string.html SRC= errno.c object.d unittest.d crc32.d gcstats.d @@ -478,8 +480,8 @@ loader.obj : std\loader.d $(DMD) -c $(DFLAGS) std\loader.d -math.obj $(DOC)\std_math.html : std\math.d - $(DMD) -c $(DFLAGS) -Df$(DOC)\std_math.html std\math.d +math.obj : std\math.d + $(DMD) -c $(DFLAGS) std\math.d math2.obj : std\math2.d $(DMD) -c $(DFLAGS) std\math2.d @@ -499,14 +501,14 @@ openrj.obj : std\openrj.d $(DMD) -c $(DFLAGS) std\openrj.d -outbuffer.obj $(DOC)\std_outbuffer.html : std\outbuffer.d - $(DMD) -c $(DFLAGS) -Df$(DOC)\std_outbuffer.html std\outbuffer.d +outbuffer.obj : std\outbuffer.d + $(DMD) -c $(DFLAGS) std\outbuffer.d outofmemory.obj : std\outofmemory.d $(DMD) -c $(DFLAGS) std\outofmemory.d -path.obj $(DOC)\std_path.html : std\path.d - $(DMD) -c $(DFLAGS) -Df$(DOC)\std_path.html std\path.d +path.obj : std\path.d + $(DMD) -c $(DFLAGS) std\path.d perf.obj : std\perf.d $(DMD) -c $(DFLAGS) std\perf.d @@ -532,8 +534,8 @@ stdio.obj : std\stdio.d $(DMD) -c $(DFLAGS) std\stdio.d -stream.obj $(DOC)\std_stream.html : std\stream.d - $(DMD) -c $(DFLAGS) -Df$(DOC)\std_stream.html -d std\stream.d +stream.obj : std\stream.d + $(DMD) -c $(DFLAGS) -d std\stream.d string.obj : std\string.d $(DMD) -c $(DFLAGS) std\string.d @@ -734,13 +736,31 @@ $(DMD) -c $(DFLAGS) std\typeinfo\ti_int.d +################## DOCS #################################### + +$(DOC)\std_math.html : std.ddoc std\math.d + $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_math.html std.ddoc std\math.d + +$(DOC)\std_outbuffer.html : std.ddoc std\outbuffer.d + $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_outbuffer.html std.ddoc std\outbuffer.d + +$(DOC)\std_path.html : std.ddoc std\path.d + $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_path.html std.ddoc std\path.d + +$(DOC)\std_stream.html : std.ddoc std\stream.d + $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_stream.html -d std.ddoc std\stream.d + +$(DOC)\std_string.html : std.ddoc std\string.d + $(DMD) -c -o- $(DFLAGS) -Df$(DOC)\std_string.html std.ddoc std\string.d + + ###################################################### -zip : win32.mak linux.mak phoboslicense.txt std_boilerplate.html $(SRC) \ +zip : win32.mak linux.mak phoboslicense.txt std.ddoc $(SRC) \ $(SRC_STD) $(SRC_STD_C) $(SRC_TI) $(SRC_INT) $(SRC_STD_WIN) \ $(SRC_STDLINUX) $(SRC_ETC) $(SRC_ETC_C) $(SRC_ZLIB) $(SRC_GC) del phobos.zip - zip32 -u phobos win32.mak linux.mak std_boilerplate.html + zip32 -u phobos win32.mak linux.mak std.ddoc zip32 -u phobos $(SRC) zip32 -u phobos $(SRC_TI) zip32 -u phobos $(SRC_INT) @@ -762,7 +782,7 @@ install: $(CP) phobos.lib gcstub.obj \dmd\lib - $(CP) win32.mak linux.mak phoboslicense.txt minit.obj std_boilerplate.html \dmd\src\phobos + $(CP) win32.mak linux.mak phoboslicense.txt minit.obj std.ddoc \dmd\src\phobos $(CP) $(SRC) \dmd\src\phobos $(CP) $(SRC_STD) \dmd\src\phobos\std $(CP) $(SRC_STD_C) \dmd\src\phobos\std\c